[m-dev.] [reuse] diff: reuse across module boundries

Peter Ross Peter.Ross at cs.kuleuven.ac.be
Sat Sep 23 01:51:49 AEDT 2000


Hi,

This diff should get structure reuse working across module boundries.

Pete

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


Estimated hours taken: 20

Get structure reuse working across module boundries.

prog_data.m:
    If a predicate has reuse record the reuse name of the predicate in
    the sr_reuse_info pragma.

sr_reuse_run.m:
    Add the predicate create_reuse_pred which will, if necessary,
    update a procedure with reuse information if the reuse is
    unconditional or create a new procedure if the reuse is conditional.
    Fix a bug where we were setting the import status of the reuse
    predicate to be local instead of whatever it was originally.

make_hlds.m:
    Use create_reuse_pred to record any reuse information.
    Handle the extra field to sr_reuse_info pragma.

trans_opt.m:
    Don't write out the pa_alias and sr_reuse_info pragmas for the reuse
    versions of procedures.

dead_proc_elim.m:
    Don't elminate any reuse predicates.

hlds_pred.m:
    Fix a bug in pred_info_create, the arity is the length of the type
    list *not* including type infos.

mercury_to_mercury.m:
module_qual.m:
modules.m:
    Handle the extra field to sr_reuse_info pragma.

prog_io_pragma.m:
    Parse the modified sr_reuse_info pragma.

sr_reuse.m:
    Parse/write the modified sr_reuse_info pragma.

sr_run.m:
    Write the modified sr_reuse_info pragma.

Index: dead_proc_elim.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dead_proc_elim.m,v
retrieving revision 1.59
diff -u -r1.59 dead_proc_elim.m
--- dead_proc_elim.m	2000/08/09 07:46:22	1.59
+++ dead_proc_elim.m	2000/09/22 14:23:24
@@ -816,6 +816,9 @@
 		;
 			% Don't eliminate the clauses for assertions.
 			pred_info_get_goal_type(PredInfo, assertion)
+		;
+			% Don't eliminate any reuse predicates
+			string__prefix(PredName, "reuse__")
 		)
 	->
 		set__insert(NeededNames0, qualified(PredModule, PredName), 
Index: hlds_pred.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.81.2.2
diff -u -r1.81.2.2 hlds_pred.m
--- hlds_pred.m	2000/09/20 09:24:34	1.81.2.2
+++ hlds_pred.m	2000/09/22 14:23:26
@@ -880,7 +880,8 @@
 	proc_info_declared_determinism(ProcInfo, MaybeDetism),
 	next_mode_id(Procs0, MaybeDetism, ProcId),
 	map__det_insert(Procs0, ProcId, ProcInfo, Procs),
-	list__length(Types, Arity),
+	list__length(list__filter(isnt(is_introduced_type_info_type), Types),
+			Arity),
 	proc_info_varset(ProcInfo, VarSet),
 	proc_info_vartypes(ProcInfo, VarTypes),
 	proc_info_headvars(ProcInfo, HeadVars),
Index: make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.347.2.2
diff -u -r1.347.2.2 make_hlds.m
--- make_hlds.m	2000/09/20 09:24:38	1.347.2.2
+++ make_hlds.m	2000/09/22 14:23:29
@@ -76,7 +76,7 @@
 :- import_module fact_table, purity, goal_util, term_util, export, llds.
 :- import_module error_util.
 :- import_module pa_run, pa_alias_as.
-:- import_module sr_reuse.
+:- import_module sr_reuse, sr_reuse_run.
 
 :- import_module string, char, int, set, bintree, map, multi_map, require.
 :- import_module bag, term, varset, getopt, assoc_list, term_io.
@@ -514,9 +514,10 @@
 		
 	;
 		{ Pragma = sr_reuse_info(PredOrFunc, SymName, ModeList,
-			HeadVars, TREUSE) },
+			HeadVars, TREUSE, MaybeReuseSymName) },
 		add_pragma_reuse_info( PredOrFunc, SymName, ModeList, 
-					HeadVars, TREUSE, Module0, Module)
+					HeadVars, TREUSE, MaybeReuseSymName,
+					Module0, Module)
 	;
 		{ Pragma = terminates(Name, Arity) },
 		add_pred_marker(Module0, "terminates", Name, Arity,
@@ -1458,14 +1459,14 @@
 %-----------------------------------------------------------------------------%
 
 :- pred add_pragma_reuse_info( pred_or_func, sym_name, list(mode),
-		list(var(T)), sr_reuse__tabled_reuse,
+		list(var(T)), sr_reuse__tabled_reuse, maybe(sym_name),
 		module_info, module_info, 
 		io__state, io__state).
-:- mode add_pragma_reuse_info( in, in, in, in, in, in, out, di, uo) 
+:- mode add_pragma_reuse_info( in, in, in, in, in, in, in, out, di, uo) 
 		is det.
 
-add_pragma_reuse_info(PredOrFunc,SymName, Modes, 
-				HeadVars, TREUSE, Module0, Module) --> 
+add_pragma_reuse_info(PredOrFunc,SymName, Modes, HeadVars, TREUSE,
+		_MaybeReuseName, Module0, Module) --> 
 	{ module_info_get_predicate_table(Module0, Preds) },
 	{ list__length(Modes, Arity) },
 	(
@@ -1491,15 +1492,8 @@
 				ProcHeadVars, MapHeadVars) },
 			{ sr_reuse__tabled_reuse_rename( MapHeadVars, TREUSE, 
 						RenTREUSE) },
