From: Eric Botcazou Date: Wed, 14 Aug 2019 09:52:29 +0000 (+0000) Subject: [Ada] Further cleanup in the inlining machinery X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ebf7f0abade68c85557af4f634fe68b86c34f751;p=gcc.git [Ada] Further cleanup in the inlining machinery 2019-08-14 Eric Botcazou gcc/ada/ * sem_ch12.adb (Might_Inline_Subp): Rework comment and restrict the shortcut based on Is_Inlined to the back-end inlining case. From-SVN: r274468 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 4063f93efd5..a507c894449 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-08-14 Eric Botcazou + + * 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 * inline.adb (Check_And_Split_Unconstrained_Function): Ignore diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index dffec1443bd..de350b4e4d3 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -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;