[m-dev.] Re: diff: move code into switch_util.m

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Nov 16 21:47:16 AEDT 2000


On 16-Nov-2000, Fergus Henderson <fjh at cs.mu.oz.au> wrote:
> 
> Reorganize the code for handling switches in the MLDS and
> LLDS back-ends to reduce code duplication.

Oops, I accidentally left a few out of that diff.

compiler/lookup_switch.m:
compiler/dense_switch.m:
compiler/ml_dense_switch.m:
	Change some names and import_module
	declarations to match the new organization.

Workspace: /home/pgrad/fjh/ws/hg
Index: compiler/dense_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dense_switch.m,v
retrieving revision 1.36
diff -u -d -r1.36 dense_switch.m
--- compiler/dense_switch.m	1999/07/10 07:19:50	1.36
+++ compiler/dense_switch.m	2000/11/16 10:43:04
@@ -16,8 +16,9 @@
 
 :- interface.
 
-:- import_module llds, prog_data, switch_gen, code_info, type_util.
-:- import_module hlds_data, hlds_goal.
+:- import_module prog_data, hlds_data, hlds_goal.
+:- import_module switch_util, type_util.
+:- import_module llds, code_info.
 
 	% Should this switch be implemented as a dense jump table?
 	% If so, we return the starting and ending values for the table,
Index: compiler/lookup_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/lookup_switch.m,v
retrieving revision 1.39
diff -u -d -r1.39 lookup_switch.m
--- compiler/lookup_switch.m	2000/11/14 07:30:18	1.39
+++ compiler/lookup_switch.m	2000/11/16 07:36:01
@@ -41,7 +41,10 @@
 
 :- interface.
 
-:- import_module hlds_goal, hlds_data, llds, switch_gen, code_info, prog_data.
+:- import_module prog_data, hlds_goal, hlds_data.
+:- import_module switch_util.
+:- import_module llds, code_info.
+
 :- import_module std_util, map, set, list.
 
 :- type case_consts == list(pair(int, list(rval))).
Index: compiler/ml_dense_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_dense_switch.m,v
retrieving revision 1.1
diff -u -d -r1.1 ml_dense_switch.m
--- compiler/ml_dense_switch.m	2000/11/08 07:23:08	1.1
+++ compiler/ml_dense_switch.m	2000/11/16 07:19:28
@@ -19,8 +19,8 @@
 :- interface.
 
 :- import_module prog_data.
-:- import_module hlds_data, type_util.
-:- import_module mlds, ml_switch_gen, ml_code_util.
+:- import_module hlds_data, switch_util, type_util.
+:- import_module mlds, ml_code_util.
 :- import_module llds. % XXX for code_model
 
 	% Should this switch be implemented as a dense jump table?
@@ -29,13 +29,13 @@
 	% (we may convert locally semidet switches into locally det
 	% switches by adding extra cases whose body is just `fail').
 
-:- pred ml_dense_switch__is_dense_switch(prog_var::in, ml_cases_list::in,
+:- pred ml_dense_switch__is_dense_switch(prog_var::in, cases_list::in,
 		can_fail::in, int::in, int::out, int::out, can_fail::out,
 		ml_gen_info::in, ml_gen_info::out) is semidet.
 
 	% Generate code for a switch using a dense jump table.
 
-:- pred ml_dense_switch__generate(ml_cases_list::in, int::in, int::in,
+:- pred ml_dense_switch__generate(cases_list::in, int::in, int::in,
 		prog_var::in, code_model::in, can_fail::in,
 		prog_context::in, mlds__defns::out, mlds__statements::out,
 		ml_gen_info::in, ml_gen_info::out) is det.
@@ -198,7 +198,7 @@
 	),
 	{ MLDS_Decls = CasesDecls }.
 
-:- pred ml_dense_switch__generate_cases(ml_cases_list::in, int::in, int::in,
+:- pred ml_dense_switch__generate_cases(cases_list::in, int::in, int::in,
 		code_model::in, prog_context::in,
 		mlds__label::in, list(mlds__label)::out,
 		mlds__defns::out, mlds__statements::out,
@@ -232,9 +232,9 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred ml_dense_switch__generate_case(ml_cases_list::in, int::in,
+:- pred ml_dense_switch__generate_case(cases_list::in, int::in,
 		code_model::in, prog_context::in, mlds__label::in,
-		ml_cases_list::out, mlds__label::out, mlds__statements::out,
+		cases_list::out, mlds__label::out, mlds__statements::out,
 		ml_gen_info::in, ml_gen_info::out) is det.
 
 ml_dense_switch__generate_case(Cases0, NextVal, CodeModel, Context,
@@ -257,8 +257,8 @@
 	{ MLDS_Statements = [LabelComment, LabelCode, CaseStatement,
 		JumpComment, JumpCode] }.
 		
-:- pred ml_dense_switch__generate_case_body(ml_cases_list::in, int::in,
-		code_model::in, prog_context::in, ml_cases_list::out,
+:- pred ml_dense_switch__generate_case_body(cases_list::in, int::in,
+		code_model::in, prog_context::in, cases_list::out,
 		string::out, mlds__statement::out,
 		ml_gen_info::in, ml_gen_info::out) is det.
 

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