[m-rev.] for review: builtins for trace goals
Zoltan Somogyi
zs at csse.unimelb.edu.au
Mon Jul 31 13:56:04 AEST 2006
Improve the efficient of trace goals by making the primitives for getting
and setting the I/O state builtins.
library/private_builtin.m:
Delete the trace_get_io_state and trace_set_io_state predicates,
since you cannot define builtins.
compiler/builtin_ops.m:
Extend the type describing builtins to describe noops like
trace_get_io_state and trace_set_io_state.
compiler/bytecode_gen.m:
compiler/call_gen.m:
compiler/ml_call_gen.m:
Handle the new noop kind of builtins.
For call_gen.m, also get rid of a lot of unnecessary module
qualifications.
compiler/code_info.m:
Provide a mechanism needed by call_gen.m to make a variable (in our
case, the return value of trace_get_io_state) magically appear
in a register.
Zoltan.
cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/builtin_ops.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/builtin_ops.m,v
retrieving revision 1.23
diff -u -b -r1.23 builtin_ops.m
--- compiler/builtin_ops.m 5 Jun 2006 05:23:26 -0000 1.23
+++ compiler/builtin_ops.m 30 Jul 2006 07:55:03 -0000
@@ -114,7 +114,8 @@
:- type simple_code(T)
---> assign(T, simple_expr(T))
; ref_assign(T, T)
- ; test(simple_expr(T)).
+ ; test(simple_expr(T))
+ ; noop(list(T)).
:- type simple_expr(T)
---> leaf(T)
@@ -133,7 +134,8 @@
:- inst simple_code
---> assign(ground, simple_assign_expr)
; ref_assign(ground, ground)
- ; test(simple_test_expr).
+ ; test(simple_test_expr)
+ ; noop(ground).
:- inst simple_arg_expr
---> leaf(ground)
@@ -164,7 +166,12 @@
builtin_translation(ModuleName, PredName, ProcInt, Args, Code).
:- pred builtin_translation(string::in, string::in, int::in, list(T)::in,
- simple_code(T)::out) is semidet.
+ simple_code(T)::out(simple_code)) is semidet.
+
+builtin_translation("private_builtin", "trace_get_io_state", 0, [X],
+ noop([X])).
+builtin_translation("private_builtin", "trace_set_io_state", 0, [_X],
+ noop([])).
builtin_translation("private_builtin", "store_at_ref", 0, [X, Y],
ref_assign(X, Y)).
Index: compiler/bytecode_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/bytecode_gen.m,v
retrieving revision 1.105
diff -u -b -r1.105 bytecode_gen.m
--- compiler/bytecode_gen.m 27 Jul 2006 05:00:57 -0000 1.105
+++ compiler/bytecode_gen.m 30 Jul 2006 08:09:43 -0000
@@ -405,6 +405,9 @@
;
SimpleCode = ref_assign(_Var, _Expr),
unexpected(this_file, "ref_assign")
+ ;
+ SimpleCode = noop(_DefinedVars),
+ Code = node([])
)
;
string.append("unknown builtin predicate ", PredName, Msg),
Index: compiler/call_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/call_gen.m,v
retrieving revision 1.178
diff -u -b -r1.178 call_gen.m
--- compiler/call_gen.m 28 Jul 2006 05:08:06 -0000 1.178
+++ compiler/call_gen.m 30 Jul 2006 08:36:43 -0000
@@ -48,17 +48,17 @@
---> known_num
; unknown.
- % call_gen.generic_call_info(Globals, GenericCall, NumImmediateInputArgs,
- % CodeAddr, SpecifierArgInfos, FirstImmediateInputReg, HoCallVariant).
+ % generic_call_info(Globals, GenericCall, NumImmediateInputArgs, CodeAddr,
+ % SpecifierArgInfos, FirstImmediateInputReg, HoCallVariant).
%
-:- pred call_gen.generic_call_info(globals::in, generic_call::in, int::in,
+:- pred generic_call_info(globals::in, generic_call::in, int::in,
code_addr::out, assoc_list(prog_var, arg_info)::out, int::out,
known_call_variant::out) is det.
-:- pred call_gen.input_arg_locs(assoc_list(prog_var, arg_info)::in,
+:- pred input_arg_locs(assoc_list(prog_var, arg_info)::in,
assoc_list(prog_var, arg_loc)::out) is det.
-:- pred call_gen.output_arg_locs(assoc_list(prog_var, arg_info)::in,
+:- pred output_arg_locs(assoc_list(prog_var, arg_info)::in,
assoc_list(prog_var, arg_loc)::out) is det.
%---------------------------------------------------------------------------%
@@ -94,7 +94,6 @@
%---------------------------------------------------------------------------%
generate_call(CodeModel, PredId, ProcId, ArgVars, GoalInfo, Code, !CI) :-
-
% Find out which arguments are input and which are output.
ArgInfo = code_info.get_pred_proc_arginfo(!.CI, PredId, ProcId),
assoc_list.from_corresponding_lists(ArgVars, ArgInfo, ArgsInfos),
@@ -102,8 +101,7 @@
% Save the necessary vars on the stack and move the input args
% to their registers.
code_info.setup_call(GoalInfo, ArgsInfos, LiveVals, SetupCode, !CI),
- call_gen.kill_dead_input_vars(ArgsInfos, GoalInfo, NonLiveOutputs,
- !CI),
+ kill_dead_input_vars(ArgsInfos, GoalInfo, NonLiveOutputs, !CI),
% Figure out what the call model is.
call_gen.prepare_for_call(CodeModel, CallModel, TraceCode, !CI),
@@ -123,21 +121,18 @@
label(ReturnLabel) - "continuation label"
]),
- % Figure out what variables will be live at the return point,
- % and where, for use in the accurate garbage collector, and
- % in the debugger.
+ % Figure out what variables will be live at the return point, and where,
+ % for use in the accurate garbage collector, and in the debugger.
code_info.get_instmap(!.CI, InstMap),
goal_info_get_instmap_delta(GoalInfo, InstMapDelta),
instmap.apply_instmap_delta(InstMap, InstMapDelta, ReturnInstMap),
- % Update the code generator state to reflect the situation
- % after the call.
- call_gen.handle_return(ArgsInfos, GoalInfo, NonLiveOutputs,
+ % Update the code generator state to reflect the situation after the call.
+ handle_return(ArgsInfos, GoalInfo, NonLiveOutputs,
ReturnInstMap, ReturnLiveLvalues, !CI),
- % If the call can fail, generate code to check for and
- % handle the failure.
- call_gen.handle_failure(CodeModel, GoalInfo, FailHandlingCode, !CI),
+ % If the call can fail, generate code to check for and handle the failure.
+ handle_failure(CodeModel, GoalInfo, FailHandlingCode, !CI),
Code = tree_list([SetupCode, TraceCode, CallCode, FailHandlingCode]).
@@ -156,15 +151,14 @@
% variables to be saved to the stack.
( GenericCall = cast(_) ->
( Args0 = [InputArg, OutputArg] ->
- call_gen.generate_assign_builtin(OutputArg,
- leaf(InputArg), Code, !CI)
+ generate_assign_builtin(OutputArg, leaf(InputArg), Code, !CI)
;
unexpected(this_file,
"generate_generic_call: invalid type/inst cast call")
)
;
- call_gen.generate_generic_call_2(OuterCodeModel,
- GenericCall, Args0, Modes0, Det, GoalInfo, Code, !CI)
+ generate_generic_call_2(OuterCodeModel, GenericCall, Args0, Modes0,
+ Det, GoalInfo, Code, !CI)
).
:- pred generate_generic_call_2(code_model::in, generic_call::in,
@@ -180,8 +174,8 @@
arg_info.compute_in_and_out_vars(ModuleInfo, Args, Modes, Types,
InVars, OutVars),
module_info_get_globals(ModuleInfo, Globals),
- call_gen.generic_call_info(Globals, GenericCall, length(InVars),
- CodeAddr, SpecifierArgInfos, FirstImmInput, HoCallVariant),
+ generic_call_info(Globals, GenericCall, length(InVars), CodeAddr,
+ SpecifierArgInfos, FirstImmInput, HoCallVariant),
determinism_to_code_model(Det, CodeModel),
( CodeModel = model_semi ->
FirstOutput = 2
@@ -199,17 +193,16 @@
% Save the necessary vars on the stack and move the input args
% defined by variables to their registers.
code_info.setup_call(GoalInfo, ArgInfos, LiveVals0, SetupCode, !CI),
- call_gen.kill_dead_input_vars(ArgInfos, GoalInfo, NonLiveOutputs,
- !CI),
+ kill_dead_input_vars(ArgInfos, GoalInfo, NonLiveOutputs, !CI),
% Move the input args not defined by variables to their
% registers. Setting up these arguments last results in
% slightly more efficient code, since we can use their
% registers when placing the variables.
- call_gen.generic_call_nonvar_setup(GenericCall, HoCallVariant,
- InVars, OutVars, NonVarCode, !CI),
+ generic_call_nonvar_setup(GenericCall, HoCallVariant, InVars, OutVars,
+ NonVarCode, !CI),
- call_gen.extra_livevals(FirstImmInput, ExtraLiveVals),
+ extra_livevals(FirstImmInput, ExtraLiveVals),
set.insert_list(LiveVals0, ExtraLiveVals, LiveVals),
call_gen.prepare_for_call(CodeModel, CallModel, TraceCode, !CI),
@@ -228,7 +221,7 @@
% Update the code generator state to reflect the situation
% after the call.
- call_gen.handle_return(OutArgsInfos, GoalInfo, NonLiveOutputs,
+ handle_return(OutArgsInfos, GoalInfo, NonLiveOutputs,
ReturnInstMap, ReturnLiveLvalues, !CI),
CallCode = node([
@@ -240,7 +233,7 @@
% If the call can fail, generate code to check for and
% handle the failure.
- call_gen.handle_failure(CodeModel, GoalInfo, FailHandlingCode, !CI),
+ handle_failure(CodeModel, GoalInfo, FailHandlingCode, !CI),
Code = tree_list([SetupCode, NonVarCode, TraceCode, CallCode,
FailHandlingCode]).
@@ -249,23 +242,23 @@
% The registers before the first input argument are all live.
%
-:- pred call_gen.extra_livevals(int::in, list(lval)::out) is det.
+:- pred extra_livevals(int::in, list(lval)::out) is det.
-call_gen.extra_livevals(FirstInput, ExtraLiveVals) :-
- call_gen.extra_livevals(1, FirstInput, ExtraLiveVals).
+extra_livevals(FirstInput, ExtraLiveVals) :-
+ extra_livevals_from(1, FirstInput, ExtraLiveVals).
-:- pred call_gen.extra_livevals(int::in, int::in, list(lval)::out) is det.
+:- pred extra_livevals_from(int::in, int::in, list(lval)::out) is det.
-call_gen.extra_livevals(Reg, FirstInput, ExtraLiveVals) :-
+extra_livevals_from(Reg, FirstInput, ExtraLiveVals) :-
( Reg < FirstInput ->
ExtraLiveVals = [reg(r, Reg) | ExtraLiveVals1],
NextReg = Reg + 1,
- call_gen.extra_livevals(NextReg, FirstInput, ExtraLiveVals1)
+ extra_livevals_from(NextReg, FirstInput, ExtraLiveVals1)
;
ExtraLiveVals = []
).
-call_gen.generic_call_info(Globals, GenericCall, NumInputArgs, CodeAddr,
+generic_call_info(Globals, GenericCall, NumInputArgs, CodeAddr,
SpecifierArgInfos, FirstImmediateInputReg, HoCallVariant) :-
(
GenericCall = higher_order(PredVar, _, _, _),
@@ -317,17 +310,17 @@
% typeclass_info for a method call) are set up together with the
% arguments being passed the indirectly called code, since with eager
% code generation this ensures that each target register is reserved
- % for the variable destined for it. This is set up by
- % call_gen.generic_call_info. call_gen.generic_call_nonvar_setup
- % generates code to pass to the dispatch routine the parts of the
- % indirectly called code's identifier that come from constants.
+ % for the variable destined for it. This is set up by generic_call_info.
+ % generic_call_nonvar_setup generates code to pass to the dispatch routine
+ % the parts of the indirectly called code's identifier that come from
+ % constants.
%
-:- pred call_gen.generic_call_nonvar_setup(generic_call::in,
- known_call_variant::in, list(prog_var)::in, list(prog_var)::in,
- code_tree::out, code_info::in, code_info::out) is det.
+:- pred generic_call_nonvar_setup(generic_call::in, known_call_variant::in,
+ list(prog_var)::in, list(prog_var)::in, code_tree::out,
+ code_info::in, code_info::out) is det.
-call_gen.generic_call_nonvar_setup(higher_order(_, _, _, _),
- HoCallVariant, InVars, _OutVars, Code, !CI) :-
+generic_call_nonvar_setup(higher_order(_, _, _, _), HoCallVariant,
+ InVars, _OutVars, Code, !CI) :-
(
HoCallVariant = known_num,
Code = empty
@@ -340,8 +333,8 @@
"Assign number of immediate input arguments"
])
).
-call_gen.generic_call_nonvar_setup(class_method(_, Method, _, _),
- HoCallVariant, InVars, _OutVars, Code, !CI) :-
+generic_call_nonvar_setup(class_method(_, Method, _, _), HoCallVariant,
+ InVars, _OutVars, Code, !CI) :-
(
HoCallVariant = known_num,
code_info.clobber_regs([reg(r, 2)], !CI),
@@ -360,15 +353,15 @@
"Assign number of immediate input arguments"
])
).
-call_gen.generic_call_nonvar_setup(cast(_), _, _, _, _, !CI) :-
+generic_call_nonvar_setup(cast(_), _, _, _, _, !CI) :-
unexpected(this_file, "generic_call_nonvar_setup: cast").
%---------------------------------------------------------------------------%
-:- pred call_gen.prepare_for_call(code_model::in, call_model::out,
+:- pred prepare_for_call(code_model::in, call_model::out,
code_tree::out, code_info::in, code_info::out) is det.
-call_gen.prepare_for_call(CodeModel, CallModel, TraceCode, !CI) :-
+prepare_for_call(CodeModel, CallModel, TraceCode, !CI) :-
code_info.succip_is_used(!CI),
(
CodeModel = model_det,
@@ -384,10 +377,10 @@
),
trace_prepare_for_call(!.CI, TraceCode).
-:- pred call_gen.handle_failure(code_model::in, hlds_goal_info::in,
+:- pred handle_failure(code_model::in, hlds_goal_info::in,
code_tree::out, code_info::in, code_info::out) is det.
-call_gen.handle_failure(CodeModel, GoalInfo, FailHandlingCode, !CI) :-
+handle_failure(CodeModel, GoalInfo, FailHandlingCode, !CI) :-
( CodeModel = model_semi ->
goal_info_get_determinism(GoalInfo, Detism),
( Detism = detism_failure ->
@@ -408,11 +401,11 @@
FailHandlingCode = empty
).
-:- pred call_gen.call_comment(code_model::in, string::out) is det.
+:- pred call_comment(code_model::in, string::out) is det.
-call_gen.call_comment(model_det, "branch to det procedure").
-call_gen.call_comment(model_semi, "branch to semidet procedure").
-call_gen.call_comment(model_non, "branch to nondet procedure").
+call_comment(model_det, "branch to det procedure").
+call_comment(model_semi, "branch to semidet procedure").
+call_comment(model_non, "branch to nondet procedure").
%---------------------------------------------------------------------------%
@@ -435,23 +428,22 @@
% It may contain the input arguments as well; kill_dead_input_vars
% and handle_return ignore them.
%
-:- pred call_gen.kill_dead_input_vars(assoc_list(prog_var, arg_info)::in,
+:- pred kill_dead_input_vars(assoc_list(prog_var, arg_info)::in,
hlds_goal_info::in, set(prog_var)::out,
code_info::in, code_info::out) is det.
-call_gen.kill_dead_input_vars(ArgsInfos, GoalInfo, NonLiveOutputs, !CI) :-
+kill_dead_input_vars(ArgsInfos, GoalInfo, NonLiveOutputs, !CI) :-
code_info.get_forward_live_vars(!.CI, Liveness),
- call_gen.find_nonlive_outputs(ArgsInfos, Liveness,
- set.init, NonLiveOutputs),
+ find_nonlive_outputs(ArgsInfos, Liveness, set.init, NonLiveOutputs),
goal_info_get_post_deaths(GoalInfo, PostDeaths),
set.difference(PostDeaths, NonLiveOutputs, ImmediatePostDeaths),
code_info.make_vars_forward_dead(ImmediatePostDeaths, !CI).
-:- pred call_gen.handle_return(assoc_list(prog_var, arg_info)::in,
+:- pred handle_return(assoc_list(prog_var, arg_info)::in,
hlds_goal_info::in, set(prog_var)::in, instmap::in,
list(liveinfo)::out, code_info::in, code_info::out) is det.
-call_gen.handle_return(ArgsInfos, GoalInfo, _NonLiveOutputs, ReturnInstMap,
+handle_return(ArgsInfos, GoalInfo, _NonLiveOutputs, ReturnInstMap,
ReturnLiveLvalues, !CI) :-
goal_info_get_instmap_delta(GoalInfo, InstMapDelta),
( instmap_delta_is_reachable(InstMapDelta) ->
@@ -461,15 +453,15 @@
),
code_info.clear_all_registers(OkToDeleteAny, !CI),
code_info.get_forward_live_vars(!.CI, Liveness),
- call_gen.rebuild_registers(ArgsInfos, Liveness, OutputArgLocs, !CI),
+ rebuild_registers(ArgsInfos, Liveness, OutputArgLocs, !CI),
code_info.generate_return_live_lvalues(!.CI, OutputArgLocs,
ReturnInstMap, OkToDeleteAny, ReturnLiveLvalues).
-:- pred call_gen.find_nonlive_outputs(assoc_list(prog_var, arg_info)::in,
+:- pred find_nonlive_outputs(assoc_list(prog_var, arg_info)::in,
set(prog_var)::in, set(prog_var)::in, set(prog_var)::out) is det.
-call_gen.find_nonlive_outputs([], _, NonLiveOutputs, NonLiveOutputs).
-call_gen.find_nonlive_outputs([Var - arg_info(_ArgLoc, Mode) | Args],
+find_nonlive_outputs([], _, NonLiveOutputs, NonLiveOutputs).
+find_nonlive_outputs([Var - arg_info(_ArgLoc, Mode) | Args],
Liveness, NonLiveOutputs0, NonLiveOutputs) :-
( Mode = top_out ->
( set.member(Var, Liveness) ->
@@ -480,17 +472,16 @@
;
NonLiveOutputs1 = NonLiveOutputs0
),
- call_gen.find_nonlive_outputs(Args, Liveness,
- NonLiveOutputs1, NonLiveOutputs).
+ find_nonlive_outputs(Args, Liveness, NonLiveOutputs1, NonLiveOutputs).
-:- pred call_gen.rebuild_registers(assoc_list(prog_var, arg_info)::in,
+:- pred rebuild_registers(assoc_list(prog_var, arg_info)::in,
set(prog_var)::in, assoc_list(prog_var, arg_loc)::out,
code_info::in, code_info::out) is det.
-call_gen.rebuild_registers([], _, [], !CI).
-call_gen.rebuild_registers([Var - arg_info(ArgLoc, Mode) | Args], Liveness,
+rebuild_registers([], _, [], !CI).
+rebuild_registers([Var - arg_info(ArgLoc, Mode) | Args], Liveness,
OutputArgLocs, !CI) :-
- call_gen.rebuild_registers(Args, Liveness, OutputArgLocs1, !CI),
+ rebuild_registers(Args, Liveness, OutputArgLocs1, !CI),
(
Mode = top_out,
set.member(Var, Liveness)
@@ -504,7 +495,7 @@
%---------------------------------------------------------------------------%
-call_gen.generate_builtin(CodeModel, PredId, ProcId, Args, Code, !CI) :-
+generate_builtin(CodeModel, PredId, ProcId, Args, Code, !CI) :-
code_info.get_module_info(!.CI, ModuleInfo),
ModuleName = predicate_module(ModuleInfo, PredId),
PredName = predicate_name(ModuleInfo, PredId),
@@ -523,7 +514,7 @@
CodeModel = model_det,
(
SimpleCode = assign(Var, AssignExpr),
- call_gen.generate_assign_builtin(Var, AssignExpr, Code, !CI)
+ generate_assign_builtin(Var, AssignExpr, Code, !CI)
;
SimpleCode = ref_assign(AddrVar, ValueVar),
produce_variable(AddrVar, AddrVarCode, AddrRval, !CI),
@@ -532,33 +523,38 @@
Code = tree_list([AddrVarCode, ValueVarCode, StoreCode])
;
SimpleCode = test(_),
- unexpected(this_file, "malformed det builtin predicate")
+ unexpected(this_file, "malformed model_det builtin predicate")
+ ;
+ SimpleCode = noop(DefinedVars),
+ list.foldl(magically_put_var_in_unused_reg, DefinedVars, !CI),
+ Code = node([])
)
;
CodeModel = model_semi,
(
SimpleCode = test(TestExpr),
- call_gen.generate_simple_test(TestExpr, Rval,
- ArgCode, !CI),
+ generate_simple_test(TestExpr, Rval, ArgCode, !CI),
code_info.fail_if_rval_is_false(Rval, TestCode, !CI),
Code = tree(ArgCode, TestCode)
;
SimpleCode = assign(_, _),
- unexpected(this_file, "malformed semi builtin predicate")
+ unexpected(this_file, "malformed model_semi builtin predicate")
;
SimpleCode = ref_assign(_, _),
- unexpected(this_file, "malformed semi builtin predicate")
+ unexpected(this_file, "malformed model_semi builtin predicate")
+ ;
+ SimpleCode = noop(_),
+ unexpected(this_file, "malformed model_semi builtin predicate")
)
;
CodeModel = model_non,
- unexpected(this_file, "nondet builtin predicate")
+ unexpected(this_file, "model_non builtin predicate")
).
-:- pred call_gen.generate_assign_builtin(prog_var::in,
- simple_expr(prog_var)::in, code_tree::out,
- code_info::in, code_info::out) is det.
+:- pred generate_assign_builtin(prog_var::in, simple_expr(prog_var)::in,
+ code_tree::out, code_info::in, code_info::out) is det.
-call_gen.generate_assign_builtin(Var, AssignExpr, Code, !CI) :-
+generate_assign_builtin(Var, AssignExpr, Code, !CI) :-
( code_info.variable_is_forward_live(!.CI, Var) ->
Rval = convert_simple_expr(AssignExpr),
code_info.assign_expr_to_var(Var, Rval, Code, !CI)
@@ -576,30 +572,29 @@
convert_simple_expr(binary(BinOp, Expr1, Expr2)) =
binop(BinOp, convert_simple_expr(Expr1), convert_simple_expr(Expr2)).
-:- pred call_gen.generate_simple_test(
- simple_expr(prog_var)::in(simple_test_expr), rval::out,
- code_tree::out, code_info::in, code_info::out) is det.
+:- pred generate_simple_test(simple_expr(prog_var)::in(simple_test_expr),
+ rval::out, code_tree::out, code_info::in, code_info::out) is det.
-call_gen.generate_simple_test(TestExpr, Rval, ArgCode, !CI) :-
+generate_simple_test(TestExpr, Rval, ArgCode, !CI) :-
(
TestExpr = binary(BinOp, X0, Y0),
X1 = convert_simple_expr(X0),
Y1 = convert_simple_expr(Y0),
- call_gen.generate_builtin_arg(X1, X, CodeX, !CI),
- call_gen.generate_builtin_arg(Y1, Y, CodeY, !CI),
+ generate_builtin_arg(X1, X, CodeX, !CI),
+ generate_builtin_arg(Y1, Y, CodeY, !CI),
Rval = binop(BinOp, X, Y),
ArgCode = tree(CodeX, CodeY)
;
TestExpr = unary(UnOp, X0),
X1 = convert_simple_expr(X0),
- call_gen.generate_builtin_arg(X1, X, ArgCode, !CI),
+ generate_builtin_arg(X1, X, ArgCode, !CI),
Rval = unop(UnOp, X)
).
-:- pred call_gen.generate_builtin_arg(rval::in, rval::out, code_tree::out,
+:- pred generate_builtin_arg(rval::in, rval::out, code_tree::out,
code_info::in, code_info::out) is det.
-call_gen.generate_builtin_arg(Rval0, Rval, Code, !CI) :-
+generate_builtin_arg(Rval0, Rval, Code, !CI) :-
( Rval0 = var(Var) ->
code_info.produce_variable(Var, Code, Rval, !CI)
;
@@ -610,18 +605,18 @@
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
-call_gen.input_arg_locs([], []).
-call_gen.input_arg_locs([Var - arg_info(Loc, Mode) | Args], Vs) :-
- call_gen.input_arg_locs(Args, Vs0),
+input_arg_locs([], []).
+input_arg_locs([Var - arg_info(Loc, Mode) | Args], Vs) :-
+ input_arg_locs(Args, Vs0),
( Mode = top_in ->
Vs = [Var - Loc | Vs0]
;
Vs = Vs0
).
-call_gen.output_arg_locs([], []).
-call_gen.output_arg_locs([Var - arg_info(Loc, Mode) | Args], Vs) :-
- call_gen.output_arg_locs(Args, Vs0),
+output_arg_locs([], []).
+output_arg_locs([Var - arg_info(Loc, Mode) | Args], Vs) :-
+ output_arg_locs(Args, Vs0),
( Mode = top_out ->
Vs = [Var - Loc | Vs0]
;
@@ -630,11 +625,10 @@
%---------------------------------------------------------------------------%
-:- pred call_gen.generate_call_vn_livevals(list(arg_loc)::in,
- set(prog_var)::in, code_tree::out,
- code_info::in, code_info::out) is det.
+:- pred generate_call_vn_livevals(list(arg_loc)::in, set(prog_var)::in,
+ code_tree::out, code_info::in, code_info::out) is det.
-call_gen.generate_call_vn_livevals(InputArgLocs, OutputArgs, Code, !CI) :-
+generate_call_vn_livevals(InputArgLocs, OutputArgs, Code, !CI) :-
code_info.generate_call_vn_livevals(!.CI, InputArgLocs, OutputArgs,
LiveVals),
Code = node([
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.324
diff -u -b -r1.324 code_info.m
--- compiler/code_info.m 27 Jul 2006 05:00:58 -0000 1.324
+++ compiler/code_info.m 30 Jul 2006 08:36:11 -0000
@@ -3133,7 +3133,9 @@
:- pred clear_r1(code_tree::out, code_info::in, code_info::out) is det.
-:- type call_direction ---> caller ; callee.
+:- type call_direction
+ ---> caller
+ ; callee.
% Move variables to where they need to be at the time of the call:
%
@@ -3179,6 +3181,9 @@
:- pred max_reg_in_use(code_info::in, int::out) is det.
+:- pred magically_put_var_in_unused_reg(prog_var::in,
+ code_info::in, code_info::out) is det.
+
%---------------------------------------------------------------------------%
:- implementation.
@@ -3556,6 +3561,11 @@
get_var_locn_info(CI, VarLocnInfo),
var_locn.max_reg_in_use(VarLocnInfo, Max).
+magically_put_var_in_unused_reg(Var, !CI) :-
+ get_var_locn_info(!.CI, VarLocnInfo0),
+ make_vars_forward_live_2([Var], map.init, 1, VarLocnInfo0, VarLocnInfo),
+ set_var_locn_info(VarLocnInfo, !CI).
+
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
Index: compiler/ml_call_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_call_gen.m,v
retrieving revision 1.70
diff -u -b -r1.70 ml_call_gen.m
--- compiler/ml_call_gen.m 28 Jul 2006 05:08:10 -0000 1.70
+++ compiler/ml_call_gen.m 30 Jul 2006 08:24:39 -0000
@@ -927,7 +927,10 @@
)
;
SimpleCode = test(_),
- unexpected(this_file, "malformed det builtin predicate")
+ unexpected(this_file, "malformed model_det builtin predicate")
+ ;
+ SimpleCode = noop(_),
+ Statements = []
)
;
CodeModel = model_semi,
@@ -938,14 +941,17 @@
Statements = [Statement]
;
SimpleCode = ref_assign(_, _),
- unexpected(this_file, "malformed semi builtin predicate")
+ unexpected(this_file, "malformed model_semi builtin predicate")
;
SimpleCode = assign(_, _),
- unexpected(this_file, "malformed semi builtin predicate")
+ unexpected(this_file, "malformed model_semi builtin predicate")
+ ;
+ SimpleCode = noop(_),
+ unexpected(this_file, "malformed model_semi builtin predicate")
)
;
CodeModel = model_non,
- unexpected(this_file, "nondet builtin predicate")
+ unexpected(this_file, "model_non builtin predicate")
),
Decls = [].
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
Index: library/private_builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.159
diff -u -b -r1.159 private_builtin.m
--- library/private_builtin.m 27 Jul 2006 05:03:39 -0000 1.159
+++ library/private_builtin.m 30 Jul 2006 09:22:34 -0000
@@ -1539,31 +1539,11 @@
:- interface.
-:- import_module io.
-
-:- impure pred trace_get_io_state(io::uo) is det.
-
-:- impure pred trace_set_io_state(io::di) is det.
-
:- semipure pred trace_evaluate_runtime_condition is semidet.
:- implementation.
:- pragma foreign_proc("C",
- trace_get_io_state(IO::uo),
- [will_not_call_mercury, thread_safe],
-"
- /* mention IO to shut up warning */
-").
-
-:- pragma foreign_proc("C",
- trace_set_io_state(IO::di),
- [will_not_call_mercury, thread_safe],
-"
- /* mention IO to shut up warning */
-").
-
-:- pragma foreign_proc("C",
trace_evaluate_runtime_condition,
[will_not_call_mercury, thread_safe, promise_semipure],
"
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list