* [Ada] Lift inlining limitation with -gnatn (2)
@ 2011-08-02 12:37 Arnaud Charlet
0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2011-08-02 12:37 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
[-- Attachment #1: Type: text/plain, Size: 386 bytes --]
This fixes an oversight in the previous change: the check for library-level
inlined functions must be adjusted to the result of Get_Code_Unit_Entity.
Tested on x86_64-pc-linux-gnu, committed on trunk
2011-08-02 Eric Botcazou <ebotcazou@adacore.com>
* inline.adb (Add_Inlined_Body): Adjust check for library-level inlined
functions to previous change. Reorganize code slightly.
[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 2305 bytes --]
Index: inline.adb
===================================================================
--- inline.adb (revision 177136)
+++ inline.adb (working copy)
@@ -236,7 +236,6 @@
----------------------
procedure Add_Inlined_Body (E : Entity_Id) is
- Pack : Entity_Id;
function Must_Inline return Boolean;
-- Inlining is only done if the call statement N is in the main unit,
@@ -318,35 +317,39 @@
-- no enclosing package to retrieve. In this case, it is the body of
-- the function that will have to be loaded.
- if not Is_Abstract_Subprogram (E) and then not Is_Nested (E)
+ if not Is_Abstract_Subprogram (E)
+ and then not Is_Nested (E)
and then Convention (E) /= Convention_Protected
+ and then Must_Inline
then
- Pack := Get_Code_Unit_Entity (E);
+ declare
+ Pack : constant Entity_Id := Get_Code_Unit_Entity (E);
- if Must_Inline
- and then Ekind (Pack) = E_Package
- then
- Set_Is_Called (E);
+ begin
+ if Pack = E then
- if Pack = Standard_Standard then
-
-- Library-level inlined function. Add function itself to
-- list of needed units.
+ Set_Is_Called (E);
Inlined_Bodies.Increment_Last;
Inlined_Bodies.Table (Inlined_Bodies.Last) := E;
- elsif Is_Generic_Instance (Pack) then
- null;
+ elsif Ekind (Pack) = E_Package then
+ Set_Is_Called (E);
- elsif not Is_Inlined (Pack)
- and then not Has_Completion (E)
- then
- Set_Is_Inlined (Pack);
- Inlined_Bodies.Increment_Last;
- Inlined_Bodies.Table (Inlined_Bodies.Last) := Pack;
+ if Is_Generic_Instance (Pack) then
+ null;
+
+ elsif not Is_Inlined (Pack)
+ and then not Has_Completion (E)
+ then
+ Set_Is_Inlined (Pack);
+ Inlined_Bodies.Increment_Last;
+ Inlined_Bodies.Table (Inlined_Bodies.Last) := Pack;
+ end if;
end if;
- end if;
+ end;
end if;
end Add_Inlined_Body;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-08-02 12:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-02 12:37 [Ada] Lift inlining limitation with -gnatn (2) Arnaud Charlet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).