Remove almost all dependencies by the modules of parse_tree.m on the modules

Estimated hours taken: 12
Branches: main

Remove almost all dependencies by the modules of parse_tree.m on the modules
of hlds.m. The only such dependencies remaining now are on type_util.m.

compiler/hlds_data.m:
compiler/prog_data.m:
	Move the cons_id type from hlds_data to prog_data, since several parts
	of the parse tree data structure depend on it (particularly insts).
	Remove the need to import HLDS modules in prog_data.m by making the
	cons_ids that refer to procedure ids refer to them via a new type
	that contains shrouded pred_ids and proc_ids. Since pred_ids and
	proc_ids are abstract types in hlds_data, add predicates to hlds_data
	to shroud and unshroud them.

	Also move some other types, e.g. mode_id and class_id, from hlds_data
	to prog_data.

compiler/hlds_data.m:
compiler/prog_util.m:
	Move predicates for manipulating cons_ids from hlds_data to prog_util.

compiler/inst.m:
compiler/prog_data.m:
	Move the contents of inst.m to prog_data.m, since that is where it
	belongs, and since doing so eliminates a circular dependency.
	The separation doesn't serve any purpose any more, since we don't
	need to import hlds_data.m anymore to get access to the cons_id type.

compiler/mode_util.m:
compiler/prog_mode.m:
compiler/parse_tree.m:
	Move the predicates in mode_util that don't depend on the HLDS to a new
	module prog_mode, which is part of parse_tree.m.

compiler/notes/compiler_design.m:
	Mention prog_mode.m, and delete the mention of inst.m.

compiler/mercury_to_mercury.m:
compiler/hlds_out.m:
	Move the predicates that depend on HLDS out of mercury_to_mercury.m
	to hlds_out.m. Export from mercury_to_mercury.m the predicates needed
	by the moved predicates.

compiler/hlds_out.m:
compiler/prog_out.m:
	Move predicates for printing parts of the parse tree out of hlds_out.m
	to prog_out.m, since mercury_to_mercury.m needs to use them.

compiler/purity.m:
compiler/prog_out.m:
	Move predicates for printing purities from purity.m, which is part
	of check_hlds.m, to prog_out.m, since mercury_to_mercury.m needs to use
	them.

compiler/passes_aux.m:
compiler/prog_out.m:
	Move some utility predicates (e.g. for printing progress messages) from
	passes_aux.m to prog_out.m, since some predicates in submodules of
	parse_tree.m need to use them.

compiler/foreign.m:
compiler/prog_data.m:
	Move some types from foreign.m to prog_data.m to allow the elimination
	of some dependencies on foreign.m from submodules of parse_tree.m.

compiler/*.m:
	Conform to the changes above, mostly by updating lists of imported
	modules and module qualifications. In some cases, also do some local
	cleanups such as converting predicate declarations to predmode syntax
	and fixing white space.
This commit is contained in:
Zoltan Somogyi
2004-06-14 04:17:03 +00:00
parent 5685d41175
commit 885fd4a387
194 changed files with 5510 additions and 5563 deletions

View File

@@ -144,7 +144,7 @@
% mapped to a set including N, then the producer of that variable
% may be moved to the start of the goal with goal path <gp>;sN;
% (if the control structure is a switch) or <gp>;t; or <gp>;e;
% (if the control structure is an if-then-else).
% (if the control structure is an if-then-else).
%
% Since <gp>;sN; is conjoined with e.g. <gp>;sN;<gp2>;sM;
% it would be a mode error (variable having two conjoined producers)
@@ -268,7 +268,7 @@ pre_process_proc(!ProcInfo) :-
:- type option_values
---> option_values(
fully_strict :: bool,
reorder_conj :: bool,
reorder_conj :: bool,
copy_limit :: int
).
@@ -635,7 +635,7 @@ process_goal_internal(Goal0, Goal, InitInstMap, FinalInstMap, VarTypes,
error("process_goal_internal: switch count")
),
goal_info_get_goal_path(GoalInfo0, GoalPath),
BranchPoint = branch_point(GoalPath, switch(NumAlt)),
BranchPoint = branch_point(GoalPath, switch(NumAlt)),
map__map_values(demand_var_everywhere, !WhereNeededMap),
map__init(BranchNeededMap0),
process_cases(Cases0, Cases, BranchPoint, 1,
@@ -661,7 +661,7 @@ process_goal_internal(Goal0, Goal, InitInstMap, FinalInstMap, VarTypes,
;
GoalExpr0 = if_then_else(Quant, Cond0, Then0, Else0),
goal_info_get_goal_path(GoalInfo0, GoalPath),
BranchPoint = branch_point(GoalPath, ite),
BranchPoint = branch_point(GoalPath, ite),
map__map_values(demand_var_everywhere, !WhereNeededMap),
process_ite(Cond0, Cond, Then0, Then, Else0, Else, BranchPoint,
InitInstMap, FinalInstMap, VarTypes, ModuleInfo,
@@ -693,7 +693,7 @@ process_goal_internal(Goal0, Goal, InitInstMap, FinalInstMap, VarTypes,
:- type bracketed_goal
---> bracketed_goal(hlds_goal, instmap, instmap).
:- pred process_conj(list(hlds_goal)::in, list(hlds_goal)::out,
:- pred process_conj(list(hlds_goal)::in, list(hlds_goal)::out,
instmap::in, instmap::in, vartypes::in, module_info::in,
option_values::in, where_needed_map::in, where_needed_map::out,
refined_goal_map::in, refined_goal_map::out,
@@ -752,7 +752,7 @@ process_rev_bracketed_conj([BracketedGoal | BracketedGoals], Goals,
:- pred process_disj(list(hlds_goal)::in, list(hlds_goal)::out,
instmap::in, instmap::in, vartypes::in, module_info::in,
option_values::in, goal_path::in,
where_needed_map::in, where_needed_map::in, where_needed_map::out,
where_needed_map::in, where_needed_map::in, where_needed_map::out,
refined_goal_map::in, refined_goal_map::out,
bool::in, bool::out) is det.
@@ -776,7 +776,7 @@ process_disj([Goal0 | Goals0], [Goal | Goals], InitInstMap, FinalInstMap,
:- pred process_cases(list(case)::in, list(case)::out, branch_point::in,
int::in, instmap::in, instmap::in, vartypes::in, module_info::in,
option_values::in, goal_path::in, where_needed_map::in,
where_needed_map::in, where_needed_map::out,
where_needed_map::in, where_needed_map::out,
refined_goal_map::in, refined_goal_map::out,
bool::in, bool::out) is det.
@@ -803,7 +803,7 @@ process_cases([case(Var, Goal0) | Cases0], [case(Var, Goal) | Cases],
hlds_goal::in, hlds_goal::out, hlds_goal::in, hlds_goal::out,
branch_point::in, instmap::in, instmap::in, vartypes::in,
module_info::in, option_values::in, goal_path::in,
where_needed_map::in, where_needed_map::out,
where_needed_map::in, where_needed_map::out,
refined_goal_map::in, refined_goal_map::out,
bool::in, bool::out) is det.
@@ -1135,7 +1135,7 @@ where_needed_branches_upper_bound_2(CurrentPath, [First | Rest],
where_needed_branches_upper_bound_2(CurrentPath,
Rest, Branches1, WhereNeeded)
).
:- pred get_parent_branch_point(goal_path::in, goal_path::out,
goal_path_step::out, branch_alts::out, int::out) is semidet.