[m-rev.] diff: don't write unnecessary ctgc pragmas

Peter Wang novalazy at gmail.com
Mon May 12 11:36:44 AEST 2008


Estimated hours taken: 0.5
Branches: main

compiler/structure_reuse.analysis.m:
compiler/structure_sharing.analysis.m:
	A recent change caused (useless) structure sharing and structure reuse
	pragmas to be written to `.trans_opt' files even when those analyses
	were not run.  Fix that.

Index: compiler/structure_reuse.analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_reuse.analysis.m,v
retrieving revision 1.12
diff -u -r1.12 structure_reuse.analysis.m
--- compiler/structure_reuse.analysis.m	7 May 2008 05:05:52 -0000	1.12
+++ compiler/structure_reuse.analysis.m	12 May 2008 01:21:03 -0000
@@ -65,7 +65,7 @@
     io::di, io::uo) is det.
 
     % Write all the reuse information concerning the specified predicate as
-    % reuse pragmas.  
+    % reuse pragmas.
     %
 :- pred write_pred_reuse_info(module_info::in, pred_id::in, 
     io::di, io::uo) is det.
@@ -521,22 +521,21 @@
         ShouldWrite = yes,
         map.lookup(ProcTable, ProcId, ProcInfo),
         proc_info_get_structure_reuse(ProcInfo, MaybeStructureReuseDomain),
-        proc_info_declared_argmodes(ProcInfo, Modes),
-        proc_info_get_varset(ProcInfo, VarSet),
-        proc_info_get_headvars(ProcInfo, HeadVars),
-        proc_info_get_vartypes(ProcInfo, VarTypes),
-        list.map(map.lookup(VarTypes), HeadVars, HeadVarTypes),
         (
             MaybeStructureReuseDomain = yes(
                 structure_reuse_domain_and_status(Reuse, _Status)),
-            MaybeReuse = yes(Reuse)
+            proc_info_declared_argmodes(ProcInfo, Modes),
+            proc_info_get_varset(ProcInfo, VarSet),
+            proc_info_get_headvars(ProcInfo, HeadVars),
+            proc_info_get_vartypes(ProcInfo, VarTypes),
+            list.map(map.lookup(VarTypes), HeadVars, HeadVarTypes),
+                MaybeReuse = yes(Reuse),
+            write_pragma_structure_reuse_info(PredOrFunc, SymName, Modes,
+                Context, HeadVars, yes(VarSet), HeadVarTypes, yes(TypeVarSet),
+                MaybeReuse, !IO)
         ;
-            MaybeStructureReuseDomain = no,
-            MaybeReuse = no
-        ),
-        write_pragma_structure_reuse_info(PredOrFunc, SymName, Modes,
-            Context, HeadVars, yes(VarSet), HeadVarTypes, yes(TypeVarSet),
-            MaybeReuse, !IO)
+            MaybeStructureReuseDomain = no
+        )
     ;
         ShouldWrite = no
     ).
Index: compiler/structure_sharing.analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_sharing.analysis.m,v
retrieving revision 1.33
diff -u -r1.33 structure_sharing.analysis.m
--- compiler/structure_sharing.analysis.m	9 May 2008 05:45:11 -0000	1.33
+++ compiler/structure_sharing.analysis.m	12 May 2008 01:24:23 -0000
@@ -931,14 +931,12 @@
         (
             MaybeSharingStatus = yes(
                 structure_sharing_domain_and_status(Sharing, _Status)),
-            MaybeSharing = yes(Sharing)
+            write_pragma_structure_sharing_info(PredOrFunc, SymName, Modes,
+                Context, HeadVars, yes(VarSet), HeadVarTypes, yes(TypeVarSet),
+                yes(Sharing), !IO)
         ;
-            MaybeSharingStatus = no,
-            MaybeSharing = no
-        ),
-        write_pragma_structure_sharing_info(PredOrFunc, SymName, Modes,
-            Context, HeadVars, yes(VarSet), HeadVarTypes, yes(TypeVarSet),
-            MaybeSharing, !IO)
+            MaybeSharingStatus = no
+        )
     ;
         ShouldWrite = no
     ).


--------------------------------------------------------------------------
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