[m-dev.] [reuse] diff: lfu and lbu passes

Peter Ross petdr at miscrit.be
Thu Oct 5 00:33:48 AEDT 2000


Hi,


===================================================================


Estimated hours taken: 1

Place the LFU and LBU marking phases into the new structure reuse
analysis.

sr_direct.m:
    Call the LFU and LBU phases.

sr_lbu.m:
sr_lfu.m:
    Add top level calls which do the analysis on one procedure.


Index: sr_direct.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_direct.m,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 sr_direct.m
--- sr_direct.m	2000/10/04 13:00:06	1.1.2.1
+++ sr_direct.m	2000/10/04 13:30:46
@@ -30,8 +30,10 @@
 
 process_proc(_PredId, _ProcId, ProcInfo0, ProcInfo, ModuleInfo0, ModuleInfo) -->
 	% Determine the LFU (local forward use)
+	{ sr_lfu__process_proc(ProcInfo0, ProcInfo1) },
 
 	% Determine the LBU (local backward use)
+	{ sr_lbu__process_proc(ModuleInfo0, ProcInfo1, ProcInfo2) },
 
 	% Determine which cells die and can be reused and what the
 	% conditions on that reuse are
@@ -39,7 +41,7 @@
 	% Select which cells will be reused and which can be compile
 	% time garbage collected.
 
-	{ ProcInfo = ProcInfo0 },
+	{ ProcInfo = ProcInfo2 },
 	{ ModuleInfo = ModuleInfo0 }.
 	
 %-----------------------------------------------------------------------------%
Index: sr_lbu.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_lbu.m,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 sr_lbu.m
--- sr_lbu.m	2000/09/19 10:02:11	1.1.2.1
+++ sr_lbu.m	2000/10/04 13:30:47
@@ -36,11 +36,14 @@
 %-------------------------------------------------------------------%
 
 :- import_module io.
-:- import_module hlds_module. 
+:- import_module hlds_module, hlds_pred. 
 
 :- pred sr_lbu__lbu_pass( module_info, module_info, io__state, io__state).
 :- mode sr_lbu__lbu_pass( in, out, di, uo) is det.
 
+:- pred sr_lbu__process_proc(module_info::in,
+		proc_info::in, proc_info::out) is det.
+
 %-------------------------------------------------------------------%
 %-------------------------------------------------------------------%
 
@@ -53,7 +56,6 @@
 
 % mercury-compiler modules
 :- import_module globals, options.
-:- import_module hlds_pred. 
 :- import_module passes_aux.
 :- import_module hlds_goal.
 :- import_module prog_data.
@@ -116,6 +118,13 @@
 		PredInfo) :- 
 	pred_info_procedures( PredInfo0, Procedures0 )  , 
 	map__lookup(Procedures0, PROC_ID, ProcInfo0 )  , 
+
+	sr_lbu__process_proc(HLDS, ProcInfo0, ProcInfo),
+
+	map__det_update(Procedures0, PROC_ID, ProcInfo, Procedures) ,
+	pred_info_set_procedures( PredInfo0, Procedures, PredInfo) .
+
+sr_lbu__process_proc(HLDS, ProcInfo0, ProcInfo) :-
 	proc_info_goal(ProcInfo0, Goal0),
 
 	% extra info to be caried around for each program point: 
@@ -129,9 +138,7 @@
 	annotate_lbu_in_goal( HLDS, ProcInfo0, 
 				Lbu0, _Lbu, Goal0, Goal), 
 
-	proc_info_set_goal(ProcInfo0, Goal, ProcInfo) ,
-	map__det_update(Procedures0, PROC_ID, ProcInfo, Procedures) ,
-	pred_info_set_procedures( PredInfo0, Procedures, PredInfo) .
+	proc_info_set_goal(ProcInfo0, Goal, ProcInfo).
 
 :- pred annotate_lbu_in_goal(module_info, proc_info, 
 			set(prog_var), set(prog_var), 
Index: sr_lfu.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_lfu.m,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 sr_lfu.m
--- sr_lfu.m	2000/09/19 10:02:12	1.1.2.1
+++ sr_lfu.m	2000/10/04 13:30:47
@@ -15,11 +15,13 @@
 %-------------------------------------------------------------------%
 
 :- import_module io.
-:- import_module hlds_module. 
+:- import_module hlds_module, hlds_pred. 
 
 :- pred sr_lfu__lfu_pass( module_info, module_info, io__state, io__state).
 :- mode sr_lfu__lfu_pass( in, out, di, uo) is det.
 
+:- pred sr_lfu__process_proc(proc_info::in, proc_info::out) is det.
+
 %-------------------------------------------------------------------%
 %-------------------------------------------------------------------%
 
@@ -32,7 +34,6 @@
 
 % mercury-compiler modules
 :- import_module globals, options.
-:- import_module hlds_pred. 
 :- import_module passes_aux.
 :- import_module hlds_goal.
 :- import_module prog_data.
@@ -97,6 +98,13 @@
 					ProcInfo01) , 
 	**/
 	ProcInfo01 = ProcInfo0,
+
+	sr_lfu__process_proc(ProcInfo01, ProcInfo),
+
+	map__det_update(Procedures0, PROC_ID, ProcInfo, Procedures) ,
+	pred_info_set_procedures( PredInfo0, Procedures, PredInfo).
+
+process_proc(ProcInfo01, ProcInfo) :-
 	proc_info_goal(ProcInfo01, Goal0),
 
 		% the set of variables initially instantiated 
@@ -127,9 +135,8 @@
 	% by the lbu-pass). 
 
 	proc_info_set_global_use(ProcInfo01, GlobalUse, ProcInfo02),
-	proc_info_set_goal(ProcInfo02, Goal, ProcInfo) ,
-	map__det_update(Procedures0, PROC_ID, ProcInfo, Procedures) ,
-	pred_info_set_procedures( PredInfo0, Procedures, PredInfo).
+	proc_info_set_goal(ProcInfo02, Goal, ProcInfo).
+
 
 	% annotate_lfu_in_goal(InstantiatedVars0, DiedVars0, 
 	%		       InstantiatedVars, DiedVars, Goalin, Goalout).

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list