diff mbox

[Ada] Reduce compilation time at -O0 (1/n)

Message ID 20110802082448.GA9705@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Aug. 2, 2011, 8:24 a.m. UTC
This patch slightly reduces compilation time at -O0 in typical conditions by
partially inlining Analyze_Aspect_Specification at its call sites.

No functional changes.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-08-02  Eric Botcazou  <ebotcazou@adacore.com>

	* sem_ch13.ads (Analyze_Aspect_Specification): Add pragma Inline.
	* sem_ch13.adb (Analyze_Non_Null_Aspect_Specifications): New procedure
	extracted from...
	(Analyze_Aspect_Specifications): ...here.  Call above procedure.
diff mbox

Patch

Index: sem_ch13.adb
===================================================================
--- sem_ch13.adb	(revision 177027)
+++ sem_ch13.adb	(working copy)
@@ -78,6 +78,16 @@ 
    --  inherited from a derived type that is no longer appropriate for the
    --  new Esize value. In this case, we reset the Alignment to unknown.
 
+   procedure Analyze_Non_Null_Aspect_Specifications
+     (N : Node_Id;
+      E : Entity_Id;
+      L : List_Id);
+   --  This procedure is called to analyze aspect specifications for node N.
+   --  E is the corresponding entity declared by the declaration node N, and
+   --  L is the list of aspect specifications for this node. This procedure
+   --  does the real work, as opposed to Analyze_Aspect_Specifications which
+   --  is inlined to fast-track the common case.
+
    procedure Build_Predicate_Function (Typ : Entity_Id; N : Node_Id);
    --  If Typ has predicates (indicated by Has_Predicates being set for Typ,
    --  then either there are pragma Invariant entries on the rep chain for the
@@ -688,6 +698,25 @@ 
       E : Entity_Id;
       L : List_Id)
    is
+   begin
+      --  Return if no aspects
+
+      if L = No_List then
+         return;
+      end if;
+
+      Analyze_Non_Null_Aspect_Specifications (N, E, L);
+   end Analyze_Aspect_Specifications;
+
+   --------------------------------------------
+   -- Analyze_Non_Null_Aspect_Specifications --
+   --------------------------------------------
+
+   procedure Analyze_Non_Null_Aspect_Specifications
+     (N : Node_Id;
+      E : Entity_Id;
+      L : List_Id)
+   is
       Aspect : Node_Id;
       Aitem  : Node_Id;
       Ent    : Node_Id;
@@ -715,12 +744,6 @@ 
       --  Set True if delay is required
 
    begin
-      --  Return if no aspects
-
-      if L = No_List then
-         return;
-      end if;
-
       --  Loop through aspects
 
       Aspect := First (L);
@@ -1198,7 +1221,7 @@ 
          <<Continue>>
             Next (Aspect);
       end loop;
-   end Analyze_Aspect_Specifications;
+   end Analyze_Non_Null_Aspect_Specifications;
 
    -----------------------
    -- Analyze_At_Clause --
Index: sem_ch13.ads
===================================================================
--- sem_ch13.ads	(revision 177055)
+++ sem_ch13.ads	(working copy)
@@ -46,6 +46,7 @@ 
    --  the call is ignored. Note that we can't use a simpler interface of just
    --  passing the node N, since the analysis of the node may cause it to be
    --  rewritten to a node not permitting aspect specifications.
+   pragma Inline (Analyze_Aspect_Specifications);
 
    procedure Adjust_Record_For_Reverse_Bit_Order (R : Entity_Id);
    --  Called from Freeze where R is a record entity for which reverse bit