Patchwork [Ada] Remove high level optimizer framework

login
register
mail settings
Submitter Arnaud Charlet
Date March 19, 2012, 4:42 p.m.
Message ID <20120319164209.GA24838@adacore.com>
Download mbox | patch
Permalink /patch/147582/
State New
Headers show

Comments

Arnaud Charlet - March 19, 2012, 4:42 p.m.
This framework was implemented years ago, but never documented,
and no optimizer was ever implemented, so best just to remove it
at this stage. If anyone ever wants to implement a high level
optimizer, the least of the effort will be putting this back.
Note that the critical point (which is that reanalysis works)
has not been checked for many many years, and is almost
certainly broken anyway.

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

2012-03-19  Robert Dewar  <dewar@adacore.com>

	* opt.ads: Remove HLO_Active flag.
	* sem.adb: Remove call of high level optimizer.
	* sem.ads (New_Nodes_OK): Removed.
	* sem_ch10.adb: Remove references to New_Nodes_OK.
	* switch-c.adb: Remove handling of -gnatH switch.

Patch

Index: switch-c.adb
===================================================================
--- switch-c.adb	(revision 185520)
+++ switch-c.adb	(working copy)
@@ -634,12 +634,6 @@ 
                Ptr := Ptr + 1;
                Usage_Requested := True;
 
-            --  Processing for H switch
-
-            when 'H' =>
-               Ptr := Ptr + 1;
-               HLO_Active := True;
-
             --  Processing for i switch
 
             when 'i' =>
Index: sem_ch10.adb
===================================================================
--- sem_ch10.adb	(revision 185520)
+++ sem_ch10.adb	(working copy)
@@ -2977,7 +2977,6 @@ 
    --  Start of processing for Expand_With_Clause
 
    begin
-      New_Nodes_OK := New_Nodes_OK + 1;
       Withn :=
         Make_With_Clause (Loc,
           Name => Build_Unit_Name (Nam));
@@ -3002,8 +3001,6 @@ 
       if Nkind (Nam) = N_Expanded_Name then
          Expand_With_Clause (Item, Prefix (Nam), N);
       end if;
-
-      New_Nodes_OK := New_Nodes_OK - 1;
    end Expand_With_Clause;
 
    -----------------------
@@ -3165,7 +3162,6 @@ 
          return;
       end if;
 
-      New_Nodes_OK := New_Nodes_OK + 1;
       Withn := Make_With_Clause (Loc, Name => Build_Unit_Name);
 
       Set_Library_Unit          (Withn, P);
@@ -3183,8 +3179,6 @@ 
       if Is_Child_Spec (P_Unit) then
          Implicit_With_On_Parent (P_Unit, N);
       end if;
-
-      New_Nodes_OK := New_Nodes_OK - 1;
    end Implicit_With_On_Parent;
 
    --------------
@@ -3734,8 +3728,6 @@ 
       --  Start of processing for Expand_Limited_With_Clause
 
       begin
-         New_Nodes_OK := New_Nodes_OK + 1;
-
          if Nkind (Nam) = N_Identifier then
 
             --  Create node for name of withed unit
@@ -3793,8 +3785,6 @@ 
                Install_Limited_Withed_Unit (Withn);
             end if;
          end if;
-
-         New_Nodes_OK := New_Nodes_OK - 1;
       end Expand_Limited_With_Clause;
 
       ----------------------
Index: sem.adb
===================================================================
--- sem.adb	(revision 185520)
+++ sem.adb	(working copy)
@@ -30,7 +30,6 @@ 
 with Errout;   use Errout;
 with Expander; use Expander;
 with Fname;    use Fname;
-with HLO;      use HLO;
 with Lib;      use Lib;
 with Lib.Load; use Lib.Load;
 with Nlists;   use Nlists;
@@ -1367,7 +1366,6 @@ 
       S_Global_Dis_Names : constant Boolean          := Global_Discard_Names;
       S_In_Spec_Expr     : constant Boolean          := In_Spec_Expression;
       S_Inside_A_Generic : constant Boolean          := Inside_A_Generic;
-      S_New_Nodes_OK     : constant Int              := New_Nodes_OK;
       S_Outer_Gen_Scope  : constant Entity_Id        := Outer_Generic_Scope;
 
       Generic_Main : constant Boolean :=
@@ -1386,8 +1384,7 @@ 
       --  and we need to restore these saved values at the end.
 
       procedure Do_Analyze;
-      --  Procedure to analyze the compilation unit. This is called more than
-      --  once when the high level optimizer is activated.
+      --  Procedure to analyze the compilation unit
 
       ----------------
       -- Do_Analyze --
@@ -1491,15 +1488,6 @@ 
 
       if not Analyzed (Comp_Unit) then
          Initialize_Version (Current_Sem_Unit);
-         if HLO_Active then
-            Expander_Mode_Save_And_Set (False);
-            New_Nodes_OK := 1;
-            Do_Analyze;
-            Reset_Analyzed_Flags (Comp_Unit);
-            Expander_Mode_Restore;
-            High_Level_Optimize (Comp_Unit);
-            New_Nodes_OK := 0;
-         end if;
 
          --  Do analysis, and then append the compilation unit onto the
          --  Comp_Unit_List, if appropriate. This is done after analysis,
@@ -1547,7 +1535,6 @@ 
       GNAT_Mode            := S_GNAT_Mode;
       In_Spec_Expression   := S_In_Spec_Expr;
       Inside_A_Generic     := S_Inside_A_Generic;
-      New_Nodes_OK         := S_New_Nodes_OK;
       Outer_Generic_Scope  := S_Outer_Gen_Scope;
 
       Restore_Opt_Config_Switches (Save_Config_Switches);
Index: sem.ads
===================================================================
--- sem.ads	(revision 185520)
+++ sem.ads	(working copy)
@@ -209,10 +209,6 @@ 
 
 package Sem is
 
-   New_Nodes_OK : Int := 1;
-   --  Temporary flag for use in checking out HLO. Set non-zero if it is
-   --  OK to generate new nodes.
-
    -----------------------------
    -- Semantic Analysis Flags --
    -----------------------------
Index: opt.ads
===================================================================
--- opt.ads	(revision 185520)
+++ opt.ads	(working copy)
@@ -666,10 +666,6 @@ 
    --  Heap size for memory allocations. Valid values are 32 and 64. Only
    --  available on VMS.
 
-   HLO_Active : Boolean := False;
-   --  GNAT
-   --  True if High Level Optimizer is activated (-gnatH switch)
-
    Identifier_Character_Set : Character;
    --  GNAT
    --  This variable indicates the character set to be used for identifiers.