aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-08-14 09:52:29 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-14 09:52:29 +0000
commitebf7f0abade68c85557af4f634fe68b86c34f751 (patch)
tree742c322e4417b4ffe2aead34d8e6ba2f1e9184e9
parentdba246bfabc54c9a97304f4ab65fda62bd2936c8 (diff)
downloadgcc-ebf7f0abade68c85557af4f634fe68b86c34f751.zip
gcc-ebf7f0abade68c85557af4f634fe68b86c34f751.tar.gz
gcc-ebf7f0abade68c85557af4f634fe68b86c34f751.tar.bz2
[Ada] Further cleanup in the inlining machinery
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. From-SVN: r274468
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/sem_ch12.adb13
2 files changed, 14 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 4063f93..a507c89 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index dffec14..de350b4 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;