Don't test whether we are emitting trail operations when generating

Estimated hours taken: 0.5
Branches: main

compiler/code_gen.m:
	Don't test whether we are emitting trail operations when generating
	*every* goal; test it only when generating goals that may want to
	emit trailing operations. Make the test itself more efficient
	by doing option lookups and boolean operations on option values
	once per procedure rather than once per affected goal.

compiler/code_info.m:
	Extend the code_info structure to provide storage space for the
	result of this per-procedure computation.

compiler/code_util.m:
	Delete a function whose functionality is now in code_info.m.

compiler/goal_form.m:
	Turn the predicates that test whether a goal can modify the trail
	into functions, since that is how they were being used. Make them
	take only the goal_info as the argument, since the goal expression
	isn't needed, and creating the expression/goal_info pair would be
	an unnecessary cost on the code generator.

compiler/add_trail_ops.m:
compiler/disj_gen.m:
	Conform to the change in goal_form.m.

compiler/mercury_compile.m:
	Fix formatting.

compiler/assertion.m:
	Address some old review comments: fix some bad predicate names,
	and put some predicate's arguments into a more conventional order.

	Remove some redundant and slightly inconsistent documentation.

compiler/accumulator.m:
compiler/typecheck.m:
	Conform to the change in assertion.m.
This commit is contained in:
Zoltan Somogyi
2006-03-31 03:32:11 +00:00
parent 93c9636bf7
commit 90f2724738
10 changed files with 179 additions and 178 deletions

View File

@@ -21,7 +21,6 @@
:- import_module hlds.hlds_module.
:- import_module hlds.hlds_pred.
:- import_module hlds.hlds_rtti.
:- import_module libs.globals.
:- import_module ll_backend.llds.
:- import_module mdbcomp.prim_data.
:- import_module parse_tree.prog_data.
@@ -93,18 +92,6 @@
:- pred build_input_arg_list(proc_info::in, assoc_list(prog_var, lval)::out)
is det.
%---------------------------------------------------------------------------%
%
% Utility predicates used to implement trailing
%
% Tests if we should add trail ops to the code we generate for
% the given goal. This will be 'no' unless we are compiling
% in trailing grade. It may also be 'no' in trailing grades if
% we are optimizing trail usage and trail usage analysis tells
% us that it is safe to omit the trail ops.
%
:- func should_add_trail_ops(globals, hlds_goal) = add_trail_ops.
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
@@ -454,41 +441,6 @@ build_input_arg_list_2([V - Arg | Rest0], VarArgs) :-
build_input_arg_list_2(Rest0, VarArgs0).
%---------------------------------------------------------------------------%
%
% Utility predicates used to implement trailing
%
should_add_trail_ops(Globals, Goal) = AddTrailOps :-
globals.lookup_bool_option(Globals, use_trail, UseTrail),
(
UseTrail = no,
AddTrailOps = no
;
UseTrail = yes,
globals.lookup_bool_option(Globals, disable_trail_ops,
DisableTrailOps),
(
DisableTrailOps = yes,
AddTrailOps = no
;
DisableTrailOps = no,
globals.lookup_bool_option(Globals, optimize_trail_usage,
OptTrailUsage),
(
OptTrailUsage = no,
AddTrailOps = yes
;
OptTrailUsage = yes,
( goal_cannot_modify_trail(Goal) ->
AddTrailOps = no
;
AddTrailOps = yes
)
)
)
).
%-----------------------------------------------------------------------------%
:- func this_file = string.