* [Ada] Minor cleanup in support machinery for inter-unit inlining
@ 2017-09-06 9:54 Arnaud Charlet
0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2017-09-06 9:54 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
[-- Attachment #1: Type: text/plain, Size: 576 bytes --]
The inter-unit inlining done by the compiler requires a dedicated machinery
to deal with the public status of library-level entities, since it breaks
the private/plublic semantic barrier of the language.
This is a minor cleanup to this machinery, no functional changes.
Tested on x86_64-pc-linux-gnu, committed on trunk
2017-09-06 Eric Botcazou <ebotcazou@adacore.com>
* sem_ch7.adb (Has_Referencer): Move up and expand comment
explaining the test used to detect inlining. Use same test
in second occurrence.
(Analyze_Package_Body_Helper): Minor formatting fixes.
[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 2993 bytes --]
Index: sem_ch7.adb
===================================================================
--- sem_ch7.adb (revision 251762)
+++ sem_ch7.adb (working copy)
@@ -392,6 +392,13 @@
-- An inlined subprogram body acts as a referencer
+ -- Note that we test Has_Pragma_Inline here in addition
+ -- to Is_Inlined. We are doing this for a client, since
+ -- we are computing which entities should be public, and
+ -- it is the client who will decide if actual inlining
+ -- should occur, so we need to catch all cases where the
+ -- subprogram may be inlined by the client.
+
if Is_Inlined (Decl_Id)
or else Has_Pragma_Inline (Decl_Id)
then
@@ -413,18 +420,13 @@
else
Decl_Id := Defining_Entity (Decl);
- -- An inlined body acts as a referencer. Note that an
- -- inlined subprogram remains Is_Public as gigi requires
- -- the flag to be set.
+ -- An inlined body acts as a referencer, see above. Note
+ -- that an inlined subprogram remains Is_Public as gigi
+ -- requires the flag to be set.
- -- Note that we test Has_Pragma_Inline here rather than
- -- Is_Inlined. We are compiling this for a client, and
- -- it is the client who will decide if actual inlining
- -- should occur, so we need to assume that the procedure
- -- could be inlined for the purpose of accessing global
- -- entities.
-
- if Has_Pragma_Inline (Decl_Id) then
+ if Is_Inlined (Decl_Id)
+ or else Has_Pragma_Inline (Decl_Id)
+ then
if Top_Level
and then not Contains_Subprograms_Refs (Decl)
then
@@ -915,11 +917,11 @@
-- down the number of global symbols that do not neet public visibility
-- as this has two beneficial effects:
-- (1) It makes the compilation process more efficient.
- -- (2) It gives the code generatormore freedom to optimize within each
+ -- (2) It gives the code generator more leeway to optimize within each
-- unit, especially subprograms.
- -- This is done only for top level library packages or child units as
- -- the algorithm does a top down traversal of the package body.
+ -- This is done only for top-level library packages or child units as
+ -- the algorithm does a top-down traversal of the package body.
if (Scope (Spec_Id) = Standard_Standard or else Is_Child_Unit (Spec_Id))
and then not Is_Generic_Unit (Spec_Id)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-09-06 9:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-06 9:54 [Ada] Minor cleanup in support machinery for inter-unit inlining 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).