[m-dev.] trivial diff: use record syntax in ml_code_util.m

Fergus Henderson fjh at cs.mu.OZ.AU
Wed May 10 02:33:25 AEST 2000


Estimated hours taken: 0.5

compiler/ml_code_util.m:
	Use record syntax for the ml_gen_info type.

Workspace: /home/pgrad/fjh/ws/hg
Index: compiler/ml_code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_util.m,v
retrieving revision 1.7
diff -u -d -r1.7 ml_code_util.m
--- compiler/ml_code_util.m	2000/05/09 08:11:30	1.7
+++ compiler/ml_code_util.m	2000/05/09 16:28:46
@@ -1124,26 +1124,26 @@
 			% these fields remain constant for each procedure
 			%
 
-			module_info,
-			pred_id,
-			proc_id,
-			prog_varset,
-			map(prog_var, prog_type),
-			list(prog_var),			% output arguments
+			module_info :: module_info,
+			pred_id :: pred_id,
+			proc_id :: proc_id,
+			varset :: prog_varset,
+			var_types :: map(prog_var, prog_type),
+			output_vars :: list(prog_var),	% output arguments
 
 			%
 			% these fields get updated as we traverse
 			% each procedure
 			%
 
-			mlds__func_sequence_num,
-			commit_sequence_num,
-			stack(success_cont),
+			func_label :: mlds__func_sequence_num,
+			commit_label :: commit_sequence_num,
+			success_cont_stack :: stack(success_cont),
 				% definitions of functions or global
 				% constants which should be inserted
 				% before the definition of the function
 				% for the current procedure
-			mlds__defns
+			extra_defns :: mlds__defns
 		).
 
 ml_gen_info_init(ModuleInfo, PredId, ProcId) = MLDSGenInfo :-
@@ -1172,24 +1172,17 @@
 			ExtraDefns
 		).
 
-ml_gen_info_get_module_info(ml_gen_info(ModuleInfo, _, _, _, _, _, _, _, _, _),
-	ModuleInfo).
+ml_gen_info_get_module_info(Info, Info^module_info).
 
 ml_gen_info_get_module_name(MLDSGenInfo, ModuleName) :-
 	ml_gen_info_get_module_info(MLDSGenInfo, ModuleInfo),
 	module_info_name(ModuleInfo, ModuleName).
-
-ml_gen_info_get_pred_id(ml_gen_info(_, PredId, _, _, _, _, _, _, _, _), PredId).
 
-ml_gen_info_get_proc_id(ml_gen_info(_, _, ProcId, _, _, _, _, _, _, _), ProcId).
-
-ml_gen_info_get_varset(ml_gen_info(_, _, _, VarSet, _, _, _, _, _, _), VarSet).
-
-ml_gen_info_get_var_types(ml_gen_info(_, _, _, _, VarTypes, _, _, _, _, _),
-	VarTypes).
-
-ml_gen_info_get_output_vars(ml_gen_info(_, _, _, _, _, OutputVars, _, _, _, _),
-	OutputVars).
+ml_gen_info_get_pred_id(Info, Info^pred_id).
+ml_gen_info_get_proc_id(Info, Info^proc_id).
+ml_gen_info_get_varset(Info, Info^varset).
+ml_gen_info_get_var_types(Info, Info^var_types).
+ml_gen_info_get_output_vars(Info, Info^output_vars).
 
 ml_gen_info_use_gcc_nested_functions(UseNestedFuncs) -->
 	=(Info),
@@ -1197,56 +1190,30 @@
 	{ module_info_globals(ModuleInfo, Globals) },
 	{ globals__lookup_bool_option(Globals, gcc_nested_functions,
 		UseNestedFuncs) }.
-
-ml_gen_info_new_func_label(Label,
-		ml_gen_info(A, B, C, D, E, F, Label0, H, I, J),
-		ml_gen_info(A, B, C, D, E, F, Label, H, I, J)) :-
-	Label is Label0 + 1.
 
-ml_gen_info_new_commit_label(CommitLabel,
-		ml_gen_info(A, B, C, D, E, F, G, CommitLabel0, I, J),
-		ml_gen_info(A, B, C, D, E, F, G, CommitLabel, I, J)) :-
-	CommitLabel is CommitLabel0 + 1.
-
-/******
-:- pred ml_gen_info_get_success_cont_stack(ml_gen_info,
-			stack(success_cont)).
-:- mode ml_gen_info_get_success_cont_stack(in, out) is det.
-
-ml_gen_info_get_success_cont_stack(
-	ml_gen_info(_, _, _, _, _, _, _, _, SuccContStack, _), SuccContStack).
-
-:- pred ml_gen_info_set_success_cont_stack(stack(success_cont),
-			ml_gen_info, ml_gen_info).
-:- mode ml_gen_info_set_success_cont_stack(in, in, out) is det.
+ml_gen_info_new_func_label(Label, Info, Info^func_label := Label) :-
+	Label = Info^func_label + 1.
 
-ml_gen_info_set_success_cont_stack(SuccContStack,
-		ml_gen_info(A, B, C, D, E, F, G, H, _, J),
-		ml_gen_info(A, B, C, D, E, F, G, H, SuccContStack, J)).
-********/
+ml_gen_info_new_commit_label(CommitLabel, Info,
+		Info^commit_label := CommitLabel) :-
+	CommitLabel = Info^commit_label + 1.
 
-ml_gen_info_push_success_cont(SuccCont,
-		ml_gen_info(A, B, C, D, E, F, G, H, Stack0, J),
-		ml_gen_info(A, B, C, D, E, F, G, H, Stack, J)) :-
-	stack__push(Stack0, SuccCont, Stack).
+ml_gen_info_push_success_cont(SuccCont, Info,
+	Info^success_cont_stack :=
+		stack__push(Info^success_cont_stack, SuccCont)).
 
-ml_gen_info_pop_success_cont(
-		ml_gen_info(A, B, C, D, E, F, G, H, Stack0, J),
-		ml_gen_info(A, B, C, D, E, F, G, H, Stack, J)) :-
-	stack__pop_det(Stack0, _SuccCont, Stack).
+ml_gen_info_pop_success_cont(Info0, Info) :-
+	Stack0 = Info0^success_cont_stack,
+	stack__pop_det(Stack0, _SuccCont, Stack),
+	Info = (Info0^success_cont_stack := Stack).
 
-ml_gen_info_current_success_cont(SuccCont,
-		ml_gen_info(A, B, C, D, E, F, G, H, Stack, J),
-		ml_gen_info(A, B, C, D, E, F, G, H, Stack, J)) :-
-	stack__top_det(Stack, SuccCont).
+ml_gen_info_current_success_cont(SuccCont, Info, Info) :-
+	stack__top_det(Info^success_cont_stack, SuccCont).
 
-ml_gen_info_add_extra_defn(ExtraDefn,
-		ml_gen_info(A, B, C, D, E, F, G, H, I, ExtraDefns0),
-		ml_gen_info(A, B, C, D, E, F, G, H, I, ExtraDefns)) :-
-	ExtraDefns = [ExtraDefn | ExtraDefns0].
+ml_gen_info_add_extra_defn(ExtraDefn, Info,
+	Info^extra_defns := [ExtraDefn | Info^extra_defns]).
 
-ml_gen_info_get_extra_defns(ml_gen_info(_, _, _, _, _, _, _, _, _, ExtraDefns),
-	ExtraDefns).
+ml_gen_info_get_extra_defns(Info, Info^extra_defns).
 
 %-----------------------------------------------------------------------------%
 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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