r264615 - in /trunk/gcc/ada: ChangeLog sem_ch7.adb

pmderodat@gcc.gnu.org pmderodat@gcc.gnu.org
Wed Sep 26 09:17:00 GMT 2018


Author: pmderodat
Date: Wed Sep 26 09:17:36 2018
New Revision: 264615

URL: https://gcc.gnu.org/viewcvs?rev=264615&root=gcc&view=rev
Log:
[Ada] Inlining of renamed subprogram instances in package body

This fixes a small discrepancy in the handling of renamed subprograms
declared in a package body, between those originally a regular
subprogram and those an instance of a generic subprogram, the latter
being slightly hindered.

The difference comes from the setting of the Is_Public flag, which was
more conservative in the latter case because instantiations of generic
subprograms are done in compiler-generated local packages.

It is eliminated by allowing Has_Referencer to recurse into nested
packages, but only if they are themselves not instances of generic
packages.

The compiler must now fully inline Doit_I into Doit at -O2 in:

package P is

  generic procedure Doit_G;

  procedure Doit;
end P;

package body P is

  N : Natural := 0;

  procedure Doit_G is
  begin
    N := 1;
  end Doit_G;

  procedure Doit_I is new Doit_G;

  procedure Doit renames Doit_I;

end P;

2018-09-26  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sem_ch7.adb (Has_Referencer): Remove Top_Level parameter and
	add In_Nested_Instance and
	Has_Outer_Referencer_Of_Non_Subprograms parameters.  Rename
	Has_Non_Subprograms_Referencer variable into
	Has_Referencer_Of_Non_Subprograms and initialize it with the new
	third parameter.  Adjust recursive calls and to the renaming.
	Replace test on Top_Level with test on In_Nested_Instance to
	decide whether to clear the Is_Public flag on entities.
	(Hide_Public_Entities): Adjust call to Has_Referencer.

Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/sem_ch7.adb



More information about the Gcc-cvs mailing list