-			{ proc_info_set_reuse_information( ProcInfo0, 
-				RenTREUSE, ProcInfo ) },
-			{ map__det_update(ProcTable0, ProcId, ProcInfo,
-					ProcTable) },
-			{ pred_info_set_procedures(PredInfo0, ProcTable,
-					PredInfo) },
-			{ map__det_update(PredTable0, PredId, PredInfo,
-					PredTable) },
-			{ module_info_set_preds( Module0, PredTable, Module) }
+			{ create_reuse_pred(proc(PredId, ProcId), RenTREUSE,
+					no, Module0, Module) }
 		;
 
 			% 	{ module_info_incr_errors(Module0, Module) },
Index: mercury_to_mercury.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.174.2.1
diff -u -r1.174.2.1 mercury_to_mercury.m
--- mercury_to_mercury.m	2000/09/19 10:01:52	1.174.2.1
+++ mercury_to_mercury.m	2000/09/22 14:23:32
@@ -439,7 +439,7 @@
 		{ Pragma = pa_alias_info(_,_,_,_,_) },
 		[]
 	;
-		{ Pragma = sr_reuse_info(_,_,_,_,_) },
+		{ Pragma = sr_reuse_info(_,_,_,_,_, _) },
 		[]
 	;
 		{ Pragma = terminates(Pred, Arity) },
Index: module_qual.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/module_qual.m,v
retrieving revision 1.57.2.1
diff -u -r1.57.2.1 module_qual.m
--- module_qual.m	2000/09/19 10:01:56	1.57.2.1
+++ module_qual.m	2000/09/22 14:23:33
@@ -951,8 +951,8 @@
 		pa_alias_info(PredOrFunc, SymName, ModeList, Vars, MaybeAS),
 		Info0, Info) -->
 	qualify_mode_list(ModeList0, ModeList, Info0, Info).
-qualify_pragma(sr_reuse_info(PredOrFunc, SymName, ModeList0, Vars, TREUSE), 
-		sr_reuse_info(PredOrFunc, SymName, ModeList, Vars, TREUSE), 
+qualify_pragma(sr_reuse_info(PredOrFunc, SymName, ModeList0, Vars, TREUSE, N), 
+		sr_reuse_info(PredOrFunc, SymName, ModeList, Vars, TREUSE, N), 
 		Info0, Info) -->
 	qualify_mode_list(ModeList0, ModeList, Info0, Info).
 qualify_pragma(terminates(A, B), terminates(A, B), Info, Info) --> [].
Index: modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.132.2.1
diff -u -r1.132.2.1 modules.m
--- modules.m	2000/09/19 10:01:58	1.132.2.1
+++ modules.m	2000/09/22 14:23:38
@@ -1003,7 +1003,7 @@
 pragma_allowed_in_interface(type_spec(_, _, _, _, _, _, _), yes).
 pragma_allowed_in_interface(termination_info(_, _, _, _, _), yes).
 pragma_allowed_in_interface(pa_alias_info(_, _, _, _, _), yes).
-pragma_allowed_in_interface(sr_reuse_info(_, _, _, _, _), yes).
+pragma_allowed_in_interface(sr_reuse_info(_, _, _, _, _, _), yes).
 pragma_allowed_in_interface(terminates(_, _), yes).
 pragma_allowed_in_interface(does_not_terminate(_, _), yes).
 pragma_allowed_in_interface(check_termination(_, _), yes).
Index: prog_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.58.2.1
diff -u -r1.58.2.1 prog_data.m
--- prog_data.m	2000/09/19 10:02:08	1.58.2.1
+++ prog_data.m	2000/09/22 14:23:39
@@ -270,7 +270,7 @@
 			% These pragma's are used in opt.pa files
 
 	; 	sr_reuse_info(pred_or_func, sym_name, list(mode), 
-				list(prog_var), tabled_reuse)
+				list(prog_var), tabled_reuse, maybe(sym_name))
 
 	;	terminates(sym_name, arity)
 			% Predname, Arity
