]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Further cleanup in the inlining machinery
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Aug 2019 09:52:29 +0000 (09:52 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Aug 2019 09:52:29 +0000 (09:52 +0000)
2019-08-14  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* sem_ch12.adb (Might_Inline_Subp): Rework comment and restrict
the shortcut based on Is_Inlined to the back-end inlining case.

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

gcc/ada/ChangeLog
gcc/ada/sem_ch12.adb

index 4063f93efd59d01b2b7388fad83fbee8f791ab8b..a507c894449938cb6e294bf844a38267553c94f6 100644 (file)
@@ -1,3 +1,8 @@
+2019-08-14  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * sem_ch12.adb (Might_Inline_Subp): Rework comment and restrict
+       the shortcut based on Is_Inlined to the back-end inlining case.
+
 2019-08-14  Bob Duff  <duff@adacore.com>
 
        * inline.adb (Check_And_Split_Unconstrained_Function): Ignore
index dffec1443bd8305f96358af55d611250431ca354..de350b4e4d3a999cee5c7f6a4005fd0ac1ca0704 100644 (file)
@@ -3845,12 +3845,16 @@ package body Sem_Ch12 is
 
    procedure Analyze_Package_Instantiation (N : Node_Id) is
       Has_Inline_Always : Boolean := False;
+      --  Set if the generic unit contains any subprograms with Inline_Always.
+      --  Only relevant when back-end inlining is not enabled.
 
       function Might_Inline_Subp (Gen_Unit : Entity_Id) return Boolean;
       --  If inlining is active and the generic contains inlined subprograms,
-      --  we instantiate the body. This may cause superfluous instantiations,
-      --  but it is simpler than detecting the need for the body at the point
-      --  of inlining, when the context of the instance is not available.
+      --  we either instantiate the body when front-end inlining is enabled,
+      --  or we add a pending instantiation when back-end inlining is enabled.
+      --  In the former case, this may cause superfluous instantiations, but
+      --  in either case we need to perform the instantiation of the body in
+      --  the context of the instance and not in that of the point of inlining.
 
       -----------------------
       -- Might_Inline_Subp --
@@ -3862,8 +3866,9 @@ package body Sem_Ch12 is
       begin
          if Inline_Processing_Required then
             --  No need to recompute the answer if we know it is positive
+            --  and back-end inlining is enabled.
 
-            if Is_Inlined (Gen_Unit) then
+            if Is_Inlined (Gen_Unit) and then Back_End_Inlining then
                return True;
             end if;