From 09edc2c2bbca4e668222ec0ffdae15f051cf8ea1 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 20 Feb 2015 10:53:22 +0100 Subject: [PATCH] [multiple changes] 2015-02-20 Eric Botcazou * inline.adb (Expand_Inlined_Call): Skip again calls to subprogram renamings. * exp_ch6.adb (Expand_Call): Use back-end inlining instead of expansion for simple subprogram renamings. 2015-02-20 Robert Dewar * exp_util.adb: Minor reformatting. From-SVN: r220844 --- gcc/ada/ChangeLog | 11 +++++++++++ gcc/ada/exp_ch6.adb | 9 +++++++-- gcc/ada/exp_util.adb | 5 +++-- gcc/ada/inline.adb | 7 +++---- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 72d2a655f3c..e50d1954124 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2015-02-20 Eric Botcazou + + * inline.adb (Expand_Inlined_Call): Skip again calls to subprogram + renamings. + * exp_ch6.adb (Expand_Call): Use back-end inlining + instead of expansion for simple subprogram renamings. + +2015-02-20 Robert Dewar + + * exp_util.adb: Minor reformatting. + 2015-02-20 Vincent Celier * switch-c.adb (Scan_Front_End_Switches): Do not fail when --RTS= diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 870e5f8b131..8b2278f2bab 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -3778,12 +3778,17 @@ package body Exp_Ch6 is or else Nkind (Unit_Declaration_Node (Subp)) /= N_Subprogram_Declaration or else No (Body_To_Inline (Unit_Declaration_Node (Subp))) + or else Nkind (Body_To_Inline (Unit_Declaration_Node (Subp))) in + N_Entity then Add_Inlined_Body (Subp, Call_Node); -- Front end expansion of simple functions returning unconstrained - -- types (see Check_And_Split_Unconstrained_Function) and simple - -- renamings inlined by the front end (see Build_Renamed_Body). + -- types (see Check_And_Split_Unconstrained_Function). Note that the + -- case of a simple renaming (Body_To_Inline in N_Entity above, see + -- also Build_Renamed_Body) cannot be expanded here because this may + -- give rise to order-of-elaboration issues for the types of the + -- parameters of the subprogram, if any. else Expand_Inlined_Call (Call_Node, Subp, Orig_Subp); diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index ef463c28e8d..aa835adf632 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -7315,8 +7315,9 @@ package body Exp_Util is (Loc : Source_Ptr; Id : Character; Related_Nod : Node_Id := Empty) return Entity_Id; - -- Create an external symbol of the form xxx_FIRST/_LAST if Related_Id - -- is present, otherwise it generates an internal temporary. + -- Create an external symbol of the form xxx_FIRST/_LAST if Related_Nod + -- is present (xxx is taken from the Chars field of Related_Nod), + -- otherwise it generates an internal temporary. --------------------- -- Build_Temporary -- diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index 74b39710a1d..9a60befa0bf 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -2694,12 +2694,11 @@ package body Inline is return; -- Skip inlining if this is not a true inlining since the attribute - -- Body_To_Inline is also set for renamings (see sinfo.ads) + -- Body_To_Inline is also set for renamings (see sinfo.ads). For a + -- true inlining, Orig_Bod has code rather than being an entity. elsif Nkind (Orig_Bod) in N_Entity then - if not Has_Pragma_Inline (Subp) then - return; - end if; + return; -- Skip inlining if the function returns an unconstrained type using -- an extended return statement since this part of the new inlining -- 2.30.2