Index: prog_io_pragma.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_pragma.m,v
retrieving revision 1.23.2.1
diff -u -r1.23.2.1 prog_io_pragma.m
--- prog_io_pragma.m	2000/09/19 10:02:10	1.23.2.1
+++ prog_io_pragma.m	2000/09/22 14:23:40
@@ -804,10 +804,12 @@
 	term__vars_list(ListHVTerm, HeadVarsGeneric),
 	list__map(term__coerce_var, HeadVarsGeneric, HeadVars),
 
-	sr_reuse__tabled_reuse_parse(ReuseInformation, ParsedReuse),
+	sr_reuse__tabled_reuse_parse(ReuseInformation, ParsedReuse,
+			MaybeReuseName),
 
 	Result0 = ok(pragma(sr_reuse_info(PredOrFunc, PredName, ModeList,
-					HeadVars, ParsedReuse)))
+					HeadVars, ParsedReuse,
+					MaybeReuseName)))
    ->
    	Result = Result0
    ;
Index: sr_reuse.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_reuse.m,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 sr_reuse.m
--- sr_reuse.m	2000/09/20 17:25:25	1.1.2.2
+++ sr_reuse.m	2000/09/22 14:23:40
@@ -18,7 +18,7 @@
 %-- import_module 
 
 % library modules
-:- import_module io, set, list, term, map.
+:- import_module io, set, list, term, map, std_util.
 
 % compiler modules
 :- import_module sr_live.
@@ -135,11 +135,12 @@
 
 	% used to print the reuse information to the interface
 	% files. 
-:- pred tabled_reuse_print( tabled_reuse, proc_info, io__state, io__state).
-:- mode tabled_reuse_print( in, in, di, uo) is det.
+:- pred tabled_reuse_print( tabled_reuse, sym_name, proc_info,
+		io__state, io__state).
+:- mode tabled_reuse_print( in, in, in, di, uo) is det.
 
-:- pred tabled_reuse_parse( term(T), tabled_reuse).
-:- mode tabled_reuse_parse( in, out ) is semidet.
+:- pred tabled_reuse_parse( term(T), tabled_reuse, maybe(sym_name)).
+:- mode tabled_reuse_parse( in, out, out ) is semidet.
 
 	% tabled_reuse_verify_conditions( ProcInfo, HLDS, 
 	%				TREUSE, Live0, Alias0)
@@ -188,6 +189,7 @@
 :- import_module string, varset.
 
 % compiler modules
+:- import_module prog_out, prog_io, prog_io_util.
 :- import_module pa_datastruct.
 :- import_module mercury_to_mercury.
 
@@ -417,33 +419,41 @@
 		C2, 
 		[]).
 
-tabled_reuse_parse( ReuseInformation, ParsedReuse ) :- 
+tabled_reuse_parse( ReuseInformation, ParsedReuse, MaybeReuseName ) :- 
 	(
 		ReuseInformation = term__functor( term__atom("no"), _, _),
+		MaybeReuseName = no,
 		sr_reuse__tabled_reuse_init(ParsedReuse)
 	;
 		ReuseInformation = term__functor( term__atom("yes"),
 					ReadConditions, _),
-		conditions_list_parse( ReadConditions, Conditions),
+		conditions_list_parse( ReadConditions, Conditions, ReuseName),
+		MaybeReuseName = yes(ReuseName),
 		ParsedReuse = yes(Conditions)
 	).
 
