]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Small internal improvements to the inlining machinery
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Aug 2019 09:50:51 +0000 (09:50 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Aug 2019 09:50:51 +0000 (09:50 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@274447 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/inline.adb

index 8ad19833248ac8c767ea60fbd0faec6354ee5602..ff7de27c00e00f55f4d378303706ce342d78e2a8 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        * sem_ch4.adb (Analyze_Selected_Component): In the case where
index 3a3ec0cf8edfc01bdf43290b865f7f7c7d365d6e..aa8f7ddf40d8d517c30561746fa2c8fefaa7f5ec 100644 (file)
@@ -481,12 +481,6 @@ package body Inline is
       end if;
 
       --  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
       --  no enclosing package to retrieve. In this case, it is the body of
       --  the function that will have to be loaded.
@@ -504,6 +498,9 @@ package body Inline is
          else
             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
                null;
 
@@ -514,7 +511,7 @@ package body Inline is
             --  Do not inline it either if it is in the main unit.
             --  Extend the -gnatn2 processing to -gnatn1 for Inline_Always
             --  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
                       and then Has_Pragma_Inline_Always (E)
@@ -4350,7 +4347,7 @@ package body Inline is
          while Present (Elmt) loop
             Nod := Node (Elmt);
 
-            if In_Extended_Main_Code_Unit (Nod) then
+            if not In_Internal_Unit (Nod) then
                Count := Count + 1;
 
                if Count = 1 then
@@ -4379,7 +4376,7 @@ package body Inline is
          while Present (Elmt) loop
             Nod := Node (Elmt);
 
-            if In_Extended_Main_Code_Unit (Nod) then
+            if not In_Internal_Unit (Nod) then
                Count := Count + 1;
 
                if Count = 1 then
@@ -4407,22 +4404,24 @@ package body Inline is
          while Present (Elmt) loop
             Nod := Node (Elmt);
 
-            Count := Count + 1;
+            if not In_Internal_Unit (Nod) then
+               Count := Count + 1;
 
-            if Count = 1 then
-               Write_Str
-                 ("List of inlined subprograms passed to the backend");
-               Write_Eol;
-            end if;
+               if Count = 1 then
+                  Write_Str
+                    ("List of inlined subprograms passed to the backend");
+                  Write_Eol;
+               end if;
 
-            Write_Str ("  ");
-            Write_Int (Count);
-            Write_Str (":");
-            Write_Name (Chars (Nod));
-            Write_Str (" (");
-            Write_Location (Sloc (Nod));
-            Write_Str (")");
-            Output.Write_Eol;
+               Write_Str ("  ");
+               Write_Int (Count);
+               Write_Str (":");
+               Write_Name (Chars (Nod));
+               Write_Str (" (");
+               Write_Location (Sloc (Nod));
+               Write_Str (")");
+               Output.Write_Eol;
+            end if;
 
             Next_Elmt (Elmt);
          end loop;
@@ -4437,22 +4436,24 @@ package body Inline is
          while Present (Elmt) loop
             Nod := Node (Elmt);
 
-            Count := Count + 1;
+            if not In_Internal_Unit (Nod) then
+               Count := Count + 1;
 
-            if Count = 1 then
-               Write_Str
-                 ("List of subprograms that cannot be inlined by the backend");
-               Write_Eol;
-            end if;
+               if Count = 1 then
+                  Write_Str
+                    ("List of subprograms that cannot be inlined by backend");
+                  Write_Eol;
+               end if;
 
-            Write_Str ("  ");
-            Write_Int (Count);
-            Write_Str (":");
-            Write_Name (Chars (Nod));
-            Write_Str (" (");
-            Write_Location (Sloc (Nod));
-            Write_Str (")");
-            Output.Write_Eol;
+               Write_Str ("  ");
+               Write_Int (Count);
+               Write_Str (":");
+               Write_Name (Chars (Nod));
+               Write_Str (" (");
+               Write_Location (Sloc (Nod));
+               Write_Str (")");
+               Output.Write_Eol;
+            end if;
 
             Next_Elmt (Elmt);
          end loop;