[m-rev.] diff: revert redundant setting of static ground terms in code_info

Peter Wang novalazy at gmail.com
Mon Jan 21 14:58:00 AEDT 2008


Estimated hours taken: 0.5
Branches: main

compiler/code_info.m:
compiler/var_locn.m:
	Revert the change to record the setting of `--static-ground-terms' in
	the code_info_static subfield of code_info as it was already available
	in the exprn_opts subfield of the var_locn_info field.

Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.356
diff -u -r1.356 code_info.m
--- compiler/code_info.m	15 Jan 2008 05:45:45 -0000	1.356
+++ compiler/code_info.m	18 Jan 2008 00:54:54 -0000
@@ -42,7 +42,6 @@
 :- import_module ll_backend.layout.
 :- import_module ll_backend.llds.
 :- import_module ll_backend.trace_gen.
-:- import_module ll_backend.var_locn.
 :- import_module mdbcomp.prim_data.
 :- import_module mdbcomp.program_representation.
 :- import_module parse_tree.prog_data.
@@ -72,6 +71,7 @@
 :- import_module libs.trace_params.
 :- import_module libs.tree.
 :- import_module ll_backend.code_util.
+:- import_module ll_backend.var_locn.
 :- import_module parse_tree.prog_type.
 
 :- import_module int.
@@ -221,9 +221,6 @@
 
 :- pred get_auto_comments(code_info::in, bool::out) is det.
 
-:- pred get_static_ground_terms(code_info::in,
-    may_use_static_ground_terms::out) is det.
-
 :- pred get_lcmc_null(code_info::in, bool::out) is det.
 
 %---------------------------------------------------------------------------%
@@ -368,9 +365,6 @@
                 auto_comments       :: bool,
                                     % The setting of --auto-comments.
 
-                static_ground_terms :: may_use_static_ground_terms,
-                                    % The setting of --static-ground-terms.
-
                 lcmc_null           :: bool
                                     % The setting of --optimize-constructor-
                                     % last-call-null.
@@ -550,15 +544,6 @@
         EmitRegionOps = do_not_add_region_ops
     ),
     globals.lookup_bool_option(Globals, auto_comments, AutoComments),
-    globals.lookup_bool_option(Globals, static_ground_terms,
-        StaticGroundTerms),
-    (
-        StaticGroundTerms = yes,
-        MayUseStaticGroundTerms = may_use_static_ground_terms
-    ;
-        StaticGroundTerms = no,
-        MayUseStaticGroundTerms = may_not_use_static_ground_terms
-    ),
     globals.lookup_bool_option(Globals, optimize_constructor_last_call_null,
         LCMCNull),
     CodeInfo0 = code_info(
@@ -578,7 +563,6 @@
             EmitRegionOps,
             OptRegionOps,
             AutoComments,
-            MayUseStaticGroundTerms,
             LCMCNull
         ),
         code_info_loc_dep(
@@ -645,7 +629,6 @@
 get_emit_region_ops(CI, CI ^ code_info_static ^ emit_region_ops).
 get_opt_region_ops(CI, CI ^ code_info_static ^ opt_region_ops).
 get_auto_comments(CI, CI ^ code_info_static ^ auto_comments).
-get_static_ground_terms(CI, CI ^ code_info_static ^ static_ground_terms).
 get_lcmc_null(CI, CI ^ code_info_static ^ lcmc_null).
 get_forward_live_vars(CI, CI ^ code_info_loc_dep ^ forward_live_vars).
 get_instmap(CI, CI ^ code_info_loc_dep ^ instmap).
@@ -3720,11 +3703,9 @@
     get_var_locn_info(!.CI, VarLocnInfo0),
     get_static_cell_info(!.CI, StaticCellInfo0),
     get_module_info(!.CI, ModuleInfo),
-    get_static_ground_terms(!.CI, MayUseStaticGroundTerms),
     var_locn_assign_cell_to_var(ModuleInfo, Var, ReserveWordAtStart, Ptag,
         MaybeRvals, HowToConstruct, MaybeSize, FieldAddrs, TypeMsg,
-        MayUseStaticGroundTerms, MayUseAtomic, Code,
-        StaticCellInfo0, StaticCellInfo,
+        MayUseAtomic, Code, StaticCellInfo0, StaticCellInfo,
         VarLocnInfo0, VarLocnInfo),
     set_static_cell_info(StaticCellInfo, !CI),
     set_var_locn_info(VarLocnInfo, !CI).
Index: compiler/var_locn.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/var_locn.m,v
retrieving revision 1.54
diff -u -r1.54 var_locn.m
--- compiler/var_locn.m	21 Jan 2008 00:00:08 -0000	1.54
+++ compiler/var_locn.m	21 Jan 2008 03:49:06 -0000
@@ -40,10 +40,6 @@
 
 :- type var_locn_info.
 
-:- type may_use_static_ground_terms
-    --->    may_use_static_ground_terms
-    ;       may_not_use_static_ground_terms.
-
     % init_var_locn_state(Arguments, Liveness, VarSet, VarTypes, StackSlots,
     %   FollowVars, Opts, VarLocnInfo):
     %
@@ -171,8 +167,8 @@
     var_locn_info::in, var_locn_info::out) is det.
 
     % var_locn_assign_cell_to_var(ModuleInfo, Var, ReserveWordAtStart, Ptag,
-    %   MaybeRvals, MaybeSize, FieldAddrs, TypeMsg, MayUseStaticGroundTerms,
-    %   MayUseAtomic, Code, !StaticCellInfo, !VarLocnInfo):
+    %   MaybeRvals, MaybeSize, FieldAddrs, TypeMsg, MayUseAtomic, Code,
+    %   !StaticCellInfo, !VarLocnInfo):
     %
     % Generates code to assign to Var a pointer, tagged by Ptag, to the cell
     % whose contents are given by the other arguments, and updates the state
@@ -189,8 +185,8 @@
 :- pred var_locn_assign_cell_to_var(module_info::in, prog_var::in, bool::in,
     tag::in, list(maybe(rval))::in, how_to_construct::in,
     maybe(term_size_value)::in, list(int)::in, string::in,
-    may_use_static_ground_terms::in, may_use_atomic_alloc::in,
-    code_tree::out, static_cell_info::in, static_cell_info::out,
+    may_use_atomic_alloc::in, code_tree::out,
+    static_cell_info::in, static_cell_info::out,
     var_locn_info::in, var_locn_info::out) is det.
 
     % var_locn_place_var(ModuleInfo, Var, Lval, Code, !VarLocnInfo):
@@ -825,7 +821,7 @@
 
 var_locn_assign_cell_to_var(ModuleInfo, Var, ReserveWordAtStart, Ptag,
         MaybeRvals0, HowToConstruct, MaybeSize, FieldAddrs, TypeMsg,
-        MayUseStaticGroundTerms, MayUseAtomic, Code, !StaticCellInfo, !VLI) :-
+        MayUseAtomic, Code, !StaticCellInfo, !VLI) :-
     (
         MaybeSize = yes(SizeSource),
         (
@@ -844,10 +840,11 @@
     ),
     var_locn_get_var_state_map(!.VLI, VarStateMap),
     var_locn_get_exprn_opts(!.VLI, ExprnOpts),
+    StaticGroundTerms = ExprnOpts ^ static_ground_terms,
     % We can make the cell a constant only if all its fields are filled in,
     % and they are all constants.
     (
-        MayUseStaticGroundTerms = may_use_static_ground_terms,
+        StaticGroundTerms = yes,
         FieldAddrs = [],
         cell_is_constant(VarStateMap, ExprnOpts, MaybeRvals, RvalsTypes)
     ->

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list