-:- pred conditions_list_parse( list(term(T)), list(reuse_condition)).
-:- mode conditions_list_parse( in, out ) is det.
+:- pred conditions_list_parse( list(term(T)),
+		list(reuse_condition), sym_name).
+:- mode conditions_list_parse( in, out, out ) is det.
 
-conditions_list_parse( LISTTERM, CONDS ) :- 
+conditions_list_parse( LISTTERM, CONDS, ReuseName ) :- 
 	(
-		% LISTTERM ought to have only one element (term corresponding
-		% to a list)
-		LISTTERM = [ OneITEM ]
+		LISTTERM = [ OneITEM , NameTerm ]
 	->
-		condition_rest_parse(OneITEM, CONDS)
+		condition_rest_parse(OneITEM, CONDS),
+		parse_qualified_term(NameTerm, NameTerm, "pragma reuse",
+				Result),
+		( Result = ok(ReuseName0, []) ->
+			ReuseName = ReuseName0
+		;
+			error("conditions_list_parse")
+		)
 	;
 		list__length( LISTTERM, L ), 
 		string__int_to_string(L, LS), 
 		string__append_list( ["(sr_reuse) conditions_list_parse: ",
 				"wrong number of arguments. yes/", LS,
-				" should be yes/1"], Msg),
+				" should be yes/2"], Msg),
 		error(Msg)
 	).
 
@@ -586,13 +596,15 @@
 tabled_reuse_init(no).		
 tabled_reuse_top(no).		
 
-tabled_reuse_print( TREUSE, ProcInfo ) --> 
+tabled_reuse_print( TREUSE, Name, ProcInfo ) --> 
 	( 	
 		{ TREUSE = yes(CONDS) }
 	->
 		io__write_string("yes(["),
 		io__write_list(CONDS, ",", reuse_condition_print(ProcInfo)),
-		io__write_string("])")
+		io__write_string("], "),
+		prog_out__write_sym_name(Name),
+		io__write_string(")")
 	;
 		io__write_string("no")
 	).
Index: sr_reuse_run.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_reuse_run.m,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 sr_reuse_run.m
--- sr_reuse_run.m	2000/09/20 17:25:26	1.1.2.3
+++ sr_reuse_run.m	2000/09/22 14:23:41
@@ -19,10 +19,11 @@
 %-- import_module
 
 % library modules
-:- import_module io.
+:- import_module io, std_util.
 
 % compiler modules
-:- import_module hlds_module.
+:- import_module hlds_goal, hlds_pred, hlds_module.
+:- import_module sr_reuse.
 
 %-------------------------------------------------------------------%
 %-- exported predicates
@@ -32,6 +33,10 @@
 					io__state, io__state).
 :- mode sr_reuse_run__reuse_pass( in, out, di, uo) is det.
 
+:- pred create_reuse_pred(pred_proc_id::in, tabled_reuse::in,
+		maybe(hlds_goal)::in,
+		module_info::in, module_info::out) is det.
+
 %-------------------------------------------------------------------%
 %-------------------------------------------------------------------%
 :- implementation.
@@ -587,12 +592,18 @@
 :- mode update_reuse_in_module_info(in, in, in, out) is det.
 
 update_reuse_in_module_info( FP, PRED_PROC_ID ,HLDSin, HLDSout) :- 
-	module_info_pred_proc_info(HLDSin, PRED_PROC_ID, PredInfo0, 
-					ProcInfo0),
 	sr_reuse_util__sr_fixpoint_table_get_final_reuse(PRED_PROC_ID,
 			TREUSE, HLDS_GOAL, FP),
+	create_reuse_pred(PRED_PROC_ID, TREUSE, yes(HLDS_GOAL),
+			HLDSin, HLDSout).
+
+%-----------------------------------------------------------------------------%
+
+create_reuse_pred(PRED_PROC_ID, TREUSE, MaybeHLDS_GOAL, HLDSin, HLDSout) :-
+	module_info_pred_proc_info(HLDSin, PRED_PROC_ID, PredInfo0, 
+					ProcInfo0),
 	( contains_conditional_reuse(TREUSE) ->
-		create_reuse_pred(TREUSE, HLDS_GOAL, PredInfo0, ProcInfo0,
+		create_reuse_pred(TREUSE, MaybeHLDS_GOAL, PredInfo0, ProcInfo0,
 				ReusePredInfo, _ReuseProcInfo,
 				ReuseProcId, ReuseName),
 
@@ -610,30 +621,41 @@
 		module_info_set_predicate_table(HLDSin1, PredTable, HLDSout)
 	; contains_unconditional_reuse(TREUSE) ->
 		proc_info_set_reuse_information(ProcInfo0, TREUSE, ProcInfo1),
-		proc_info_set_goal(ProcInfo1, HLDS_GOAL, ProcInfo),
+		(
+			MaybeHLDS_GOAL = yes(HLDS_GOAL),
+			proc_info_set_goal(ProcInfo1, HLDS_GOAL, ProcInfo)
+		;
+			MaybeHLDS_GOAL = no,
+			ProcInfo = ProcInfo1
+		),
 		module_info_set_pred_proc_info(HLDSin, PRED_PROC_ID, 
 				PredInfo0, ProcInfo, HLDSout)
 	;
 		HLDSout = HLDSin
 	).
 
-%-----------------------------------------------------------------------------%
 
-:- pred create_reuse_pred(tabled_reuse::in, hlds_goal::in,
+:- pred create_reuse_pred(tabled_reuse::in, maybe(hlds_goal)::in,
 		pred_info::in, proc_info::in,
 		pred_info::out, proc_info::out,
 		proc_id::out, sym_name::out) is det.
 
-create_reuse_pred(TabledReuse, ReuseGoal, PredInfo, ProcInfo,
+create_reuse_pred(TabledReuse, MaybeReuseGoal, PredInfo, ProcInfo,
 		ReusePredInfo, ReuseProcInfo, ReuseProcId, SymName) :-
 	proc_info_set_reuse_information(ProcInfo, TabledReuse, ReuseProcInfo0),
-	proc_info_set_goal(ReuseProcInfo0, ReuseGoal, ReuseProcInfo),
-
+	(
+		MaybeReuseGoal = yes(ReuseGoal),
+		proc_info_set_goal(ReuseProcInfo0, ReuseGoal, ReuseProcInfo)
+	;
+		MaybeReuseGoal = no,
+		ReuseProcInfo = ReuseProcInfo0
+	),
 	pred_info_module(PredInfo, ModuleName),
 	pred_info_name(PredInfo, Name),
 	pred_info_arg_types(PredInfo, TypeVarSet, ExistQVars, Types),
 	Cond = true,
 	pred_info_context(PredInfo, PredContext),
+	pred_info_import_status(PredInfo, Status),
 	pred_info_get_markers(PredInfo, Markers),
 	pred_info_get_is_pred_or_func(PredInfo, PredOrFunc),
 	pred_info_get_class_context(PredInfo, ClassContext),
@@ -641,15 +663,14 @@
 
 	set__init(Assertions),
 
-	proc_info_context(ProcInfo, Context),
-	term__context_line(Context, Line),
+	Line = 0,
 	Counter = 0,
 
-	make_pred_name_with_context(ModuleName, "Reuse", PredOrFunc, Name,
+	make_pred_name_with_context(ModuleName, "reuse", PredOrFunc, Name,
 		Line, Counter, SymName),
 
 	pred_info_create(ModuleName, SymName, TypeVarSet, ExistQVars, Types,
-			Cond, PredContext, local, Markers, PredOrFunc,
+			Cond, PredContext, Status, Markers, PredOrFunc,
 			ClassContext, Owner, Assertions, ReuseProcInfo, 
 			ReuseProcId, ReusePredInfo).
 
Index: sr_run.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_run.m,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 sr_run.m
--- sr_run.m	2000/09/20 09:24:45	1.1.2.2
+++ sr_run.m	2000/09/22 14:23:41
@@ -66,10 +66,8 @@
 			[]
 		;
 			{ pred_info_procids(PredInfo, ProcIds) },
-			{ pred_info_procedures( PredInfo, ProcTable ) },
 			list__foldl( 
-				write_pred_proc_sr_reuse_info( PredInfo, 
-								ProcTable),
+				write_pred_proc_sr_reuse_info(HLDS, PredId),
 					ProcIds )
 		)
 	;
@@ -83,11 +81,14 @@
 :- import_module sr_reuse.
 :- import_module mercury_to_mercury, prog_data.
 
-:- pred write_pred_proc_sr_reuse_info( pred_info, proc_table, proc_id,
-				io__state, io__state).
+:- pred write_pred_proc_sr_reuse_info( module_info, pred_id,
+                                proc_id, io__state, io__state).
 :- mode write_pred_proc_sr_reuse_info( in, in, in, di, uo) is det.
 
-write_pred_proc_sr_reuse_info( PredInfo, ProcTable, ProcId) -->
+write_pred_proc_sr_reuse_info( HLDS, PredId, ProcId) -->
+	{ module_info_pred_proc_info(HLDS, PredId, ProcId,
+			PredInfo, ProcInfo) },
+
 	io__write_string(":- pragma sr_reuse_info("),
 
 		% write a simple predicate declaration
@@ -100,7 +101,6 @@
 	{ pred_info_arity( PredInfo, Arity) },
 	{ SymName = qualified( ModuleName, PredName ) },
 
-	{ map__lookup( ProcTable, ProcId, ProcInfo ) },
 	{ proc_info_declared_argmodes( ProcInfo, Modes ) },
 
 	(
@@ -130,8 +130,21 @@
 	io__write_string(", "),
 
 		% write reuse information
-	{ proc_info_reuse_information(ProcInfo, TREUSE) },
-	sr_reuse__tabled_reuse_print( TREUSE, ProcInfo) ,
+	{ module_info_structure_reuse_info(HLDS, ReuseInfo) },
+	{ ReuseInfo = structure_reuse_info(ReuseMap) },
+	{ 
+		map__search(ReuseMap, proc(PredId, ProcId), Result)
+	->
+		Result = proc(ReusePredId, ReuseProcId) - ReuseName
+	;
+		ReusePredId = PredId,
+		ReuseProcId = ProcId,
+		ReuseName = SymName
+	},
+	{ module_info_pred_proc_info(HLDS, ReusePredId, ReuseProcId,
+			_ReusePredInfo, ReuseProcInfo) },
+	{ proc_info_reuse_information(ReuseProcInfo, TREUSE) },
+	sr_reuse__tabled_reuse_print( TREUSE, ReuseName, ReuseProcInfo) ,
 
 	io__write_string(").\n").
 
@@ -153,4 +166,5 @@
 	).
 
 
-:- end_module sr_run.
+%-------------------------------------------------------------------%
+%-------------------------------------------------------------------%
Index: trans_opt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trans_opt.m,v
retrieving revision 1.15.4.1
diff -u -r1.15.4.1 trans_opt.m
--- trans_opt.m	2000/09/19 10:02:14	1.15.4.1
+++ trans_opt.m	2000/09/22 14:23:42
@@ -121,8 +121,19 @@
 		globals__io_lookup_bool_option( infer_structure_reuse,
 							StructureReuse),
 
+		{ module_info_structure_reuse_info(Module, StructReuseInfo) },
+		{ StructReuseInfo = structure_reuse_info(ReuseMap) },
+		{ map__values(ReuseMap, ReuseData) },
+		{ list__map(fst, ReuseData, PredProcIds) },
+		{ list__map((pred(proc(PredId, _)::in, PredId::out) is det),
+				PredProcIds, StructReusePredIds) },
+
 		{ module_info_get_special_pred_map(Module, SpecialPredMap) },
 		{ map__values(SpecialPredMap, SpecialPredIds) },
+
+		{ list__append(StructReusePredIds, SpecialPredIds,
+				AllSpecialPredIds) },
+
 		(
 			{ Termination = yes }
 		->
@@ -159,7 +170,7 @@
 		io__write_string(
 			"\n%----------- pa_alias_info/3 ------------- \n\n"),
 		list__foldl( pa_run__write_pred_pa_info(Module,
-							SpecialPredIds),
+							AllSpecialPredIds),
 				PredIds)
 		;
 			[]
@@ -171,7 +182,7 @@
 		io__write_string(
 			"\n%----------- sr_reuse_info/3 ------------- \n\n"),
 		list__foldl( sr_run__write_pred_sr_reuse_info(Module, 
-							SpecialPredIds),
+							AllSpecialPredIds),
 				PredIds)
 		;
 			[]

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