public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Reduce compilation time at -O0 (3/n)
@ 2011-08-02 10:31 Arnaud Charlet
  0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2011-08-02 10:31 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

[-- Attachment #1: Type: text/plain, Size: 549 bytes --]

This patch significantly reduces compilation time at -O0 in typical conditions
by short-circuiting calls to the somewhat costly Is_RTE function when they are
not necessary.

No functional changes.

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

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

	* exp_ch6.adb (Expand_Call): Guard restriction checks with a call
	to Restriction_Check_Required.
	* sem_ch3.adb (Analyze_Object_Declaration): Likewise.
	* sem_res.adb (Resolve_Call): Likewise.
	* sem_attr.adb (Check_Stream_Attribute): Likewise.


[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 3319 bytes --]

Index: sem_ch3.adb
===================================================================
--- sem_ch3.adb	(revision 177124)
+++ sem_ch3.adb	(working copy)
@@ -3671,8 +3671,9 @@
 
       --  Check for violation of No_Local_Timing_Events
 
-      if Is_RTE (Etype (Id), RE_Timing_Event)
+      if Restriction_Check_Required (No_Local_Timing_Events)
         and then not Is_Library_Level_Entity (Id)
+        and then Is_RTE (Etype (Id), RE_Timing_Event)
       then
          Check_Restriction (No_Local_Timing_Events, N);
       end if;
Index: sem_res.adb
===================================================================
--- sem_res.adb	(revision 177127)
+++ sem_res.adb	(working copy)
@@ -5702,9 +5702,10 @@
       --  Check for violation of restriction No_Specific_Termination_Handlers
       --  and warn on a potentially blocking call to Abort_Task.
 
-      if Is_RTE (Nam, RE_Set_Specific_Handler)
-           or else
-         Is_RTE (Nam, RE_Specific_Handler)
+      if Restriction_Check_Required (No_Specific_Termination_Handlers)
+        and then (Is_RTE (Nam, RE_Set_Specific_Handler)
+                    or else
+                  Is_RTE (Nam, RE_Specific_Handler))
       then
          Check_Restriction (No_Specific_Termination_Handlers, N);
 
@@ -5717,7 +5718,8 @@
       --  need to check the second argument to determine whether it is an
       --  absolute or relative timing event.
 
-      if Is_RTE (Nam, RE_Set_Handler)
+      if Restriction_Check_Required (No_Relative_Delay)
+        and then Is_RTE (Nam, RE_Set_Handler)
         and then Is_RTE (Etype (Next_Actual (First_Actual (N))), RE_Time_Span)
       then
          Check_Restriction (No_Relative_Delay, N);
Index: sem_attr.adb
===================================================================
--- sem_attr.adb	(revision 177118)
+++ sem_attr.adb	(working copy)
@@ -1646,9 +1646,10 @@
          --  Check special case of Exception_Id and Exception_Occurrence which
          --  are not allowed for restriction No_Exception_Registration.
 
-         if Is_RTE (P_Type, RE_Exception_Id)
-              or else
-            Is_RTE (P_Type, RE_Exception_Occurrence)
+         if Restriction_Check_Required (No_Exception_Registration)
+           and then (Is_RTE (P_Type, RE_Exception_Id)
+                       or else
+                     Is_RTE (P_Type, RE_Exception_Occurrence))
          then
             Check_Restriction (No_Exception_Registration, P);
          end if;
Index: exp_ch6.adb
===================================================================
--- exp_ch6.adb	(revision 177121)
+++ exp_ch6.adb	(working copy)
@@ -2936,12 +2936,15 @@
 
       --  Check for violation of No_Abort_Statements
 
-      if Is_RTE (Subp, RE_Abort_Task) then
+      if Restriction_Check_Required (No_Abort_Statements)
+        and then Is_RTE (Subp, RE_Abort_Task)
+      then
          Check_Restriction (No_Abort_Statements, Call_Node);
 
       --  Check for violation of No_Dynamic_Attachment
 
-      elsif RTU_Loaded (Ada_Interrupts)
+      elsif Restriction_Check_Required (No_Dynamic_Attachment)
+        and then RTU_Loaded (Ada_Interrupts)
         and then (Is_RTE (Subp, RE_Is_Reserved)      or else
                   Is_RTE (Subp, RE_Is_Attached)      or else
                   Is_RTE (Subp, RE_Current_Handler)  or else

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-02 10:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-02 10:31 [Ada] Reduce compilation time at -O0 (3/n) 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).