diff: additional info in hlds dumps.

Tyson Richard DOWD trd at cs.mu.oz.au
Fri May 9 17:13:09 AEST 1997


Hi,

	Can someone please review this?

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

Estimated hours taken: 0.5

Add more information to the hlds dumps.

compiler/hlds_out.m:
	Add code to output the type_info_varmap (mapping from type
	variables to type_info variables).

Index: hlds_out.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_out.m,v
retrieving revision 1.160
diff -u -r1.160 hlds_out.m
--- hlds_out.m	1997/05/05 11:17:04	1.160
+++ hlds_out.m	1997/05/08 06:49:16
@@ -1490,6 +1490,47 @@
 	hlds_out__write_var_types_2(Vars, Indent, VarSet, AppendVarnums,
 		VarTypes, TypeVarSet).
 
+:- pred hlds_out__write_typeinfo_varmap(int, bool, map(tvar, var), varset, 
+	tvarset, io__state, io__state).
+:- mode hlds_out__write_typeinfo_varmap(in, in, in, in, in, di, uo) is det.
+
+hlds_out__write_typeinfo_varmap(Indent, AppendVarnums, TypeInfoMap, VarSet,
+		TVarSet) -->
+	hlds_out__write_indent(Indent),
+	io__write_string("% type_info varmap:\n"),
+	{ map__keys(TypeInfoMap, TypeVars) },
+	hlds_out__write_typeinfo_varmap_2(TypeVars, Indent, AppendVarnums, 
+		TypeInfoMap, VarSet, TVarSet).
+
+:- pred hlds_out__write_typeinfo_varmap_2(list(tvar), int, bool, 
+	map(tvar, var), varset, tvarset, io__state, io__state).
+:- mode hlds_out__write_typeinfo_varmap_2(in, in, in, in, in, in, di, uo) 
+	is det.
+
+hlds_out__write_typeinfo_varmap_2([], _, _, _, _, _) --> [].
+hlds_out__write_typeinfo_varmap_2([TVar | TVars], Indent, AppendVarnums,
+		TypeInfoMap, VarSet, TVarSet) -->
+	hlds_out__write_indent(Indent),
+	io__write_string("% "),
+
+	mercury_output_var(TVar, TVarSet, AppendVarnums),
+	io__write_string(" (number "),
+	{ term__var_to_int(TVar, TVarNum) },
+	io__write_int(TVarNum),
+	io__write_string(")"),
+
+	io__write_string(" -> "),
+	{ map__lookup(TypeInfoMap, TVar, Var) },
+	mercury_output_var(Var, VarSet, AppendVarnums),
+	io__write_string(" (number "),
+	{ term__var_to_int(Var, VarNum) },
+	io__write_int(VarNum),
+	io__write_string(")"),
+	io__write_string("\n"),
+
+	hlds_out__write_typeinfo_varmap_2(TVars, Indent, AppendVarnums,
+		TypeInfoMap, VarSet, TVarSet).
+
 :- pred hlds_out__write_stack_slots(int, stack_slots, varset, bool,
 	io__state, io__state).
 :- mode hlds_out__write_stack_slots(in, in, in, in, di, uo) is det.
@@ -1743,6 +1784,7 @@
 	{ proc_info_argmodes(Proc, HeadModes) },
 	{ proc_info_goal(Proc, Goal) },
 	{ proc_info_context(Proc, ModeContext) },
+	{ proc_info_typeinfo_varmap(Proc, TypeInfoMap) },
 	{ Indent1 is Indent + 1 },
 
 	hlds_out__write_indent(Indent1),
@@ -1757,6 +1799,8 @@
 
 	hlds_out__write_var_types(Indent, VarSet, AppendVarnums,
 		VarTypes, TVarSet),
+	hlds_out__write_typeinfo_varmap(Indent, AppendVarnums, TypeInfoMap,
+		VarSet, TVarSet),
 
 	hlds_out__write_indent(Indent),
 	{ predicate_name(ModuleInfo, PredId, PredName) },
-- 
       Tyson Dowd           #
                            #             Sign on refrigerator:
     trd at cs.mu.oz.au        #           Refrigerate after opening. 
http://www.cs.mu.oz.au/~trd #                  - C. J. Owen.



More information about the developers mailing list