[m-dev.] [reuse] diff: use new reuse_goal_info

Peter Ross petdr at miscrit.be
Tue Oct 10 04:58:02 AEDT 2000


Hi,


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


Estimated hours taken: 1

hlds_goal.m:
hlds_out.m:
sr_reuse_run.m:
    Use the new definition of reuse_goal_info.


Index: hlds_goal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_goal.m,v
retrieving revision 1.76.2.3
diff -u -r1.76.2.3 hlds_goal.m
--- hlds_goal.m	2000/10/09 09:10:07	1.76.2.3
+++ hlds_goal.m	2000/10/09 17:37:14
@@ -12,7 +12,8 @@
 
 :- interface.
 
-:- import_module hlds_data, hlds_pred, llds, prog_data, (inst), instmap.
+:- import_module hlds_data, hlds_pred, (inst), instmap.
+:- import_module llds, prog_data, sr_data.
 :- import_module bool, char, list, set, map, std_util.
 
 	% Here is how goals are represented
@@ -736,15 +737,11 @@
 		lbu :: set(prog_var), 		% the local backward use set
 		outscope :: set(prog_var), 	% outscope-vars,
 				% XXX, documentation to be followed
-		reuse :: short_reuse_info,  
-				% only of interest for the following goals:
-				% * deconstruction: a datacel has become
-				%   available for reuse
-				% * construction: a datacel can be reused
-				%   by this construction
-				% * call: a call to a procedure allowing
-				%   reuse is possible here. 
 
+		reuse :: reuse_goal_info,
+				% Any structure reuse information
+				% related to this call.
+
 		determinism :: determinism, 
 				% the overall determinism of the goal
 				% (computed during determinism analysis)
@@ -934,10 +931,10 @@
 :- pred goal_info_set_outscope(hlds_goal_info, set(prog_var), hlds_goal_info).
 :- mode goal_info_set_outscope(in,in,out) is det.
 
-:- pred goal_info_get_reuse(hlds_goal_info, short_reuse_info).
+:- pred goal_info_get_reuse(hlds_goal_info, reuse_goal_info).
 :- mode goal_info_get_reuse(in,out) is det.
 
-:- pred goal_info_set_reuse(hlds_goal_info, short_reuse_info, hlds_goal_info).
+:- pred goal_info_set_reuse(hlds_goal_info, reuse_goal_info, hlds_goal_info).
 :- mode goal_info_set_reuse(in,in, out) is det.
 
 :- pred goal_info_get_code_model(hlds_goal_info, code_model).
@@ -1219,13 +1216,14 @@
 	set__init(LFU),
 	set__init(LBU), 
 	set__init(OUTSCOPE),
-	REUSE = no_reuse, 
+	Reuse = empty,
 	instmap_delta_init_unreachable(InstMapDelta),
 	set__init(NonLocals),
 	term__context_init(Context),
 	set__init(Features),
 	GoalInfo = goal_info(PreBirths, PostBirths, PreDeaths, PostDeaths, 
-		LFU, LBU, OUTSCOPE, REUSE, Detism, InstMapDelta, Context, NonLocals, 
+		LFU, LBU, OUTSCOPE, Reuse,
+		Detism, InstMapDelta, Context, NonLocals, 
 		no, Features,
 		no_resume_point, []).
 
Index: hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.243.2.5
diff -u -r1.243.2.5 hlds_out.m
--- hlds_out.m	2000/10/09 09:10:12	1.243.2.5
+++ hlds_out.m	2000/10/09 17:37:19
@@ -244,7 +244,7 @@
 
 :- import_module int, string, set, assoc_list, map, multi_map.
 :- import_module require, getopt, std_util, term_io, varset.
-:- import_module pa_alias_as.
+:- import_module pa_alias_as, sr_data.
 
 hlds_out__write_type_id(Name - Arity) -->
 	prog_out__write_sym_name_and_arity(Name / Arity).
@@ -1121,25 +1121,25 @@
 
 		{ goal_info_get_reuse(GoalInfo, REUSE) } ,
 	        (
-			{ REUSE = no_reuse }
+			{ REUSE = reuse(no_reuse) }
 		->
 			[]
 		; 
 			hlds_out__write_indent(Indent),
 			io__write_string("% reuse: "),
 			(
-				{ REUSE = cell_died }
+				{ REUSE = reuse(cell_died) }
 			->
 				io__write_string("cell just died (deconstruction).\n")
 			;
-				{ REUSE = cell_reused(ProgVar) }
+				{ REUSE = reuse(cell_reused(ProgVar)) }
 			->
 				io__write_string("cell ("),
 				mercury_output_var(ProgVar, VarSet, 
 					AppendVarnums),
 				io__write_string(") just reused (construction).\n")
 			;
-				{ REUSE = reuse_call }
+				{ REUSE = reuse(reuse_call) }
 			->
 				io__write_string("call to procedure with reuse.\n")
 			;
Index: sr_reuse_run.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_reuse_run.m,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 sr_reuse_run.m
--- sr_reuse_run.m	2000/10/03 15:53:03	1.1.2.6
+++ sr_reuse_run.m	2000/10/09 17:37:44
@@ -60,6 +60,7 @@
 :- import_module sr_reuse.
 :- import_module sr_reuse_util.
 :- import_module sr_live.
+:- import_module sr_data.
 
 %-------------------------------------------------------------------%
 %-- predicates
@@ -321,7 +322,7 @@
 		(
 			Unification0 = construct(Var, ConsId, Vars,
 					Modes, _, IsUnique, Aditi),
-			GoalInfoReuse = cell_reused(ReuseVar)
+			GoalInfoReuse = reuse(cell_reused(ReuseVar))
 		->
 			CorrectVals = list__duplicate(list__length(Vars), no),
 			Cell = cell_to_reuse(ReuseVar, ConsId, CorrectVals),
@@ -492,7 +493,7 @@
 			sr_reuse__add_indirect_reuse( ProcInfo, HLDS, 
 				PredId, ProcId, TREUSE, LFUi, LBUi, 
 				Alias0, Reuses0, Reuses),
-			goal_info_set_reuse(Info0, reuse_call, Info)
+			goal_info_set_reuse(Info0, reuse(reuse_call), Info)
 		;
 			Reuses = Reuses0,
 			Info = Info0
@@ -520,7 +521,7 @@
 			Info = Info0,
 			Reuses = Reuses0
 		;
-			goal_info_set_reuse(Info0, cell_died, Info), 
+			goal_info_set_reuse(Info0, reuse(cell_died), Info), 
 			sr_reuse__add_direct_reuse( Var, CONS_ID, 
 					LFU, LBU,
 					Alias0, Reuses0, Reuses)
@@ -533,7 +534,8 @@
 					ReusesTMP )
 		->
 			Reuses = ReusesTMP, 
-			goal_info_set_reuse(Info0, cell_reused(ReuseVar), Info)
+			goal_info_set_reuse(Info0,
+					reuse(cell_reused(ReuseVar)), Info)
 		;
 			Reuses = Reuses0,
 			Info = Info0
@@ -755,7 +757,7 @@
 	{ module_info_structure_reuse_info(ModuleInfo, ReuseInfo) },
 	{ ReuseInfo = structure_reuse_info(ReuseMap) },
 	{
-		goal_info_get_reuse(GoalInfo, reuse_call),
+		goal_info_get_reuse(GoalInfo, reuse(reuse_call)),
 		map__search(ReuseMap, proc(PredId0, ProcId0), Result)
 	->
 		Result = proc(PredId, ProcId) - Name

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