Commit 4a6db9fd by Eric Botcazou Committed by Pierre-Marie de Rodat

[Ada] Small internal improvements to the inlining machinery

No functional changes.

2019-08-14  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* inline.adb (Add_Inlined_Body): Tweak comments.
	(List_Inlining_Info): Also list information about non-main
	units.

From-SVN: r274447
parent 27de857e
2019-08-14 Eric Botcazou <ebotcazou@adacore.com>
* inline.adb (Add_Inlined_Body): Tweak comments.
(List_Inlining_Info): Also list information about non-main
units.
2019-08-14 Gary Dismukes <dismukes@adacore.com> 2019-08-14 Gary Dismukes <dismukes@adacore.com>
* sem_ch4.adb (Analyze_Selected_Component): In the case where * sem_ch4.adb (Analyze_Selected_Component): In the case where
......
...@@ -481,12 +481,6 @@ package body Inline is ...@@ -481,12 +481,6 @@ package body Inline is
end if; end if;
-- Find unit containing E, and add to list of inlined bodies if needed. -- Find unit containing E, and add to list of inlined bodies if needed.
-- If the body is already present, no need to load any other unit. This
-- is the case for an initialization procedure, which appears in the
-- package declaration that contains the type. It is also the case if
-- the body has already been analyzed. Finally, if the unit enclosing
-- E is an instance, the instance body will be analyzed in any case.
-- Library-level functions must be handled specially, because there is -- Library-level functions must be handled specially, because there is
-- no enclosing package to retrieve. In this case, it is the body of -- no enclosing package to retrieve. In this case, it is the body of
-- the function that will have to be loaded. -- the function that will have to be loaded.
...@@ -504,6 +498,9 @@ package body Inline is ...@@ -504,6 +498,9 @@ package body Inline is
else else
pragma Assert (Ekind (Pack) = E_Package); pragma Assert (Ekind (Pack) = E_Package);
-- If the unit containing E is an instance, then the instance body
-- will be analyzed in any case, see Sem_Ch12.Might_Inline_Subp.
if Is_Generic_Instance (Pack) then if Is_Generic_Instance (Pack) then
null; null;
...@@ -514,7 +511,7 @@ package body Inline is ...@@ -514,7 +511,7 @@ package body Inline is
-- Do not inline it either if it is in the main unit. -- Do not inline it either if it is in the main unit.
-- Extend the -gnatn2 processing to -gnatn1 for Inline_Always -- Extend the -gnatn2 processing to -gnatn1 for Inline_Always
-- calls if the back-end takes care of inlining the call. -- calls if the back-end takes care of inlining the call.
-- Note that Level in Inline_Package | Inline_Call here. -- Note that Level is in Inline_Call | Inline_Packag here.
elsif ((Level = Inline_Call elsif ((Level = Inline_Call
and then Has_Pragma_Inline_Always (E) and then Has_Pragma_Inline_Always (E)
...@@ -4350,7 +4347,7 @@ package body Inline is ...@@ -4350,7 +4347,7 @@ package body Inline is
while Present (Elmt) loop while Present (Elmt) loop
Nod := Node (Elmt); Nod := Node (Elmt);
if In_Extended_Main_Code_Unit (Nod) then if not In_Internal_Unit (Nod) then
Count := Count + 1; Count := Count + 1;
if Count = 1 then if Count = 1 then
...@@ -4379,7 +4376,7 @@ package body Inline is ...@@ -4379,7 +4376,7 @@ package body Inline is
while Present (Elmt) loop while Present (Elmt) loop
Nod := Node (Elmt); Nod := Node (Elmt);
if In_Extended_Main_Code_Unit (Nod) then if not In_Internal_Unit (Nod) then
Count := Count + 1; Count := Count + 1;
if Count = 1 then if Count = 1 then
...@@ -4407,6 +4404,7 @@ package body Inline is ...@@ -4407,6 +4404,7 @@ package body Inline is
while Present (Elmt) loop while Present (Elmt) loop
Nod := Node (Elmt); Nod := Node (Elmt);
if not In_Internal_Unit (Nod) then
Count := Count + 1; Count := Count + 1;
if Count = 1 then if Count = 1 then
...@@ -4423,6 +4421,7 @@ package body Inline is ...@@ -4423,6 +4421,7 @@ package body Inline is
Write_Location (Sloc (Nod)); Write_Location (Sloc (Nod));
Write_Str (")"); Write_Str (")");
Output.Write_Eol; Output.Write_Eol;
end if;
Next_Elmt (Elmt); Next_Elmt (Elmt);
end loop; end loop;
...@@ -4437,11 +4436,12 @@ package body Inline is ...@@ -4437,11 +4436,12 @@ package body Inline is
while Present (Elmt) loop while Present (Elmt) loop
Nod := Node (Elmt); Nod := Node (Elmt);
if not In_Internal_Unit (Nod) then
Count := Count + 1; Count := Count + 1;
if Count = 1 then if Count = 1 then
Write_Str Write_Str
("List of subprograms that cannot be inlined by the backend"); ("List of subprograms that cannot be inlined by backend");
Write_Eol; Write_Eol;
end if; end if;
...@@ -4453,6 +4453,7 @@ package body Inline is ...@@ -4453,6 +4453,7 @@ package body Inline is
Write_Location (Sloc (Nod)); Write_Location (Sloc (Nod));
Write_Str (")"); Write_Str (")");
Output.Write_Eol; Output.Write_Eol;
end if;
Next_Elmt (Elmt); Next_Elmt (Elmt);
end loop; end loop;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment