[m-dev.] [reuse] diff: real headvars

Nancy Mazur Nancy.Mazur at cs.kuleuven.ac.be
Mon Nov 20 21:17:27 AEDT 2000


Hi,


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


Estimated hours taken: 0.5

Instead of relying on whatever unheld convention, add a new field
to the proc_info which will hold the original list of headvariables. 
No predicate is provided to change this original list as we don't
want them to be changeable by anything. 
This information is necessary for the alias and reuse analysis
in order to output the correct sequence of headvariables in terms
of which the alias and reuse-information is expressed. 

hlds_pred.m:
	Add new field, real_head_vars, to the proc_info, and
	the predicate to access this information. 

pa_run.m:
structure_reuse.m:
	Use the new predicate for fetching the real headvars
	from the proc_info. 
	


Index: hlds_pred.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.81.2.8
diff -u -r1.81.2.8 hlds_pred.m
--- hlds_pred.m	2000/11/13 18:36:02	1.81.2.8
+++ hlds_pred.m	2000/11/20 10:10:58
@@ -1332,6 +1332,9 @@
 :- pred proc_info_set_headvars(proc_info, list(prog_var), proc_info).
 :- mode proc_info_set_headvars(in, in, out) is det.
 
+:- pred proc_info_real_headvars(proc_info, list(prog_var)).
+:- mode proc_info_real_headvars(in, out) is det.
+
 :- pred proc_info_argmodes(proc_info, list(mode)).
 :- mode proc_info_argmodes(in, out) is det.
 
@@ -1563,6 +1566,7 @@
 	--->	procedure(
 			prog_varset	:: prog_varset,
 			var_types	:: vartypes,
+			real_head_vars  :: list(prog_var),
 			head_vars	:: list(prog_var),
 			actual_head_modes :: list(mode),
 			inst_varset :: inst_varset,
@@ -1729,7 +1733,7 @@
 	GLOBAL_USE = no, 
 	REUSE = no, 
 	NewProc = procedure(
-		BodyVarSet, BodyTypes, HeadVars, Modes, InstVarSet,
+		BodyVarSet, BodyTypes, HeadVars, HeadVars, Modes, InstVarSet,
 		MaybeArgLives, ClauseBody, MContext, StackSlots, MaybeDet,
 		InferredDet, CanProcess, ArgInfo, InitialLiveness, TVarsMap,
 		TCVarsMap, eval_normal, no, no, DeclaredModes, IsAddressTaken,
@@ -1746,7 +1750,7 @@
 	GLOBAL_USE = no, 
 	REUSE = no, 
 	ProcInfo = procedure(
-		BodyVarSet, BodyTypes, HeadVars,
+		BodyVarSet, BodyTypes, HeadVars, HeadVars,
 		HeadModes, InstVarSet, HeadLives, Goal, Context,
 		StackSlots, DeclaredDetism, InferredDetism, CanProcess, ArgInfo,
 		Liveness, TVarMap, TCVarsMap, eval_normal, ArgSizes,
@@ -1762,7 +1766,7 @@
 	ALIAS = no,
 	GLOBAL_USE = no, 
 	REUSE = no,
-	ProcInfo = procedure(VarSet, VarTypes, HeadVars, HeadModes,
+	ProcInfo = procedure(VarSet, VarTypes, HeadVars, HeadVars, HeadModes,
 		InstVarSet, MaybeHeadLives, Goal, Context, StackSlots,
 		yes(Detism), Detism, yes, [], Liveness, TVarMap, TCVarsMap,
 		eval_normal, no, no, no, IsAddressTaken, RLExprn,
@@ -1835,6 +1839,7 @@
 proc_info_varset(ProcInfo, ProcInfo^prog_varset).
 proc_info_vartypes(ProcInfo, ProcInfo^var_types).
 proc_info_headvars(ProcInfo, ProcInfo^head_vars).
+proc_info_real_headvars(ProcInfo, ProcInfo^real_head_vars).
 proc_info_argmodes(ProcInfo, ProcInfo^actual_head_modes).
 proc_info_inst_varset(ProcInfo, ProcInfo^inst_varset).
 proc_info_maybe_arglives(ProcInfo, ProcInfo^head_var_caller_liveness).
Index: pa_run.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/pa_run.m,v
retrieving revision 1.1.2.10
diff -u -r1.1.2.10 pa_run.m
--- pa_run.m	2000/10/23 07:31:35	1.1.2.10
+++ pa_run.m	2000/11/20 10:11:00
@@ -662,7 +662,6 @@
 	{ pred_info_get_is_pred_or_func( PredInfo, PredOrFunc ) },
 	{ pred_info_module( PredInfo, ModuleName ) },
 	{ pred_info_context( PredInfo, Context ) },
-	{ pred_info_arity( PredInfo, Arity) },
 	{ SymName = qualified( ModuleName, PredName ) },
 
 	{ map__lookup( ProcTable, ProcId, ProcInfo ) },
@@ -682,12 +681,9 @@
 	io__write_string(", "),
 
 		% write headvars vars(HeadVar__1, ... HeadVar__n)
-
 	{ proc_info_varset(ProcInfo, ProgVarset) },
-	{ proc_info_headvars(ProcInfo, HeadVars) },
-	{ list__length(HeadVars, PseudoArity) }, 
-	{ NumberOfTypeInfos = PseudoArity - Arity },
-	{ list_drop_det(NumberOfTypeInfos, HeadVars, RealHeadVars) },
+	{ proc_info_real_headvars(ProcInfo, RealHeadVars) }, 
+	
 	( { RealHeadVars = [] } ->
 		io__write_string("vars")
 	;
Index: structure_reuse.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/structure_reuse.m,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 structure_reuse.m
--- structure_reuse.m	2000/10/18 22:38:10	1.1.2.6
+++ structure_reuse.m	2000/11/20 10:11:11
@@ -116,7 +116,6 @@
 	{ pred_info_get_is_pred_or_func( PredInfo, PredOrFunc ) },
 	{ pred_info_module( PredInfo, ModuleName ) },
 	{ pred_info_context( PredInfo, Context ) },
-	{ pred_info_arity( PredInfo, Arity) },
 	{ SymName = qualified( ModuleName, PredName ) },
 
 	{ proc_info_declared_argmodes( ProcInfo, Modes ) },
@@ -137,10 +136,10 @@
 		% write headvars vars(HeadVar__1, ... HeadVar__n)
 
 	{ proc_info_varset(ProcInfo, ProgVarset) },
-	{ proc_info_headvars(ProcInfo, HeadVars) },
-	{ list__length(HeadVars, PseudoArity) }, 
-	{ NumberOfTypeInfos = PseudoArity - Arity },
-	{ list_drop_det(NumberOfTypeInfos, HeadVars, RealHeadVars) },
+	{ proc_info_real_headvars(ProcInfo, HeadVars) },
+
+	{ RealHeadVars = HeadVars }, 
+
 	( { RealHeadVars = [] } ->
 		io__write_string("vars")
 	;

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