diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-08-13 08:08:11 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-08-13 08:08:11 +0000 |
commit | 49209838d35fbf7a130738be6eb0c281a40e8f20 (patch) | |
tree | ac6436df178f213ee10ea420e35687fa567137c8 /gcc/ada/inline.adb | |
parent | 063907abadf6ee9ffe4d60d4b61eb8a144aa29f7 (diff) | |
download | gcc-49209838d35fbf7a130738be6eb0c281a40e8f20.zip gcc-49209838d35fbf7a130738be6eb0c281a40e8f20.tar.gz gcc-49209838d35fbf7a130738be6eb0c281a40e8f20.tar.bz2 |
[Ada] Small cleanup and improvement in inlining machinery
This is a small cleanup in the inlining machinery of the front-end
dealing with back-end inlining. It should save a few cycles at -O0 by
stopping it from doing useless work. No functional changes.
2019-08-13 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_ch6.adb: Remove with and use clauses for Sem_Ch12.
(Expand_Call_Helper): Swap the back-end inlining case and the
special front-end expansion case. In back-end inlining mode, do
not invoke Add_Inlined_Body unless the call may be inlined.
* inline.ads (Add_Pending_Instantiation): New function moved
from...
* inline.adb (Add_Inlined_Body): Simplify comment. Turn test on
the enclosing unit into assertion.
(Add_Pending_Instantiation): New function moved from...
* sem_ch12.ads (Add_Pending_Instantiation): ...here.
* sem_ch12.adb (Add_Pending_Instantiation): ...here.
From-SVN: r274353
Diffstat (limited to 'gcc/ada/inline.adb')
-rw-r--r-- | gcc/ada/inline.adb | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index 5b7fefc..3a3ec0c 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -485,9 +485,7 @@ package body Inline is -- 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, - -- and there is no need to add the enclosing unit (whose body might not - -- be available). + -- 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 @@ -497,13 +495,14 @@ package body Inline is Pack : constant Entity_Id := Get_Code_Unit_Entity (E); begin + Set_Is_Called (E); + if Pack = E then - Set_Is_Called (E); Inlined_Bodies.Increment_Last; Inlined_Bodies.Table (Inlined_Bodies.Last) := E; - elsif Ekind (Pack) = E_Package then - Set_Is_Called (E); + else + pragma Assert (Ekind (Pack) = E_Package); if Is_Generic_Instance (Pack) then null; @@ -606,6 +605,26 @@ package body Inline is end if; end Add_Inlined_Subprogram; + -------------------------------- + -- Add_Pending_Instantiation -- + -------------------------------- + + procedure Add_Pending_Instantiation (Inst : Node_Id; Act_Decl : Node_Id) is + begin + -- Capture the body of the generic instantiation along with its context + -- for later processing by Instantiate_Bodies. + + Pending_Instantiations.Append + ((Act_Decl => Act_Decl, + Config_Switches => Save_Config_Switches, + Current_Sem_Unit => Current_Sem_Unit, + Expander_Status => Expander_Active, + Inst_Node => Inst, + Local_Suppress_Stack_Top => Local_Suppress_Stack_Top, + Scope_Suppress => Scope_Suppress, + Warnings => Save_Warnings)); + end Add_Pending_Instantiation; + ------------------------ -- Add_Scope_To_Clean -- ------------------------ |