[m-rev.] diff: (mostly) mlds function symbol renames
Zoltan Somogyi
zs at csse.unimelb.edu.au
Fri Jul 28 15:06:51 AEST 2006
This diff contains no algorithmic changes.
compiler/llds.m:
compiler/mlds.m:
Rename some function symbols and field names to avoid ambiguities
with respect to language keywords.
compiler/*.m:
Conform to the changes in llds.m and mlds.m.
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/call_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/call_gen.m,v
retrieving revision 1.177
diff -u -b -r1.177 call_gen.m
--- compiler/call_gen.m 27 Jul 2006 05:00:57 -0000 1.177
+++ compiler/call_gen.m 28 Jul 2006 02:25:02 -0000
@@ -118,7 +118,7 @@
goal_info_get_goal_path(GoalInfo, GoalPath),
CallCode = node([
livevals(LiveVals) - "",
- call(Address, label(ReturnLabel), ReturnLiveLvalues, Context,
+ llcall(Address, label(ReturnLabel), ReturnLiveLvalues, Context,
GoalPath, CallModel) - CallComment,
label(ReturnLabel) - "continuation label"
]),
@@ -233,7 +233,7 @@
CallCode = node([
livevals(LiveVals) - "",
- call(CodeAddr, label(ReturnLabel), ReturnLiveLvalues,
+ llcall(CodeAddr, label(ReturnLabel), ReturnLiveLvalues,
Context, GoalPath, CallModel) - "Setup and call",
label(ReturnLabel) - "Continuation label"
]),
Index: compiler/continuation_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/continuation_info.m,v
retrieving revision 1.75
diff -u -b -r1.75 continuation_info.m
--- compiler/continuation_info.m 27 Jul 2006 05:01:00 -0000 1.75
+++ compiler/continuation_info.m 28 Jul 2006 02:25:09 -0000
@@ -426,7 +426,7 @@
global_data_get_proc_layout(!.GlobalData, PredProcId, ProcLayoutInfo0),
Internals0 = ProcLayoutInfo0^internal_map,
GetCallInfo = (pred(Instr::in, Call::out) is semidet :-
- Instr = call(Target, label(ReturnLabel), LiveInfo, Context,
+ Instr = llcall(Target, label(ReturnLabel), LiveInfo, Context,
GoalPath, _) - _Comment,
Call = call_info(ReturnLabel, Target, LiveInfo, Context, GoalPath)
),
Index: compiler/dupelim.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dupelim.m,v
retrieving revision 1.80
diff -u -b -r1.80 dupelim.m
--- compiler/dupelim.m 27 Jul 2006 05:01:02 -0000 1.80
+++ compiler/dupelim.m 28 Jul 2006 02:25:31 -0000
@@ -336,7 +336,7 @@
standardize_rval(Rval1, Rval),
Instr = assign(Lval, Rval)
;
- Instr1 = call(_, _, _, _, _, _),
+ Instr1 = llcall(_, _, _, _, _, _),
Instr = Instr1
;
Instr1 = mkframe(_, _),
@@ -351,7 +351,7 @@
Instr1 = computed_goto(_, _),
Instr = Instr1
;
- Instr1 = c_code(_, _),
+ Instr1 = arbitrary_c_code(_, _),
Instr = Instr1
;
Instr1 = if_val(Rval1, CodeAddr),
@@ -716,12 +716,12 @@
;
( Instr1 = livevals(_)
; Instr1 = block(_, _, _)
- ; Instr1 = call(_, _, _, _, _, _)
+ ; Instr1 = llcall(_, _, _, _, _, _)
; Instr1 = mkframe(_, _)
; Instr1 = label(_)
; Instr1 = goto(_)
; Instr1 = computed_goto(_, _)
- ; Instr1 = c_code(_, _)
+ ; Instr1 = arbitrary_c_code(_, _)
; Instr1 = save_maxfr(_)
; Instr1 = restore_maxfr(_)
; Instr1 = discard_ticket
Index: compiler/dupproc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dupproc.m,v
retrieving revision 1.9
diff -u -b -r1.9 dupproc.m
--- compiler/dupproc.m 29 Mar 2006 08:06:43 -0000 1.9
+++ compiler/dupproc.m 28 Jul 2006 03:07:39 -0000
@@ -144,7 +144,7 @@
(
Instr = if_val(_, _)
;
- Instr = call(_, _, _, _, _, _)
+ Instr = llcall(_, _, _, _, _, _)
).
%-----------------------------------------------------------------------------%
@@ -185,10 +185,11 @@
standardize_rval(Rval, StdRval, DupProcMap),
StdInstr = assign(Lval, StdRval)
;
- Instr = call(Target, Cont, LiveInfo, Context, GoalPath, Model),
+ Instr = llcall(Target, Cont, LiveInfo, Context, GoalPath, Model),
standardize_code_addr(Target, StdTarget, DupProcMap),
standardize_code_addr(Cont, StdCont, DupProcMap),
- StdInstr = call(StdTarget, StdCont, LiveInfo, Context, GoalPath, Model)
+ StdInstr = llcall(StdTarget, StdCont, LiveInfo, Context, GoalPath,
+ Model)
;
Instr = mkframe(FrameInfo, MaybeCodeAddr),
(
@@ -214,7 +215,7 @@
standardize_labels(Targets, StdTargets, DupProcMap),
StdInstr = computed_goto(Rval, StdTargets)
;
- Instr = c_code(_, _),
+ Instr = arbitrary_c_code(_, _),
StdInstr = Instr
;
Instr = save_maxfr(_),
Index: compiler/exprn_aux.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/exprn_aux.m,v
retrieving revision 1.71
diff -u -b -r1.71 exprn_aux.m
--- compiler/exprn_aux.m 27 Jul 2006 05:01:03 -0000 1.71
+++ compiler/exprn_aux.m 28 Jul 2006 02:27:49 -0000
@@ -331,7 +331,18 @@
substitute_lval_in_uinstr(OldLval, NewLval, Uinstr0, Uinstr, !N) :-
(
- Uinstr0 = comment(_Comment),
+ ( Uinstr0 = comment(_Comment)
+ ; Uinstr0 = llcall(_, _, _, _, _, _)
+ ; Uinstr0 = mkframe(_, _)
+ ; Uinstr0 = label(_)
+ ; Uinstr0 = goto(_)
+ ; Uinstr0 = prune_ticket
+ ; Uinstr0 = discard_ticket
+ ; Uinstr0 = incr_sp(_, _)
+ ; Uinstr0 = decr_sp(_)
+ ; Uinstr0 = decr_sp_and_return(_)
+ ; Uinstr0 = fork(_, _, _)
+ ),
Uinstr = Uinstr0
;
Uinstr0 = livevals(LvalSet0),
@@ -351,26 +362,14 @@
substitute_lval_in_rval_count(OldLval, NewLval, Rval0, Rval, !N),
Uinstr = assign(Lval, Rval)
;
- Uinstr0 = call(_, _, _, _, _, _),
- Uinstr = Uinstr0
- ;
- Uinstr0 = mkframe(_, _),
- Uinstr = Uinstr0
- ;
- Uinstr0 = label(_),
- Uinstr = Uinstr0
- ;
- Uinstr0 = goto(_),
- Uinstr = Uinstr0
- ;
Uinstr0 = computed_goto(Rval0, Labels),
substitute_lval_in_rval_count(OldLval, NewLval, Rval0, Rval, !N),
Uinstr = computed_goto(Rval, Labels)
;
- Uinstr0 = c_code(Code, LiveLvals0),
+ Uinstr0 = arbitrary_c_code(Code, LiveLvals0),
substitute_lval_in_live_lval_info(OldLval, NewLval,
LiveLvals0, LiveLvals, !N),
- Uinstr = c_code(Code, LiveLvals)
+ Uinstr = arbitrary_c_code(Code, LiveLvals)
;
Uinstr0 = if_val(Rval0, CodeAddr),
substitute_lval_in_rval_count(OldLval, NewLval, Rval0, Rval, !N),
@@ -409,12 +408,6 @@
substitute_lval_in_rval_count(OldLval, NewLval, Rval0, Rval, !N),
Uinstr = reset_ticket(Rval, Reason)
;
- Uinstr0 = prune_ticket,
- Uinstr = Uinstr0
- ;
- Uinstr0 = discard_ticket,
- Uinstr = Uinstr0
- ;
Uinstr0 = mark_ticket_stack(Lval0),
substitute_lval_in_lval_count(OldLval, NewLval, Lval0, Lval, !N),
Uinstr = mark_ticket_stack(Lval)
@@ -428,15 +421,6 @@
% substitute_lval_in_rval(OldLval, NewLval, Rval0, Rval, !N),
% Uinstr = discard_tickets_to(Rval)
;
- Uinstr0 = incr_sp(_, _),
- Uinstr = Uinstr0
- ;
- Uinstr0 = decr_sp(_),
- Uinstr = Uinstr0
- ;
- Uinstr0 = decr_sp_and_return(_),
- Uinstr = Uinstr0
- ;
Uinstr0 = pragma_c(Decls, Components0, MayCallMercury,
MaybeLabel1, MaybeLabel2, MaybeLabel3, MaybeLabel4,
ReferStackSlot, MayDupl),
@@ -450,9 +434,6 @@
substitute_lval_in_lval_count(OldLval, NewLval, Lval0, Lval, !N),
Uinstr = init_sync_term(Lval, BranchCount)
;
- Uinstr0 = fork(_, _, _),
- Uinstr = Uinstr0
- ;
Uinstr0 = join_and_terminate(Lval0),
substitute_lval_in_lval_count(OldLval, NewLval, Lval0, Lval, !N),
Uinstr = join_and_terminate(Lval)
Index: compiler/frameopt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/frameopt.m,v
retrieving revision 1.100
diff -u -b -r1.100 frameopt.m
--- compiler/frameopt.m 26 Apr 2006 03:05:33 -0000 1.100
+++ compiler/frameopt.m 28 Jul 2006 02:28:12 -0000
@@ -345,7 +345,7 @@
(
% Look for nondet style tailcalls which do not need
% a runtime check.
- Uinstr0 = call(label(entry(_, ProcLabel)), label(RetLabel),
+ Uinstr0 = llcall(label(entry(_, ProcLabel)), label(RetLabel),
_, _, _, CallModel),
CallModel = call_model_nondet(unchecked_tail_call),
map.search(SuccMap, RetLabel, BetweenIncl),
@@ -1081,11 +1081,11 @@
list.member(Instr, Instrs),
Instr = Uinstr - _,
(
- Uinstr = call(_, _, _, _, _, _)
+ Uinstr = llcall(_, _, _, _, _, _)
;
Uinstr = mkframe(_, _)
;
- Uinstr = c_code(_, _)
+ Uinstr = arbitrary_c_code(_, _)
;
Uinstr = pragma_c(_, _, MayCallMercury, _, MaybeLayout,
MaybeOnlyLayout, _, NeedStack, _),
@@ -1338,7 +1338,7 @@
list.member(Instr, Instrs),
Instr = Uinstr - _,
(
- Uinstr = call(_, _, _, _, _, _)
+ Uinstr = llcall(_, _, _, _, _, _)
;
% Only may_call_mercury pragma_c's can clobber succip.
Uinstr = pragma_c(_, _, may_call_mercury,
Index: compiler/jumpopt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/jumpopt.m,v
retrieving revision 1.89
diff -u -b -r1.89 jumpopt.m
--- compiler/jumpopt.m 27 Jul 2006 05:01:09 -0000 1.89
+++ compiler/jumpopt.m 28 Jul 2006 02:30:20 -0000
@@ -289,7 +289,8 @@
% know that rvals representing e.g. the tags of fields cannot contain
% labels.
(
- Uinstr0 = call(Proc, RetAddr, LiveInfos, Context, GoalPath, CallModel),
+ Uinstr0 = llcall(Proc, RetAddr, LiveInfos, Context, GoalPath,
+ CallModel),
( RetAddr = label(RetLabel) ->
(
% Look for det style tailcalls. We look for this even if
@@ -380,7 +381,7 @@
( RetLabel = DestLabel ->
NewInstrs = [Instr0]
;
- NewInstrs = [call(Proc, label(DestLabel), LiveInfos,
+ NewInstrs = [llcall(Proc, label(DestLabel), LiveInfos,
Context, GoalPath, CallModel)
- redirect_comment(Comment0)]
),
@@ -750,68 +751,11 @@
)
)
;
- Uinstr0 = c_code(_, _),
- NewRemain = usual_case
- ;
- Uinstr0 = comment(_),
- NewRemain = usual_case
- ;
- Uinstr0 = livevals(_),
- NewRemain = usual_case
- ;
Uinstr0 = block(_, _, _),
% These are supposed to be introduced only after jumpopt is run
% for the last time.
unexpected(this_file, "instr_list: block")
;
- Uinstr0 = label(_),
- NewRemain = usual_case
- ;
- Uinstr0 = save_maxfr(_),
- NewRemain = usual_case
- ;
- Uinstr0 = restore_maxfr(_),
- NewRemain = usual_case
- ;
- Uinstr0 = incr_sp(_, _),
- NewRemain = usual_case
- ;
- Uinstr0 = decr_sp(_),
- NewRemain = usual_case
- ;
- Uinstr0 = decr_sp_and_return(_),
- NewRemain = usual_case
- ;
- Uinstr0 = store_ticket(_),
- NewRemain = usual_case
- ;
- Uinstr0 = reset_ticket(_, _),
- NewRemain = usual_case
- ;
- Uinstr0 = discard_ticket,
- NewRemain = usual_case
- ;
- Uinstr0 = prune_ticket,
- NewRemain = usual_case
- ;
- Uinstr0 = prune_tickets_to(_),
- NewRemain = usual_case
- ;
- Uinstr0 = mark_ticket_stack(_),
- NewRemain = usual_case
- ;
- Uinstr0 = mark_hp(_),
- NewRemain = usual_case
- ;
- Uinstr0 = free_heap(_),
- NewRemain = usual_case
- ;
- Uinstr0 = incr_hp(_, _, _, _, _),
- NewRemain = usual_case
- ;
- Uinstr0 = restore_hp(_),
- NewRemain = usual_case
- ;
Uinstr0 = fork(Child0, Parent0, NumSlots),
short_label(Instrmap, Child0, Child),
short_label(Instrmap, Parent0, Parent),
@@ -827,9 +771,6 @@
NewRemain = specified([Instr], Instrs0)
)
;
- Uinstr0 = init_sync_term(_, _),
- NewRemain = usual_case
- ;
Uinstr0 = join_and_continue(SyncTerm, Label0),
short_label(Instrmap, Label0, Label),
( Label = Label0 ->
@@ -841,7 +782,28 @@
NewRemain = specified([Instr], Instrs0)
)
;
- Uinstr0 = join_and_terminate(_),
+ ( Uinstr0 = arbitrary_c_code(_, _)
+ ; Uinstr0 = comment(_)
+ ; Uinstr0 = livevals(_)
+ ; Uinstr0 = label(_)
+ ; Uinstr0 = save_maxfr(_)
+ ; Uinstr0 = restore_maxfr(_)
+ ; Uinstr0 = incr_sp(_, _)
+ ; Uinstr0 = decr_sp(_)
+ ; Uinstr0 = decr_sp_and_return(_)
+ ; Uinstr0 = store_ticket(_)
+ ; Uinstr0 = reset_ticket(_, _)
+ ; Uinstr0 = discard_ticket
+ ; Uinstr0 = prune_ticket
+ ; Uinstr0 = prune_tickets_to(_)
+ ; Uinstr0 = mark_ticket_stack(_)
+ ; Uinstr0 = mark_hp(_)
+ ; Uinstr0 = free_heap(_)
+ ; Uinstr0 = incr_hp(_, _, _, _, _)
+ ; Uinstr0 = restore_hp(_)
+ ; Uinstr0 = init_sync_term(_, _)
+ ; Uinstr0 = join_and_terminate(_)
+ ),
NewRemain = usual_case
),
(
Index: compiler/livemap.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/livemap.m,v
retrieving revision 1.76
diff -u -b -r1.76 livemap.m
--- compiler/livemap.m 26 Apr 2006 03:05:34 -0000 1.76
+++ compiler/livemap.m 28 Jul 2006 02:30:35 -0000
@@ -152,7 +152,7 @@
opt_util.lval_access_rvals(Lval, Rvals),
livemap.make_live_in_rvals([Rval | Rvals], !Livevals)
;
- Uinstr0 = call(_, _, _, _, _, _),
+ Uinstr0 = llcall(_, _, _, _, _, _),
livemap.look_for_livevals(!Instrs, !Livevals, "call", yes, _)
;
Uinstr0 = mkframe(_, _)
@@ -290,7 +290,7 @@
;
Uinstr0 = join_and_continue(_, _)
;
- Uinstr0 = c_code(_, LiveLvalInfo),
+ Uinstr0 = arbitrary_c_code(_, LiveLvalInfo),
livemap.build_live_lval_info(LiveLvalInfo,
!Livevals, !ContainsUserCode)
;
Index: compiler/llds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds.m,v
retrieving revision 1.334
diff -u -b -r1.334 llds.m
--- compiler/llds.m 27 Jul 2006 05:01:10 -0000 1.334
+++ compiler/llds.m 28 Jul 2006 02:21:57 -0000
@@ -252,9 +252,9 @@
% Assign the value specified by rval to the location
% specified by lval.
- ; call(code_addr, code_addr, list(liveinfo), term.context,
+ ; llcall(code_addr, code_addr, list(liveinfo), term.context,
goal_path, call_model)
- % call(Target, Continuation, _, _, _) is the same as
+ % llcall(Target, Continuation, _, _, _) is the same as
% succip = Continuation; goto(Target).
% The third argument is the live value info for the values live
% on return. The fourth argument gives the context of the call.
@@ -263,6 +263,10 @@
% The last gives the code model of the called procedure, and if
% it is model_non, says whether tail recursion elimination is
% potentially applicable to the call.
+ %
+ % The ll prefix on call is to avoid the use of the call keyword
+ % and to distinguish this function symbol from a similar one
+ % in the MLDS.
; mkframe(nondet_frame_info, maybe(code_addr))
% mkframe(NondetFrameInfo, MaybeAddr) creates a nondet stack frame.
@@ -292,7 +296,7 @@
% (rval+1)th label in the list. e.g. computed_goto(2, [A, B, C, D])
% will branch to label C.
- ; c_code(string, c_code_live_lvals)
+ ; arbitrary_c_code(string, c_code_live_lvals)
% Do whatever is specified by the string, which can be any piece
% of C code that does not have any non-local flow of control.
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.283
diff -u -b -r1.283 llds_out.m
--- compiler/llds_out.m 27 Jul 2006 05:01:11 -0000 1.283
+++ compiler/llds_out.m 28 Jul 2006 02:31:29 -0000
@@ -1768,7 +1768,7 @@
find_cont_labels([Instr - _ | Instrs], !ContLabelSet) :-
(
(
- Instr = call(_, label(ContLabel), _, _, _, _)
+ Instr = llcall(_, label(ContLabel), _, _, _, _)
;
Instr = mkframe(_, yes(label(ContLabel)))
;
@@ -1886,10 +1886,10 @@
output_instr_decls(_, assign(Lval, Rval), !DeclSet, !IO) :-
output_lval_decls(Lval, !DeclSet, !IO),
output_rval_decls(Rval, !DeclSet, !IO).
-output_instr_decls(_, call(Target, ContLabel, _, _, _, _), !DeclSet, !IO) :-
+output_instr_decls(_, llcall(Target, ContLabel, _, _, _, _), !DeclSet, !IO) :-
output_code_addr_decls(Target, !DeclSet, !IO),
output_code_addr_decls(ContLabel, !DeclSet, !IO).
-output_instr_decls(_, c_code(_, _), !DeclSet, !IO).
+output_instr_decls(_, arbitrary_c_code(_, _), !DeclSet, !IO).
output_instr_decls(_, mkframe(FrameInfo, MaybeFailureContinuation),
!DeclSet, !IO) :-
(
@@ -2239,13 +2239,13 @@
output_rval_as_type(Rval, Type, !IO),
io.write_string(";\n", !IO).
-output_instruction(call(Target, ContLabel, LiveVals, _, _, _), ProfInfo,
+output_instruction(llcall(Target, ContLabel, LiveVals, _, _, _), ProfInfo,
!IO) :-
ProfInfo = CallerLabel - _,
output_call(Target, ContLabel, CallerLabel, !IO),
output_gc_livevals(LiveVals, !IO).
-output_instruction(c_code(C_Code_String, _), _, !IO) :-
+output_instruction(arbitrary_c_code(C_Code_String, _), _, !IO) :-
io.write_string("\t", !IO),
io.write_string(C_Code_String, !IO).
Index: compiler/middle_rec.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/middle_rec.m,v
retrieving revision 1.119
diff -u -b -r1.119 middle_rec.m
--- compiler/middle_rec.m 27 Jul 2006 05:01:13 -0000 1.119
+++ compiler/middle_rec.m 28 Jul 2006 02:31:48 -0000
@@ -423,7 +423,7 @@
split_rec_code([], _, _) :-
unexpected(this_file, "did not find call in split_rec_code").
split_rec_code([Instr0 | Instrs1], Before, After) :-
- ( Instr0 = call(_, _, _, _, _, _) - _ ->
+ ( Instr0 = llcall(_, _, _, _, _, _) - _ ->
(
opt_util.skip_comments(Instrs1, Instrs2),
Instrs2 = [Instr2 | Instrs3],
@@ -496,13 +496,13 @@
find_used_registers_instr(assign(Lval, Rval), !Used) :-
find_used_registers_lval(Lval, !Used),
find_used_registers_rval(Rval, !Used).
-find_used_registers_instr(call(_, _, _, _, _, _), !Used).
+find_used_registers_instr(llcall(_, _, _, _, _, _), !Used).
find_used_registers_instr(mkframe(_, _), !Used).
find_used_registers_instr(label(_), !Used).
find_used_registers_instr(goto(_), !Used).
find_used_registers_instr(computed_goto(Rval, _), !Used) :-
find_used_registers_rval(Rval, !Used).
-find_used_registers_instr(c_code(_, _), !Used).
+find_used_registers_instr(arbitrary_c_code(_, _), !Used).
find_used_registers_instr(if_val(Rval, _), !Used) :-
find_used_registers_rval(Rval, !Used).
find_used_registers_instr(save_maxfr(Lval), !Used) :-
Index: compiler/ml_call_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_call_gen.m,v
retrieving revision 1.69
diff -u -b -r1.69 ml_call_gen.m
--- compiler/ml_call_gen.m 12 Jul 2006 02:51:03 -0000 1.69
+++ compiler/ml_call_gen.m 28 Jul 2006 02:35:57 -0000
@@ -189,7 +189,8 @@
% `closure_arg'.
GC_TraceCode = no,
ClosureArgType = mlds_generic_type,
- ClosureArg = mlds_argument(data(var(mlds_var_name("closure_arg", no))),
+ ClosureArg =
+ mlds_argument(entity_data(var(mlds_var_name("closure_arg", no))),
ClosureArgType, GC_TraceCode),
Params0 = mlds_func_params(ArgParams0, RetParam),
Params = mlds_func_params([ClosureArg | ArgParams0], RetParam),
@@ -478,7 +479,8 @@
;
CallKind = ordinary_call
),
- Stmt = call(Signature, FuncRval, ObjectRval, ArgRvals, RetLvals, CallKind),
+ Stmt = mlcall(Signature, FuncRval, ObjectRval, ArgRvals, RetLvals,
+ CallKind),
Statement = statement(Stmt, mlds_make_context(Context)),
Statements = [Statement].
@@ -555,7 +557,8 @@
% So here we just leave it blank. The caller of ml_gen_cont_param has the
% reponsibility of fillling this in properly if needed.
Maybe_GC_TraceCode = no,
- Argument = mlds_argument(data(var(ArgName)), Type, Maybe_GC_TraceCode),
+ Argument =
+ mlds_argument(entity_data(var(ArgName)), Type, Maybe_GC_TraceCode),
ml_gen_cont_params_2(Types, ArgNum + 1, Arguments).
:- pred ml_gen_copy_args_to_locals(ml_gen_info::in, list(mlds_lval)::in,
Index: compiler/ml_closure_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_closure_gen.m,v
retrieving revision 1.43
diff -u -b -r1.43 ml_closure_gen.m
--- compiler/ml_closure_gen.m 8 Jun 2006 08:19:19 -0000 1.43
+++ compiler/ml_closure_gen.m 28 Jul 2006 02:37:09 -0000
@@ -726,7 +726,7 @@
gen_closure_gc_trace_code(ClosureArgName, ClosureArgDeclType,
ClosureKind, WrapperArgTypes, Purity, PredOrFunc,
Context, ClosureArgGCTraceCode, !Info),
- ClosureArg = mlds_argument(data(var(ClosureArgName)),
+ ClosureArg = mlds_argument(entity_data(var(ClosureArgName)),
ClosureArgType, ClosureArgGCTraceCode),
MaybeClosureA = yes({ClosureArgType, ClosureArgName}),
WrapperArgs = [ClosureArg | WrapperArgs1]
Index: compiler/ml_code_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_code_gen.m,v
retrieving revision 1.180
diff -u -b -r1.180 ml_code_gen.m
--- compiler/ml_code_gen.m 27 Jul 2006 05:01:13 -0000 1.180
+++ compiler/ml_code_gen.m 28 Jul 2006 02:39:19 -0000
@@ -1299,7 +1299,7 @@
MLDS_Type = mlds_tabling_type(Id),
Flags = tabling_data_decl_flags(Constness),
DefnBody = mlds_data(MLDS_Type, Initializer, GC_TraceCode),
- Name = data(mlds_tabling_ref(ProcLabel, Id)),
+ Name = entity_data(mlds_tabling_ref(ProcLabel, Id)),
Defn = mlds_defn(Name, MLDS_Context, Flags, DefnBody).
% Return the declaration flags appropriate for a tabling data structure.
@@ -1375,7 +1375,7 @@
% definition, making sure that the function is declared as `extern'
% rather than `static'.
%
- FunctionBody = external,
+ FunctionBody = body_external,
ExtraDefns = [],
ml_gen_proc_params(PredId, ProcId, MLDS_Params, !.Info, _Info)
;
@@ -1425,7 +1425,7 @@
ml_gen_info_get_extra_defns(!.Info, ExtraDefns),
Decls = list.append(MLDS_LocalVars, Decls0),
Statement = ml_gen_block(Decls, Statements, Context),
- FunctionBody = defined_here(Statement)
+ FunctionBody = body_defined_here(Statement)
)
),
@@ -1780,7 +1780,7 @@
% <do Goal>
% succeeded = MR_TRUE
%
- ml_gen_set_success(!.Info, const(true), Context, SetSuccessTrue),
+ ml_gen_set_success(!.Info, const(true_const), Context, SetSuccessTrue),
!:Statements = !.Statements ++ [SetSuccessTrue].
ml_gen_wrap_goal(model_non, model_det, Context, !Statements, !Info) :-
@@ -1905,8 +1905,10 @@
GoalStatement = ml_gen_block(GoalOtherDecls, GoalStatements,
GoalContext),
ml_gen_info_pop_success_cont(!Info),
- ml_gen_set_success(!.Info, const(false), Context, SetSuccessFalse),
- ml_gen_set_success(!.Info, const(true), Context, SetSuccessTrue),
+ ml_gen_set_success(!.Info, const(false_const), Context,
+ SetSuccessFalse),
+ ml_gen_set_success(!.Info, const(true_const), Context,
+ SetSuccessTrue),
TryCommitStmt = try_commit(CommitRefLval,
ml_gen_block([], [GoalStatement, SetSuccessFalse], Context),
ml_gen_block([], list.append(CopyLocalsToOutputArgs,
@@ -2063,7 +2065,7 @@
RetTypes = [],
Signature = mlds_func_signature(ArgTypes, RetTypes),
CallKind = ordinary_call,
- CallStmt = call(Signature, CommitFuncLabelRval, no, ArgRvals, [],
+ CallStmt = mlcall(Signature, CommitFuncLabelRval, no, ArgRvals, [],
CallKind),
CallStatement = statement(CallStmt, mlds_make_context(Context)),
% Package it all up.
@@ -3506,7 +3508,7 @@
ml_gen_info_new_cond_var(CondVar, !Info),
MLDS_Context = mlds_make_context(Context),
CondVarDecl = ml_gen_cond_var_decl(CondVar, MLDS_Context),
- ml_gen_set_cond_var(!.Info, CondVar, const(false), Context,
+ ml_gen_set_cond_var(!.Info, CondVar, const(false_const), Context,
SetCondFalse),
% Allocate a name for the `then_func'.
@@ -3523,7 +3525,7 @@
% push nesting level
Then = _ - ThenGoalInfo,
goal_info_get_context(ThenGoalInfo, ThenContext),
- ml_gen_set_cond_var(!.Info, CondVar, const(true), ThenContext,
+ ml_gen_set_cond_var(!.Info, CondVar, const(true_const), ThenContext,
SetCondTrue),
ml_gen_goal(CodeModel, Then, ThenStatement, !Info),
ThenFuncBody = ml_gen_block([], [SetCondTrue, ThenStatement],
@@ -3578,7 +3580,8 @@
CodeModel = model_semi, CondCodeModel = model_det,
ml_gen_goal(model_det, Cond, CondDecls, CondStatements, !Info),
- ml_gen_set_success(!.Info, const(false), Context, SetSuccessFalse),
+ ml_gen_set_success(!.Info, const(false_const), Context,
+ SetSuccessFalse),
Decls = CondDecls,
Statements = list.append(CondStatements, [SetSuccessFalse])
;
Index: compiler/ml_code_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_code_util.m,v
retrieving revision 1.110
diff -u -b -r1.110 ml_code_util.m
--- compiler/ml_code_util.m 12 Jul 2006 02:51:03 -0000 1.110
+++ compiler/ml_code_util.m 28 Jul 2006 03:19:49 -0000
@@ -907,7 +907,7 @@
ml_decl_is_static_const(Defn) :-
Defn = mlds_defn(Name, _Context, Flags, _DefnBody),
- Name = data(_),
+ Name = entity_data(_),
Flags = ml_static_const_decl_flags.
ml_gen_nondet_label_func(Info, FuncLabel, Context, Statement, Func) :-
@@ -934,7 +934,7 @@
MaybePredProcId = no,
Attributes = [],
FuncDefn = mlds_function(MaybePredProcId, FuncParams,
- defined_here(Statement), Attributes),
+ body_defined_here(Statement), Attributes),
Func = mlds_defn(FuncName, mlds_make_context(Context), DeclFlags,
FuncDefn).
@@ -959,9 +959,9 @@
%
ml_gen_and(X, Y) =
- ( X = const(true) ->
+ ( X = const(true_const) ->
Y
- ; Y = const(true) ->
+ ; Y = const(true_const) ->
X
;
binop(logical_and, X, Y)
@@ -1119,13 +1119,13 @@
ContType = mlds_cont_type([]),
RetTypes = RetTypes0
),
- ContName = data(var(mlds_var_name("cont", no))),
+ ContName = entity_data(var(mlds_var_name("cont", no))),
% The cont variable always points to code, not to the heap,
% so the GC never needs to trace it.
ContGCTraceCode = no,
ContArg = mlds_argument(ContName, ContType, ContGCTraceCode),
ContEnvType = mlds_generic_env_ptr_type,
- ContEnvName = data(var(mlds_var_name("cont_env_ptr", no))),
+ ContEnvName = entity_data(var(mlds_var_name("cont_env_ptr", no))),
% The cont_env_ptr always points to the stack, since continuation
% environments are always allocated on the stack (unless
% put_nondet_env_on_heap is true, which won't be the case when doing
@@ -1212,7 +1212,7 @@
;
MLDS_ArgType = mlds_ptr_type(MLDS_Type)
),
- Name = data(var(Var)),
+ Name = entity_data(var(Var)),
(
!.MaybeInfo = yes(Info0),
% XXX We should fill in this Context properly.
@@ -1271,7 +1271,7 @@
MLDS_Name, MLDS_ModuleName) :-
ml_gen_pred_label(ModuleInfo, PredId, ProcId,
MLDS_PredLabel, MLDS_ModuleName),
- MLDS_Name = function(MLDS_PredLabel, ProcId, MaybeSeqNum, PredId).
+ MLDS_Name = entity_function(MLDS_PredLabel, ProcId, MaybeSeqNum, PredId).
% Allocate a new function label and return an rval containing
% the function's address.
@@ -1491,14 +1491,14 @@
ml_gen_mlds_var_decl(DataName, MLDS_Type, Initializer, GC_TraceCode, Context) =
MLDS_Defn :-
- Name = data(DataName),
+ Name = entity_data(DataName),
Defn = mlds_data(MLDS_Type, Initializer, GC_TraceCode),
DeclFlags = ml_gen_local_var_decl_flags,
MLDS_Defn = mlds_defn(Name, Context, DeclFlags, Defn).
ml_gen_static_const_defn(ConstName, ConstType, Access, Initializer, Context) =
MLDS_Defn :-
- Name = data(var(ConstName)),
+ Name = entity_data(var(ConstName)),
% The GC never needs to trace static constants,
% because they can never point into the heap
% (only to other static constants).
@@ -1613,7 +1613,7 @@
% ===>
% succeeded = MR_TRUE;
%
- ml_gen_set_success(!.Info, const(true), Context, SetSuccessTrue).
+ ml_gen_set_success(!.Info, const(true_const), Context, SetSuccessTrue).
ml_gen_success(model_non, Context, [CallCont], !Info) :-
%
% nondet succeed:
@@ -1632,7 +1632,7 @@
% ===>
% succeeded = MR_FALSE;
%
- ml_gen_set_success(!.Info, const(false), Context, SetSuccessFalse).
+ ml_gen_set_success(!.Info, const(false_const), Context, SetSuccessFalse).
ml_gen_failure(model_non, _, Statements, !Info) :-
%
% nondet fail:
@@ -1741,7 +1741,8 @@
ObjectRval = no,
RetLvals = [],
CallKind = ordinary_call,
- Stmt = call(Signature, FuncRval, ObjectRval, ArgRvals, RetLvals, CallKind),
+ Stmt = mlcall(Signature, FuncRval, ObjectRval, ArgRvals, RetLvals,
+ CallKind),
Statement = statement(Stmt, mlds_make_context(Context)).
ml_gen_call_current_success_cont_indirectly(Context, Statement, !Info) :-
@@ -1790,7 +1791,7 @@
InnerArgRvals = list.map(
(func(mlds_argument(Data, Type, _GC) )
= lval(var(qual(MLDS_Module, module_qual, VarName), Type)) :-
- ( Data = data(var(VarName0)) ->
+ ( Data = entity_data(var(VarName0)) ->
VarName = VarName0
;
unexpected(this_file,
@@ -1802,13 +1803,13 @@
% The passed_cont variable always points to code, not to heap,
% so the GC never needs to trace it.
PassedContGCTraceCode = no,
- PassedContArg = mlds_argument(data(var(PassedContVarName)),
+ PassedContArg = mlds_argument(entity_data(var(PassedContVarName)),
InnerFuncArgType, PassedContGCTraceCode),
InnerFuncRval = lval(var(qual(MLDS_Module, module_qual,
PassedContVarName), InnerFuncArgType)),
InnerFuncParams = mlds_func_params([PassedContArg | InnerArgs0], Rets),
- InnerStmt = call(Signature, InnerFuncRval, ObjectRval,
+ InnerStmt = mlcall(Signature, InnerFuncRval, ObjectRval,
InnerArgRvals, RetLvals, CallKind),
InnerStatement = statement(InnerStmt, MLDS_Context),
@@ -1819,8 +1820,9 @@
RetTypes),
ProxyArgRvals = [ContinuationFuncRval | ArgRvals],
(
- Defn = mlds_defn(function(PredLabel, ProcId,
- yes(SeqNum), _), _, _, mlds_function(_, _, defined_here(_), _))
+ Defn = mlds_defn(EntityName, _, _, EntityDefn),
+ EntityName = entity_function(PredLabel, ProcId, yes(SeqNum), _),
+ EntityDefn = mlds_function(_, _, body_defined_here(_), _)
->
% We call the proxy function.
ProcLabel = mlds_proc_label(PredLabel, ProcId),
@@ -1829,7 +1831,7 @@
internal(QualProcLabel, SeqNum, ProxySignature))),
% Put it inside a block where we call it.
- Stmt = call(ProxySignature, ProxyFuncRval, ObjectRval,
+ Stmt = mlcall(ProxySignature, ProxyFuncRval, ObjectRval,
ProxyArgRvals, RetLvals, CallKind),
Statement = statement(
block([Defn], [statement(Stmt, MLDS_Context)]), MLDS_Context)
@@ -1849,7 +1851,7 @@
mlds_unknown_type, EnvPtrLval).
ml_declare_env_ptr_arg(mlds_argument(Name, Type, GC_TraceCode)) :-
- Name = data(var(mlds_var_name("env_ptr_arg", no))),
+ Name = entity_data(var(mlds_var_name("env_ptr_arg", no))),
Type = mlds_generic_env_ptr_type,
% The env_ptr_arg always points to the stack, since continuation
% environments are always allocated on the stack (unless
@@ -2112,7 +2114,7 @@
% `private_builtin.gc_trace(TypeInfo, (MR_C_Pointer) &Var);'.
CastVarAddr = unop(cast(CPointerType), mem_addr(VarLval)),
TraceStatement = statement(
- call(Signature, FuncAddr, no,
+ mlcall(Signature, FuncAddr, no,
[TypeInfoRval, CastVarAddr], [], ordinary_call
), mlds_make_context(Context)).
@@ -2221,8 +2223,7 @@
Stmt0 = computed_goto(Rval, Labels),
Stmt = computed_goto(Rval, Labels)
;
- Stmt0 = call(_Sig, _Func, _Obj, _Args, _RetLvals,
- _TailCall),
+ Stmt0 = mlcall(_Sig, _Func, _Obj, _Args, _RetLvals, _TailCall),
Stmt = Stmt0
;
Stmt0 = return(_Rvals),
Index: compiler/ml_elim_nested.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_elim_nested.m,v
retrieving revision 1.80
diff -u -b -r1.80 ml_elim_nested.m
--- compiler/ml_elim_nested.m 8 Jun 2006 08:19:20 -0000 1.80
+++ compiler/ml_elim_nested.m 28 Jul 2006 03:19:25 -0000
@@ -502,11 +502,11 @@
Defn0 = mlds_defn(Name, Context, Flags, DefnBody0),
(
DefnBody0 = mlds_function(PredProcId, Params0,
- defined_here(FuncBody0), Attributes),
+ body_defined_here(FuncBody0), Attributes),
% Don't add GC tracing code to the gc_trace/1 primitive!
% (Doing so would just slow things down unnecessarily.)
\+ (
- Name = function(PredLabel, _, _, _),
+ Name = entity_function(PredLabel, _, _, _),
PredLabel = mlds_user_pred_label(_, _, "gc_trace", 1, _, _),
mercury_private_builtin_module(PrivateBuiltin),
ModuleName = mercury_module_name_to_mlds(PrivateBuiltin)
@@ -653,7 +653,7 @@
),
Params = mlds_func_params(Arguments, RetValues),
DefnBody = mlds_function(PredProcId, Params,
- defined_here(FuncBody), Attributes),
+ body_defined_here(FuncBody), Attributes),
Defn = mlds_defn(Name, Context, Flags, DefnBody),
Defns = list.append(HoistedDefns, [Defn])
;
@@ -677,7 +677,7 @@
ml_maybe_add_args([], _, _, _, !Info).
ml_maybe_add_args([Arg|Args], FuncBody, ModuleName, Context, !Info) :-
(
- Arg = mlds_argument(data(var(VarName)), _Type, GC_TraceCode),
+ Arg = mlds_argument(entity_data(var(VarName)), _Type, GC_TraceCode),
ml_should_add_local_data(!.Info, var(VarName), GC_TraceCode,
[], [FuncBody])
->
@@ -702,7 +702,8 @@
EnvPtrTypeName, Context, ArgsToCopy0, CodeToCopyArgs0),
ModuleName = elim_info_get_module_name(ElimInfo),
(
- Arg = mlds_argument(data(var(VarName)), FieldType, GC_TraceCode),
+ Arg = mlds_argument(entity_data(var(VarName)), FieldType,
+ GC_TraceCode),
ml_should_add_local_data(ElimInfo, var(VarName), GC_TraceCode,
[], [FuncBody])
->
@@ -810,7 +811,7 @@
EnvTypeKind = mlds_struct,
BaseClasses = []
),
- EnvTypeEntityName = type(EnvClassName, 0),
+ EnvTypeEntityName = entity_type(EnvClassName, 0),
EnvTypeFlags = env_type_decl_flags,
Fields0 = list.map(convert_local_to_field, LocalVars),
@@ -850,7 +851,7 @@
% struct <EnvClassName> env; // = { ... }
%
EnvVarName = mlds_var_name(env_name_base(Action), no),
- EnvVarEntityName = data(var(EnvVarName)),
+ EnvVarEntityName = entity_data(var(EnvVarName)),
EnvVarFlags = ml_gen_local_var_decl_flags,
EnvVarDefnBody = mlds_data(EnvTypeName, EnvInitializer, GC_TraceEnv),
EnvVarDecl = mlds_defn(EnvVarEntityName, Context, EnvVarFlags,
@@ -920,14 +921,14 @@
%
% void *prev;
% void (*trace)(...);
- PrevFieldName = data(var(mlds_var_name("prev", no))),
+ PrevFieldName = entity_data(var(mlds_var_name("prev", no))),
PrevFieldFlags = ml_gen_public_field_decl_flags,
PrevFieldType = ml_stack_chain_type,
PrevFieldDefnBody = mlds_data(PrevFieldType, no_initializer, no),
PrevFieldDecl = mlds_defn(PrevFieldName, Context, PrevFieldFlags,
PrevFieldDefnBody),
- TraceFieldName = data(var(mlds_var_name("trace", no))),
+ TraceFieldName = entity_data(var(mlds_var_name("trace", no))),
TraceFieldFlags = ml_gen_public_field_decl_flags,
TraceFieldType = mlds_func_type(GCTraceFuncParams),
TraceFieldDefnBody = mlds_data(TraceFieldType, no_initializer, no),
@@ -974,7 +975,7 @@
gen_gc_trace_func(FuncName, PredModule, FramePointerDecl, GCTraceStatements,
Context, GCTraceFuncAddr, FuncParams, GCTraceFuncDefn) :-
% Compute the signature of the GC tracing function
- ArgName = data(var(mlds_var_name("this_frame", no))),
+ ArgName = entity_data(var(mlds_var_name("this_frame", no))),
ArgType = mlds_generic_type,
Argument = mlds_argument(ArgName, ArgType, no),
FuncParams = mlds_func_params([Argument], []),
@@ -987,7 +988,7 @@
% XXX This is a bit of a hack; maybe we should add
% another field to the `function' ctor for mlds_entity_name.
%
- ( FuncName = function(PredLabel, ProcId, MaybeSeqNum, PredId) ->
+ ( FuncName = entity_function(PredLabel, ProcId, MaybeSeqNum, PredId) ->
(
MaybeSeqNum = yes(SeqNum)
;
@@ -995,7 +996,8 @@
SeqNum = 0
),
NewSeqNum = SeqNum + 100000,
- GCTraceFuncName = function(PredLabel, ProcId, yes(NewSeqNum), PredId),
+ GCTraceFuncName = entity_function(PredLabel, ProcId, yes(NewSeqNum),
+ PredId),
ProcLabel = mlds_proc_label(PredLabel, ProcId),
QualProcLabel = qual(PredModule, module_qual, ProcLabel),
GCTraceFuncAddr = internal(QualProcLabel, NewSeqNum, Signature)
@@ -1010,7 +1012,7 @@
MaybePredProcId = no,
Attributes = [],
FuncDefn = mlds_function(MaybePredProcId, FuncParams,
- defined_here(Statement), Attributes),
+ body_defined_here(Statement), Attributes),
GCTraceFuncDefn = mlds_defn(GCTraceFuncName, Context, DeclFlags,
FuncDefn).
@@ -1099,7 +1101,7 @@
Defn0 = mlds_defn(Name, Context, Flags, DefnBody0),
(
DefnBody0 = mlds_function(PredProcId, Params,
- defined_here(FuncBody0), Attributes),
+ body_defined_here(FuncBody0), Attributes),
statement_contains_var(FuncBody0, qual(ModuleName, module_qual,
var(mlds_var_name("env_ptr", no))))
->
@@ -1117,7 +1119,7 @@
FuncBody = statement(block([EnvPtrDecl],
[InitEnvPtr, FuncBody0]), Context),
DefnBody = mlds_function(PredProcId, Params,
- defined_here(FuncBody), Attributes),
+ body_defined_here(FuncBody), Attributes),
Defn = mlds_defn(Name, Context, Flags, DefnBody),
Init = yes
;
@@ -1153,7 +1155,7 @@
% <EnvTypeName> *env_ptr;
%
EnvPtrVarName = mlds_var_name(env_name_base(Action) ++ "_ptr", no),
- EnvPtrVarEntityName = data(var(EnvPtrVarName)),
+ EnvPtrVarEntityName = entity_data(var(EnvPtrVarName)),
EnvPtrVarFlags = ml_gen_local_var_decl_flags,
EnvPtrVarType = ml_make_env_ptr_type(Globals, EnvTypeName),
% The env_ptr never needs to be traced by the GC, since the environment
@@ -1249,11 +1251,11 @@
%
:- func ml_env_name(mlds_entity_name, action) = mlds_class_name.
-ml_env_name(type(_, _), _) = _ :-
+ml_env_name(entity_type(_, _), _) = _ :-
unexpected(this_file, "ml_env_name: expected function, got type").
-ml_env_name(data(_), _) = _ :-
+ml_env_name(entity_data(_), _) = _ :-
unexpected(this_file, "ml_env_name: expected function, got data").
-ml_env_name(function(PredLabel, ProcId, MaybeSeqNum, _PredId), Action)
+ml_env_name(entity_function(PredLabel, ProcId, MaybeSeqNum, _PredId), Action)
= ClassName :-
Base = env_name_base(Action),
PredLabelString = ml_pred_label_name(PredLabel),
@@ -1267,7 +1269,7 @@
string.format("%s_%d_%s",
[s(PredLabelString), i(ModeNum), s(Base)], ClassName)
).
-ml_env_name(export(_), _) = _ :-
+ml_env_name(entity_export(_), _) = _ :-
unexpected(this_file, "ml_env_name: expected function, got export").
:- func env_name_base(action) = string.
@@ -1345,9 +1347,9 @@
:- pred flatten_function_body(mlds_function_body::in, mlds_function_body::out,
elim_info::in, elim_info::out) is det.
-flatten_function_body(external, external, !Info).
-flatten_function_body(defined_here(Statement0), defined_here(Statement),
- !Info) :-
+flatten_function_body(body_external, body_external, !Info).
+flatten_function_body(body_defined_here(Statement0),
+ body_defined_here(Statement), !Info) :-
flatten_statement(Statement0, Statement, !Info).
:- pred flatten_maybe_statement(maybe(statement)::in,
@@ -1410,12 +1412,12 @@
fixup_rval(Rval0, Rval, !Info),
Stmt = computed_goto(Rval, Labels)
;
- Stmt0 = call(Sig, Func0, Obj0, Args0, RetLvals0, TailCall),
+ Stmt0 = mlcall(Sig, Func0, Obj0, Args0, RetLvals0, TailCall),
fixup_rval(Func0, Func, !Info),
fixup_maybe_rval(Obj0, Obj, !Info),
fixup_rvals(Args0, Args, !Info),
fixup_lvals(RetLvals0, RetLvals, !Info),
- Stmt = call(Sig, Func, Obj, Args, RetLvals, TailCall)
+ Stmt = mlcall(Sig, Func, Obj, Args, RetLvals, TailCall)
;
Stmt0 = return(Rvals0),
fixup_rvals(Rvals0, Rvals, !Info),
@@ -1590,7 +1592,7 @@
InitStatements = []
;
% Hoist ordinary local variables.
- Name = data(DataName),
+ Name = entity_data(DataName),
DataName = var(VarName),
ml_should_add_local_data(!.Info,
DataName, MaybeGCTraceCode0,
@@ -1885,7 +1887,7 @@
ThisVarModuleName = ModuleName,
IsLocalVar = (pred(VarType::out) is nondet :-
list.member(Var, Locals),
- Var = mlds_defn(data(var(ThisVarName)), _, _,
+ Var = mlds_defn(entity_data(var(ThisVarName)), _, _,
mlds_data(VarType, _, _)),
\+ ml_decl_is_static_const(Var)
),
@@ -2050,8 +2052,8 @@
:- pred function_body_contains_defn(mlds_function_body::in, mlds_defn::out)
is nondet.
-% function_body_contains_defn(external, _Defn) :- fail.
-function_body_contains_defn(defined_here(Statement), Defn) :-
+% function_body_contains_defn(body_external, _Defn) :- fail.
+function_body_contains_defn(body_defined_here(Statement), Defn) :-
statement_contains_defn(Statement, Defn).
:- pred statement_contains_defn(statement::in, mlds_defn::out)
@@ -2092,7 +2094,7 @@
Stmt = computed_goto(_Rval, _Labels),
fail
;
- Stmt = call(_Sig, _Func, _Obj, _Args, _RetLvals, _TailCall),
+ Stmt = mlcall(_Sig, _Func, _Obj, _Args, _RetLvals, _TailCall),
fail
;
Stmt = return(_Rvals),
@@ -2188,7 +2190,7 @@
Stmt0 = computed_goto(_Rval, _Labels),
Stmt = Stmt0
;
- Stmt0 = call(_Sig, _Func, _Obj, _Args, RetLvals, CallKind),
+ Stmt0 = mlcall(_Sig, _Func, _Obj, _Args, RetLvals, CallKind),
add_unchain_stack_to_call(Stmt0, RetLvals, CallKind, Context,
Stmt, !Info)
;
@@ -2305,7 +2307,7 @@
:- func gen_saved_stack_chain_var(int, mlds_context) = mlds_defn.
gen_saved_stack_chain_var(Id, Context) = Defn :-
- Name = data(var(ml_saved_stack_chain_name(Id))),
+ Name = entity_data(var(ml_saved_stack_chain_name(Id))),
Flags = ml_gen_local_var_decl_flags,
Type = ml_stack_chain_type,
Initializer = no_initializer,
Index: compiler/ml_optimize.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_optimize.m,v
retrieving revision 1.39
diff -u -b -r1.39 ml_optimize.m
--- compiler/ml_optimize.m 8 Jun 2006 08:19:20 -0000 1.39
+++ compiler/ml_optimize.m 28 Jul 2006 03:20:21 -0000
@@ -117,13 +117,13 @@
:- func optimize_in_function_body(opt_info, mlds_function_body)
= mlds_function_body.
-optimize_in_function_body(_, external) = external.
-optimize_in_function_body(OptInfo, defined_here(Statement0)) =
- defined_here(Statement) :-
+optimize_in_function_body(_, body_external) = body_external.
+optimize_in_function_body(OptInfo, body_defined_here(Statement0)) =
+ body_defined_here(Statement) :-
Statement = optimize_in_statement(OptInfo, Statement0).
-:- func optimize_in_maybe_statement(opt_info,
- maybe(statement)) = maybe(statement).
+:- func optimize_in_maybe_statement(opt_info, maybe(statement))
+ = maybe(statement).
optimize_in_maybe_statement(_, no) = no.
optimize_in_maybe_statement(OptInfo, yes(Statement0)) = yes(Statement) :-
@@ -143,7 +143,7 @@
optimize_in_stmt(OptInfo, Stmt0) = Stmt :-
(
- Stmt0 = call(_, _, _, _, _, _),
+ Stmt0 = mlcall(_, _, _, _, _, _),
Stmt = optimize_in_call_stmt(OptInfo, Stmt0)
;
Stmt0 = block(Defns0, Statements0),
@@ -209,13 +209,13 @@
%-----------------------------------------------------------------------------%
:- inst g == ground.
-:- inst call ---> ml_backend.mlds.call(g, g, g, g, g, g).
+:- inst mlcall ---> ml_backend.mlds.mlcall(g, g, g, g, g, g).
-:- func optimize_in_call_stmt(opt_info::in, mlds_stmt::in(call))
+:- func optimize_in_call_stmt(opt_info::in, mlds_stmt::in(mlcall))
= (mlds_stmt::out) is det.
optimize_in_call_stmt(OptInfo, Stmt0) = Stmt :-
- Stmt0 = call(_Signature, FuncRval, _MaybeObject, CallArgs,
+ Stmt0 = mlcall(_Signature, FuncRval, _MaybeObject, CallArgs,
_Results, _IsTailCall),
% If we have a self-tailcall, assign to the arguments and
% then goto the top of the tailcall loop.
@@ -320,7 +320,7 @@
Arg = mlds_argument(Name, Type, _ArgGCTraceCode),
(
% Extract the variable name.
- Name = data(var(VarName))
+ Name = entity_data(var(VarName))
->
QualVarName = qual(OptInfo ^ module_name, module_qual, VarName),
(
@@ -382,9 +382,9 @@
:- func optimize_func(opt_info, mlds_function_body) = mlds_function_body.
-optimize_func(_, external) = external.
-optimize_func(OptInfo, defined_here(Statement)) =
- defined_here(optimize_func_stmt(OptInfo, Statement)).
+optimize_func(_, body_external) = body_external.
+optimize_func(OptInfo, body_defined_here(Statement)) =
+ body_defined_here(optimize_func_stmt(OptInfo, Statement)).
:- func optimize_func_stmt(opt_info, statement) = statement.
@@ -416,7 +416,7 @@
% }
% Any tail calls in the function body will have
% been replaced with `continue' statements.
- Stmt = while(const(true),
+ Stmt = while(const(true_const),
statement(block([],
[CommentStmt,
statement(Stmt0, Context),
@@ -601,7 +601,7 @@
\+ rval_contains_var(RHS, ThisData),
\+ (
list.member(OtherDefn, FollowingDefns),
- OtherDefn = mlds_defn(data(OtherVarName),
+ OtherDefn = mlds_defn(entity_data(OtherVarName),
_, _, mlds_data(_Type, OtherInitializer, _GC)),
(
rval_contains_var(RHS, qual(Qualifier, QualKind, OtherVarName))
@@ -624,7 +624,7 @@
:- pred var_defn(mlds_var_name::in, mlds_defn::in) is semidet.
var_defn(VarName, Defn) :-
- Defn = mlds_defn(data(var(VarName)), _, _, _).
+ Defn = mlds_defn(entity_data(var(VarName)), _, _, _).
% set_initializer(Defns0, VarName, Rval, Defns):
%
@@ -639,7 +639,7 @@
set_initializer([Defn0 | Defns0], VarName, Rval, [Defn | Defns]) :-
Defn0 = mlds_defn(Name, Context, Flags, DefnBody0),
(
- Name = data(var(VarName)),
+ Name = entity_data(var(VarName)),
DefnBody0 = mlds_data(Type, _OldInitializer, GC_TraceCode)
->
DefnBody = mlds_data(Type, init_obj(Rval), GC_TraceCode),
@@ -722,7 +722,7 @@
Defn0 = mlds_defn(Name, _Context, Flags, DefnBody),
% Check if this definition is a local variable definition...
- Name = data(var(VarName)),
+ Name = entity_data(var(VarName)),
Flags = ml_gen_local_var_decl_flags,
DefnBody = mlds_data(_Type, Initializer, _MaybeGCTraceCode),
@@ -928,9 +928,9 @@
mlds_function_body::in, mlds_function_body::out,
var_elim_info::in, var_elim_info::out) is det.
-eliminate_var_in_function_body(external, external, !VarElimInfo).
-eliminate_var_in_function_body(defined_here(Stmt0), defined_here(Stmt),
- !VarElimInfo) :-
+eliminate_var_in_function_body(body_external, body_external, !VarElimInfo).
+eliminate_var_in_function_body(body_defined_here(Stmt0),
+ body_defined_here(Stmt), !VarElimInfo) :-
eliminate_var_in_statement(Stmt0, Stmt, !VarElimInfo).
:- pred eliminate_var_in_initializer(
@@ -1099,12 +1099,12 @@
eliminate_var_in_rval(Rval0, Rval, !VarElimInfo),
Stmt = computed_goto(Rval, Labels)
;
- Stmt0 = call(Sig, Func0, Obj0, Args0, RetLvals0, TailCall),
+ Stmt0 = mlcall(Sig, Func0, Obj0, Args0, RetLvals0, TailCall),
eliminate_var_in_rval(Func0, Func, !VarElimInfo),
eliminate_var_in_maybe_rval(Obj0, Obj, !VarElimInfo),
eliminate_var_in_rvals(Args0, Args, !VarElimInfo),
eliminate_var_in_lvals(RetLvals0, RetLvals, !VarElimInfo),
- Stmt = call(Sig, Func, Obj, Args, RetLvals, TailCall)
+ Stmt = mlcall(Sig, Func, Obj, Args, RetLvals, TailCall)
;
Stmt0 = return(Rvals0),
eliminate_var_in_rvals(Rvals0, Rvals, !VarElimInfo),
Index: compiler/ml_simplify_switch.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_simplify_switch.m,v
retrieving revision 1.17
diff -u -b -r1.17 ml_simplify_switch.m
--- compiler/ml_simplify_switch.m 29 Mar 2006 08:07:03 -0000 1.17
+++ compiler/ml_simplify_switch.m 28 Jul 2006 02:47:37 -0000
@@ -443,7 +443,7 @@
%
:- func ml_gen_case_match_conds(mlds_case_match_conds, mlds_rval) = mlds_rval.
-ml_gen_case_match_conds([], _) = const(false).
+ml_gen_case_match_conds([], _) = const(false_const).
ml_gen_case_match_conds([Cond], SwitchRval) =
ml_gen_case_match_cond(Cond, SwitchRval).
ml_gen_case_match_conds([Cond1, Cond2 | Conds], SwitchRval) =
Index: compiler/ml_tailcall.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_tailcall.m,v
retrieving revision 1.36
diff -u -b -r1.36 ml_tailcall.m
--- compiler/ml_tailcall.m 8 Jun 2006 08:19:21 -0000 1.36
+++ compiler/ml_tailcall.m 28 Jul 2006 03:13:30 -0000
@@ -173,13 +173,13 @@
:- func mark_tailcalls_in_function_body(mlds_function_body, at_tail, locals)
= mlds_function_body.
-mark_tailcalls_in_function_body(external, _, _) = external.
-mark_tailcalls_in_function_body(defined_here(Statement0), AtTail, Locals) =
- defined_here(Statement) :-
+mark_tailcalls_in_function_body(body_external, _, _) = body_external.
+mark_tailcalls_in_function_body(body_defined_here(Statement0), AtTail,
+ Locals) = body_defined_here(Statement) :-
Statement = mark_tailcalls_in_statement(Statement0, AtTail, Locals).
-:- func mark_tailcalls_in_maybe_statement(maybe(statement),
- at_tail, locals) = maybe(statement).
+:- func mark_tailcalls_in_maybe_statement(maybe(statement), at_tail, locals)
+ = maybe(statement).
mark_tailcalls_in_maybe_statement(no, _, _) = no.
mark_tailcalls_in_maybe_statement(yes(Statement0), AtTail, Locals) =
@@ -264,7 +264,7 @@
Stmt0 = computed_goto(_, _),
Stmt = Stmt0
;
- Stmt0 = call(Sig, Func, Obj, Args, ReturnLvals, CallKind0),
+ Stmt0 = mlcall(Sig, Func, Obj, Args, ReturnLvals, CallKind0),
%
% check if we can mark this call as a tail call
%
@@ -288,7 +288,7 @@
->
% Mark this call as a tail call.
CallKind = tail_call,
- Stmt = call(Sig, Func, Obj, Args, ReturnLvals, CallKind)
+ Stmt = mlcall(Sig, Func, Obj, Args, ReturnLvals, CallKind)
;
% Leave this call unchanged.
Stmt = Stmt0
@@ -469,7 +469,7 @@
Var = qual(_ModuleName, _QualKind, VarName),
some [Local] (
locals_member(Local, Locals),
- Local = data(var(VarName))
+ Local = entity_data(var(VarName))
).
% Check whether the specified function is defined locally (i.e. as a
@@ -491,7 +491,7 @@
ProcLabel = mlds_proc_label(PredLabel, ProcId),
some [Local] (
locals_member(Local, Locals),
- Local = function(PredLabel, ProcId, MaybeSeqNum, _PredId)
+ Local = entity_function(PredLabel, ProcId, MaybeSeqNum, _PredId)
).
% locals_member(Name, Locals):
@@ -547,7 +547,7 @@
(
DefnBody = mlds_function(_PredProcId, _Params, FuncBody,
_Attributes),
- FuncBody = defined_here(Body),
+ FuncBody = body_defined_here(Body),
nontailcall_in_statement(ModuleName, Name, Body, Warning)
;
DefnBody = mlds_class(ClassDefn),
@@ -565,7 +565,7 @@
% Nondeterministically find a non-tail call.
statement_contains_statement(Statement, SubStatement),
SubStatement = statement(SubStmt, Context),
- SubStmt = call(_CallSig, Func, _This, _Args, _RetVals, CallKind),
+ SubStmt = mlcall(_CallSig, Func, _This, _Args, _RetVals, CallKind),
CallKind = ordinary_call,
% Check if this call is a directly recursive call.
Func = const(code_addr_const(CodeAddr)),
@@ -578,7 +578,7 @@
),
ProcLabel = mlds_proc_label(PredLabel, ProcId),
QualProcLabel = qual(CallerModule, module_qual, ProcLabel),
- CallerFuncName = function(PredLabel, ProcId, MaybeSeqNum, _PredId),
+ CallerFuncName = entity_function(PredLabel, ProcId, MaybeSeqNum, _PredId),
% If so, construct an appropriate warning.
Warning = tailcall_warning(PredLabel, ProcId, Context).
Index: compiler/ml_type_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_type_gen.m,v
retrieving revision 1.53
diff -u -b -r1.53 ml_type_gen.m
--- compiler/ml_type_gen.m 8 Jun 2006 08:19:21 -0000 1.53
+++ compiler/ml_type_gen.m 28 Jul 2006 03:13:53 -0000
@@ -209,7 +209,7 @@
Implements = [],
% Put it all together.
- MLDS_TypeName = type(MLDS_ClassName, MLDS_ClassArity),
+ MLDS_TypeName = entity_type(MLDS_ClassName, MLDS_ClassArity),
MLDS_TypeFlags = ml_gen_type_decl_flags,
MLDS_TypeDefnBody = mlds_class(mlds_class_defn(mlds_enum,
Imports, Inherits, Implements, [], Members)),
@@ -221,7 +221,7 @@
:- func ml_gen_enum_value_member(prog_context) = mlds_defn.
ml_gen_enum_value_member(Context) =
- mlds_defn(data(var(mlds_var_name("value", no))),
+ mlds_defn(entity_data(var(mlds_var_name("value", no))),
mlds_make_context(Context),
ml_gen_member_decl_flags,
mlds_data(mlds_native_int_type, no_initializer, no)).
@@ -246,7 +246,7 @@
% Generate an MLDS definition for this enumeration constant.
unqualify_name(Name, UnqualifiedName),
- MLDS_Defn = mlds_defn(data(var(mlds_var_name(UnqualifiedName, no))),
+ MLDS_Defn = mlds_defn(entity_data(var(mlds_var_name(UnqualifiedName, no))),
mlds_make_context(Context),
ml_gen_enum_constant_decl_flags,
mlds_data(mlds_native_int_type, init_obj(ConstValue), no)).
@@ -415,7 +415,7 @@
% Put it all together.
Members = MaybeEqualityMembers ++ TagMembers ++ CtorMembers,
- MLDS_TypeName = type(BaseClassName, BaseClassArity),
+ MLDS_TypeName = entity_type(BaseClassName, BaseClassArity),
MLDS_TypeFlags = ml_gen_type_decl_flags,
MLDS_TypeDefnBody = mlds_class(mlds_class_defn(mlds_class,
Imports, Inherits, Implements, BaseClassCtorMethods, Members)),
@@ -429,7 +429,7 @@
:- func ml_gen_tag_member(string, prog_context) = mlds_defn.
ml_gen_tag_member(Name, Context) =
- mlds_defn(data(var(mlds_var_name(Name, no))),
+ mlds_defn(entity_data(var(mlds_var_name(Name, no))),
mlds_make_context(Context),
ml_gen_member_decl_flags,
mlds_data(mlds_native_int_type, no_initializer, no)).
@@ -448,7 +448,8 @@
Ctor = ctor(_ExistQTVars, _Constraints, Name, _Args),
unqualify_name(Name, UnqualifiedName),
ConstValue = const(int_const(SecondaryTag)),
- MLDS_Defn = mlds_defn(data(var(mlds_var_name(UnqualifiedName, no))),
+ MLDS_Defn = mlds_defn(
+ entity_data(var(mlds_var_name(UnqualifiedName, no))),
mlds_make_context(Context),
ml_gen_enum_constant_decl_flags,
mlds_data(mlds_native_int_type, init_obj(ConstValue), no)),
@@ -538,7 +539,7 @@
Ctors = [],
% Put it all together.
- MLDS_TypeName = type(UnqualClassName, ClassArity),
+ MLDS_TypeName = entity_type(UnqualClassName, ClassArity),
MLDS_TypeFlags = ml_gen_type_decl_flags,
MLDS_TypeDefnBody = mlds_class(mlds_class_defn(mlds_class,
Imports, Inherits, Implements, Ctors, Members)),
@@ -698,7 +699,7 @@
Implements = [],
% Put it all together.
- MLDS_TypeName = type(UnqualCtorName, CtorArity),
+ MLDS_TypeName = entity_type(UnqualCtorName, CtorArity),
MLDS_TypeFlags = ml_gen_type_decl_flags,
MLDS_TypeDefnBody = mlds_class(mlds_class_defn(
mlds_class, Imports, Inherits, Implements, Ctors, Members)),
@@ -771,13 +772,14 @@
Attributes = [],
Ctor = mlds_function(no, mlds_func_params(Args, ReturnValues),
- defined_here(Stmt), Attributes),
+ body_defined_here(Stmt), Attributes),
CtorFlags = init_decl_flags(public, per_instance, non_virtual,
overridable, modifiable, concrete),
% Note that the name of constructor is determined by the backend
% convention.
- CtorDefn = mlds_defn(export("<constructor>"), Context, CtorFlags, Ctor).
+ CtorDefn = mlds_defn(entity_export("<constructor>"), Context, CtorFlags,
+ Ctor).
% Get the name and type from the field definition, for use as a
% constructor argument name and type.
@@ -805,7 +807,7 @@
unexpected(this_file, "gen_init_field: non-data member")
),
(
- EntityName = data(var(VarName0)),
+ EntityName = entity_data(var(VarName0)),
VarName0 = mlds_var_name(Name0, no)
->
Name = Name0,
@@ -906,7 +908,7 @@
= mlds_defn.
ml_gen_mlds_field_decl(DataName, MLDS_Type, Context) = MLDS_Defn :-
- Name = data(DataName),
+ Name = entity_data(DataName),
% We only need GC tracing code for top-level variables, not for fields
GC_TraceCode = no,
Defn = mlds_data(MLDS_Type, no_initializer, GC_TraceCode),
Index: compiler/ml_unify_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_unify_gen.m,v
retrieving revision 1.100
diff -u -b -r1.100 ml_unify_gen.m
--- compiler/ml_unify_gen.m 8 Jun 2006 08:19:21 -0000 1.100
+++ compiler/ml_unify_gen.m 28 Jul 2006 02:50:18 -0000
@@ -1675,8 +1675,8 @@
unexpected(this_file, "Attempted deep_profiling_proc_layout unification").
ml_gen_tag_test_rval(table_io_decl_tag(_, _), _, _, _) = _ :-
unexpected(this_file, "Attempted table_io_decl unification").
-ml_gen_tag_test_rval(no_tag, _, _, _Rval) = const(true).
-ml_gen_tag_test_rval(single_functor, _, _, _Rval) = const(true).
+ml_gen_tag_test_rval(no_tag, _, _, _Rval) = const(true_const).
+ml_gen_tag_test_rval(single_functor, _, _, _Rval) = const(true_const).
ml_gen_tag_test_rval(unshared_tag(UnsharedTag), _, _, Rval) =
binop(eq, unop(std_unop(tag), Rval),
unop(std_unop(mktag), const(int_const(UnsharedTag)))).
Index: compiler/ml_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_util.m,v
retrieving revision 1.46
diff -u -b -r1.46 ml_util.m
--- compiler/ml_util.m 8 Jun 2006 08:19:21 -0000 1.46
+++ compiler/ml_util.m 28 Jul 2006 02:51:43 -0000
@@ -211,11 +211,11 @@
defns_contain_main(Defns) :-
list.member(Defn, Defns),
Defn = mlds_defn(Name, _, _, _),
- Name = function(FuncName, _, _, _),
+ Name = entity_function(FuncName, _, _, _),
FuncName = mlds_user_pred_label(predicate, _, "main", 2, _, _).
can_optimize_tailcall(Name, Call) :-
- Call = call(_Signature, FuncRval, MaybeObject, _CallArgs,
+ Call = mlcall(_Signature, FuncRval, MaybeObject, _CallArgs,
_Results, CallKind),
% Check if this call can be optimized as a tail call.
( CallKind = tail_call ; CallKind = no_return_call ),
@@ -236,7 +236,7 @@
Name = qual(ModuleName, module_qual, FuncName),
% Check that the PredLabel, ProcId, and MaybeSeqNum match.
- FuncName = function(PredLabel, ProcId, MaybeSeqNum, _),
+ FuncName = entity_function(PredLabel, ProcId, MaybeSeqNum, _),
% In C++, `this' is a constant, so our usual technique of assigning
% the arguments won't work if it is a member function. Thus we don't do
@@ -296,7 +296,7 @@
Stmt = computed_goto(_Rval, _Labels),
fail
;
- Stmt = call(_Sig, _Func, _Obj, _Args, _RetLvals, _TailCall),
+ Stmt = mlcall(_Sig, _Func, _Obj, _Args, _RetLvals, _TailCall),
fail
;
Stmt = return(_Rvals),
@@ -391,7 +391,7 @@
Stmt = computed_goto(Rval, _Labels),
rval_contains_var(Rval, Name)
;
- Stmt = call(_Sig, Func, Obj, Args, RetLvals, _TailCall),
+ Stmt = mlcall(_Sig, Func, Obj, Args, RetLvals, _TailCall),
( rval_contains_var(Func, Name)
; maybe_rval_contains_var(Obj, Name)
; rvals_contains_var(Args, Name)
@@ -479,7 +479,7 @@
target_code_component_contains_var(target_code_output(Lval), Name) :-
lval_contains_var(Lval, Name).
target_code_component_contains_var(name(EntityName), DataName) :-
- EntityName = qual(ModuleName, QualKind, data(UnqualDataName)),
+ EntityName = qual(ModuleName, QualKind, entity_data(UnqualDataName)),
DataName = qual(ModuleName, QualKind, UnqualDataName),
% This is a place where we can succeed.
true.
@@ -499,7 +499,7 @@
defn_contains_foreign_code(NativeTargetLang, Defn) :-
Defn = mlds_defn(_Name, _Context, _Flags, Body),
- Body = mlds_function(_, _, defined_here(FunctionBody), _),
+ Body = mlds_function(_, _, body_defined_here(FunctionBody), _),
statement_contains_statement(FunctionBody, Statement),
Statement = statement(Stmt, _),
(
@@ -511,18 +511,18 @@
defn_contains_outline_foreign_proc(ForeignLang, Defn) :-
Defn = mlds_defn(_Name, _Context, _Flags, Body),
- Body = mlds_function(_, _, defined_here(FunctionBody), _),
+ Body = mlds_function(_, _, body_defined_here(FunctionBody), _),
statement_contains_statement(FunctionBody, Statement),
Statement = statement(Stmt, _),
Stmt = atomic(outline_foreign_proc(ForeignLang, _, _, _)).
defn_is_type(Defn) :-
Defn = mlds_defn(Name, _Context, _Flags, _Body),
- Name = type(_, _).
+ Name = entity_type(_, _).
defn_is_function(Defn) :-
Defn = mlds_defn(Name, _Context, _Flags, _Body),
- Name = function(_, _, _, _).
+ Name = entity_function(_, _, _, _).
defn_is_type_ctor_info(Defn) :-
Defn = mlds_defn(_Name, _Context, _Flags, Body),
@@ -573,8 +573,8 @@
:- pred function_body_contains_var(mlds_function_body::in, mlds_data::in)
is semidet.
-% function_body_contains_var(external, _) :- fail.
-function_body_contains_var(defined_here(Statement), Name) :-
+% function_body_contains_var(body_external, _) :- fail.
+function_body_contains_var(body_defined_here(Statement), Name) :-
statement_contains_var(Statement, Name).
%-----------------------------------------------------------------------------%
@@ -705,8 +705,8 @@
gen_init_int(Int) = init_obj(const(int_const(Int))).
-gen_init_bool(no) = init_obj(const(false)).
-gen_init_bool(yes) = init_obj(const(true)).
+gen_init_bool(no) = init_obj(const(false_const)).
+gen_init_bool(yes) = init_obj(const(true_const)).
gen_init_boxed_int(Int) =
init_obj(unop(box(mlds_native_int_type), const(int_const(Int)))).
Index: compiler/mlds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds.m,v
retrieving revision 1.134
diff -u -b -r1.134 mlds.m
--- compiler/mlds.m 19 Jul 2006 15:18:55 -0000 1.134
+++ compiler/mlds.m 28 Jul 2006 02:23:30 -0000
@@ -25,7 +25,7 @@
% HLDS is that MLDS does not have any support for non-determinism, so the
% HLDS->MLDS compiler must compile non-deterministic code into code that
% uses continuation passing.
-
+%
% The MLDS data structure is quite full-featured, including for example
% support for arbitrary nesting, multiple return values, and tagged pointers.
% However, many
@@ -363,7 +363,7 @@
% Code defined in some other language, e.g. for
% `pragma c_header_code', etc.
- foreign_code :: map(foreign_language,
+ foreign_code_map :: map(foreign_language,
mlds_foreign_code),
% The MLDS code itself.
@@ -516,18 +516,18 @@
; type_qual.
:- type mlds_entity_name
- ---> type(mlds_class_name, arity) % Name, arity.
- ; data(mlds_data_name)
- ; function(
+ ---> entity_type(mlds_class_name, arity) % Name, arity.
+ ; entity_data(mlds_data_name)
+ ; entity_function(
% Identifies the source code predicate or function.
- mlds_pred_label,
+ ef_pred_label :: mlds_pred_label,
- proc_id,
+ ef_proc_id :: proc_id,
% A sequence number used to distinguish different MLDS
% functions when compiling a single HLDS predicate into
% multiple MLDS functions (e.g. to handle backtracking).
- maybe(mlds_func_sequence_num),
+ ef_maybe_func_seq :: maybe(mlds_func_sequence_num),
% Specifies the HLDS pred_id.
% This should generally not be needed much, since all the
@@ -535,9 +535,9 @@
% and/or in the mlds_entity_defn. However, the target
% generator may want to refer to the HLDS for additional
% information.
- pred_id
+ ef_pred_id :: pred_id
)
- ; export(
+ ; entity_export(
% A pragma export name.
string
).
@@ -590,8 +590,8 @@
% (If you want to generate an abstract body consider adding another
% alternative here).
:- type mlds_function_body
- ---> defined_here(statement)
- ; external.
+ ---> body_defined_here(statement)
+ ; body_external.
% Note that `one_copy' variables *must* have an initializer
% (the GCC back-end relies on this).
@@ -1012,7 +1012,7 @@
% Function call/return.
- ; call(
+ ; mlcall(
mlds_func_signature, % Signature of the function.
mlds_rval, % The function to call.
maybe(mlds_rval), % For method calls, this field
@@ -1534,8 +1534,8 @@
; std_unop(builtin_ops.unary_op).
:- type mlds_rval_const
- ---> true
- ; false
+ ---> true_const
+ ; false_const
; int_const(int)
; float_const(float)
; string_const(string)
Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.191
diff -u -b -r1.191 mlds_to_c.m
--- compiler/mlds_to_c.m 19 Jul 2006 15:18:56 -0000 1.191
+++ compiler/mlds_to_c.m 28 Jul 2006 02:54:00 -0000
@@ -838,7 +838,7 @@
Export = ml_pragma_export(Lang, ExportName, _MLDS_Name, Signature, Context),
expect(unify(Lang, lang_c), this_file,
"export to language other than C."),
- Name = qual(ModuleName, module_qual, export(ExportName)),
+ Name = qual(ModuleName, module_qual, entity_export(ExportName)),
mlds_indent(Context, Indent, !IO),
% For functions exported using `pragma export',
% we use the default C calling convention.
@@ -1073,8 +1073,8 @@
:- func boxed_name(mlds_entity_name) = mlds_entity_name.
boxed_name(Name) = BoxedName :-
- ( Name = data(var(mlds_var_name(VarName, Seq))) ->
- BoxedName = data(var(mlds_var_name("boxed_" ++ VarName, Seq)))
+ ( Name = entity_data(var(mlds_var_name(VarName, Seq))) ->
+ BoxedName = entity_data(var(mlds_var_name("boxed_" ++ VarName, Seq)))
;
unexpected(this_file, "boxed_name called for non-var argument")
).
@@ -1385,7 +1385,7 @@
% appropriate qualifier.
Name = qual(ModuleName, QualKind, UnqualName),
- ( UnqualName = type(ClassName, ClassArity) ->
+ ( UnqualName = entity_type(ClassName, ClassArity) ->
globals.io_get_globals(Globals, !IO),
ClassModuleName = mlds_append_class_qualifier(ModuleName,
QualKind, Globals, ClassName, ClassArity)
@@ -1452,7 +1452,7 @@
is_static_member(Defn) :-
Defn = mlds_defn(Name, _, Flags, _),
- ( Name = type(_, _)
+ ( Name = entity_type(_, _)
; per_instance(Flags) = one_copy
).
@@ -1468,7 +1468,7 @@
% We only need GC tracing code for top-level variables,
% not for base classes.
GC_TraceCode = no,
- MLDS_Defn = mlds_defn(data(var(BaseName)), Context,
+ MLDS_Defn = mlds_defn(entity_data(var(BaseName)), Context,
ml_gen_public_field_decl_flags,
mlds_data(Type, no_initializer, GC_TraceCode)),
BaseNum = BaseNum0 + 1.
@@ -1645,10 +1645,10 @@
mlds_output_func(Indent, Name, Context, Params, FunctionBody, !IO) :-
mlds_output_func_decl(Indent, Name, Context, Params, !IO),
(
- FunctionBody = external,
+ FunctionBody = body_external,
io.write_string(";\n", !IO)
;
- FunctionBody = defined_here(Body),
+ FunctionBody = body_defined_here(Body),
io.write_string("\n", !IO),
mlds_indent(Context, Indent, !IO),
@@ -1802,15 +1802,15 @@
(
(
% Don't module-qualify main/2.
- Name = function(PredLabel, _, _, _),
+ Name = entity_function(PredLabel, _, _, _),
PredLabel = mlds_user_pred_label(predicate, no, "main", 2,
model_det, no)
;
- Name = data(mlds_rtti(RttiId)),
+ Name = entity_data(mlds_rtti(RttiId)),
module_qualify_name_of_rtti_id(RttiId) = no
;
% We don't module qualify pragma export names.
- Name = export(_)
+ Name = entity_export(_)
)
->
mlds_output_name(Name, !IO)
@@ -1856,12 +1856,13 @@
% XXX We should avoid appending the arity, modenum, and seqnum
% if they are not needed.
-mlds_output_name(type(Name, Arity), !IO) :-
+mlds_output_name(entity_type(Name, Arity), !IO) :-
MangledName = name_mangle(Name),
io.format("%s_%d", [s(MangledName), i(Arity)], !IO).
-mlds_output_name(data(DataName), !IO) :-
+mlds_output_name(entity_data(DataName), !IO) :-
mlds_output_data_name(DataName, !IO).
-mlds_output_name(function(PredLabel, ProcId, MaybeSeqNum, _PredId), !IO) :-
+mlds_output_name(entity_function(PredLabel, ProcId, MaybeSeqNum, _PredId),
+ !IO) :-
mlds_output_pred_label(PredLabel, !IO),
proc_id_to_int(ProcId, ModeNum),
io.format("_%d", [i(ModeNum)], !IO),
@@ -1871,7 +1872,7 @@
;
MaybeSeqNum = no
).
-mlds_output_name(export(Name), !IO) :-
+mlds_output_name(entity_export(Name), !IO) :-
io.write_string(Name, !IO).
% mlds_output_pred_label should be kept in sync with
@@ -2356,22 +2357,22 @@
Access = local,
PerInstance = one_copy
),
- Name \= type(_, _),
+ Name \= entity_type(_, _),
% Don't output "static" for functions that don't have a body.
% This can happen for Mercury procedures declared `:- external'
- DefnBody \= mlds_function(_, _, external, _)
+ DefnBody \= mlds_function(_, _, body_external, _)
->
io.write_string("static ", !IO)
;
DeclOrDefn = forward_decl,
- Name = data(_)
+ Name = entity_data(_)
->
io.write_string("extern ", !IO)
;
% Forward declarations for GNU C nested functions need to be prefixed
% with "auto".
DeclOrDefn = forward_decl,
- Name = function(_, _, _, _),
+ Name = entity_function(_, _, _, _),
Access = local
->
io.write_string("auto ", !IO)
@@ -2577,7 +2578,7 @@
io.write_string("}\n", !IO).
mlds_output_stmt(Indent, CallerFuncInfo, Call, Context, !IO) :-
- Call = call(Signature, FuncRval, MaybeObject, CallArgs,
+ Call = mlcall(Signature, FuncRval, MaybeObject, CallArgs,
Results, IsTailCall),
CallerFuncInfo = func_info(CallerName, CallerSignature),
@@ -3624,9 +3625,9 @@
:- pred mlds_output_rval_const(mlds_rval_const::in, io::di, io::uo) is det.
-mlds_output_rval_const(true, !IO) :-
+mlds_output_rval_const(true_const, !IO) :-
io.write_string("MR_TRUE", !IO).
-mlds_output_rval_const(false, !IO) :-
+mlds_output_rval_const(false_const, !IO) :-
io.write_string("MR_FALSE", !IO).
mlds_output_rval_const(int_const(N), !IO) :-
% We need to cast to (MR_Integer) to ensure things like 1 << 32 work
Index: compiler/mlds_to_gcc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_gcc.m,v
retrieving revision 1.118
diff -u -b -r1.118 mlds_to_gcc.m
--- compiler/mlds_to_gcc.m 8 Jun 2006 08:19:22 -0000 1.118
+++ compiler/mlds_to_gcc.m 28 Jul 2006 03:20:58 -0000
@@ -398,7 +398,7 @@
{ GCC_RetType = gcc__void_type_node },
gcc__build_function_decl(FuncName, FuncName,
GCC_RetType, GCC_ParamTypes, GCC_ParamDecls, GCC_FuncDecl),
- { Name = export(FuncName) },
+ { Name = entity_export(FuncName) },
{ map__init(SymbolTable) },
{ map__init(LabelTable) },
{ DefnInfo = defn_info(GlobalInfo,
@@ -766,7 +766,7 @@
build_field_defn(Defn, ModuleName, GlobalInfo, GCC_FieldDefn),
% Insert the field definition into our field symbol table.
{ Defn = mlds_defn(Name, _, _, _) },
- ( { Name = data(var(FieldName)) } ->
+ ( { Name = entity_data(var(FieldName)) } ->
{ GCC_FieldName = ml_var_name_to_string(FieldName) },
{ FieldTable1 = map__det_insert(FieldTable0,
qual(ModuleName, type_qual, GCC_FieldName),
@@ -1158,7 +1158,7 @@
build_type(Type, initializer_array_size(Initializer),
DefnInfo ^ global_info, GCC_Type),
{ Name = qual(_ModuleName, _QualKind, UnqualName) },
- ( { UnqualName = data(var(VarName0)) } ->
+ ( { UnqualName = entity_data(var(VarName0)) } ->
{ VarName = VarName0 }
;
% var/1 should be the only kind of mlds_data_name for which
@@ -1206,7 +1206,7 @@
build_type(Type, initializer_array_size(Initializer),
GlobalInfo, GCC_Type),
{ Name = qual(_ModuleName, _QualKind, UnqualName) },
- ( { UnqualName = data(var(VarName)) } ->
+ ( { UnqualName = entity_data(var(VarName)) } ->
{ GCC_VarName = ml_var_name_to_string(VarName) },
gcc__build_field_decl(GCC_VarName, GCC_Type, GCC_Defn)
;
@@ -1298,7 +1298,7 @@
%
{ Name = qual(ModuleName, QualKind, UnqualName) },
globals__io_get_globals(Globals),
- { UnqualName = type(ClassName, ClassArity) ->
+ { UnqualName = entity_type(ClassName, ClassArity) ->
ClassModuleName = mlds_append_class_qualifier(ModuleName,
QualKind, Globals, ClassName, ClassArity)
;
@@ -1386,7 +1386,7 @@
is_static_member(Defn) :-
Defn = mlds_defn(Name, _, Flags, _),
- ( Name = type(_, _)
+ ( Name = entity_type(_, _)
; per_instance(Flags) = one_copy
).
@@ -1403,7 +1403,8 @@
% We only need GC tracing code for top-level variables,
% not for base classes.
GC_TraceCode = no,
- MLDS_Defn = mlds_defn(data(var(mlds_var_name(BaseName, no))), Context,
+ MLDS_Defn = mlds_defn(
+ entity_data(var(mlds_var_name(BaseName, no))), Context,
ml_gen_public_field_decl_flags,
mlds_data(Type, no_initializer, GC_TraceCode)),
BaseNum = BaseNum0 + 1.
@@ -1491,9 +1492,9 @@
GlobalInfo0, GlobalInfo) -->
{ GlobalInfo = GlobalInfo0 },
(
- { MaybeBody = external }
+ { MaybeBody = body_external }
;
- { MaybeBody = defined_here(Body) },
+ { MaybeBody = body_defined_here(Body) },
gcc__push_gc_context,
make_func_decl_for_defn(Name, Signature, GlobalInfo0,
FuncDecl, SymbolTable),
@@ -1599,7 +1600,10 @@
:- pred get_func_name(mlds_entity_name::in,
string::out, string::out) is det.
get_func_name(FunctionName, FuncName, AsmFuncName) :-
- ( FunctionName = function(PredLabel, ProcId, MaybeSeqNum, _PredId) ->
+ (
+ FunctionName = entity_function(PredLabel, ProcId, MaybeSeqNum,
+ _PredId)
+ ->
%
% Generate the AsmFuncName
% This needs to be fully name mangled to ensure that it
@@ -1707,7 +1711,7 @@
ParamTypes0, ParamDecls0, SymbolTable0),
{ Arg = mlds_argument(ArgName, Type, _GC_TraceCode) },
build_type(Type, GlobalInfo, GCC_Type),
- ( { ArgName = data(var(ArgVarName)) } ->
+ ( { ArgName = entity_data(var(ArgVarName)) } ->
{ GCC_ArgVarName = ml_var_name_to_string(ArgVarName) },
gcc__build_param_decl(GCC_ArgVarName, GCC_Type, ParamDecl),
{ SymbolTable = map__det_insert(SymbolTable0,
@@ -1773,7 +1777,7 @@
%
{ Name = qual(ModuleName, QualKind, TypeName) },
{ EntityName = qual(ModuleName, QualKind,
- type(TypeName, Arity)) },
+ entity_type(TypeName, Arity)) },
(
{ map__search(GlobalInfo ^ type_table, EntityName,
gcc_type_info(GCC_TypeDecl, _)) }
@@ -2552,15 +2556,15 @@
%
% don't module-qualify main/2
%
- Name = function(PredLabel, _, _, _),
+ Name = entity_function(PredLabel, _, _, _),
PredLabel = mlds_user_pred_label(predicate, no,
"main", 2, model_det, no)
;
- Name = data(mlds_rtti(RttiId)),
+ Name = entity_data(mlds_rtti(RttiId)),
module_qualify_name_of_rtti_id(RttiId) = no
;
% We don't module qualify pragma export names.
- Name = export(_)
+ Name = entity_export(_)
)
->
AsmName = AsmName0
@@ -2575,14 +2579,14 @@
:- func build_name(mlds_entity_name) = string.
-build_name(type(Name, Arity)) = TypeName :-
+build_name(entity_type(Name, Arity)) = TypeName :-
MangledName = name_mangle(Name),
TypeName = string__format("%s_%d", [s(MangledName), i(Arity)]).
-build_name(data(DataName)) = build_data_name(DataName).
+build_name(entity_data(DataName)) = build_data_name(DataName).
build_name(EntityName) = AsmFuncName :-
- EntityName = function(_, _, _, _),
+ EntityName = entity_function(_, _, _, _),
get_func_name(EntityName, _FuncName, AsmFuncName).
-build_name(export(Name)) = Name.
+build_name(entity_export(Name)) = Name.
:- func build_data_name(mlds_data_name) = string.
@@ -2603,7 +2607,8 @@
% so we can use get_func_name below
ProcLabel = mlds_proc_label(PredLabel, ProcId),
MaybeSeqNum = no,
- Name = function(PredLabel, ProcId, MaybeSeqNum, invalid_pred_id),
+ Name = entity_function(PredLabel, ProcId, MaybeSeqNum,
+ invalid_pred_id),
get_func_name(Name, _FuncName, AsmFuncName),
TablingPointerName = tabling_info_id_str(Id) ++ "_" ++ AsmFuncName.
@@ -2810,7 +2815,7 @@
% function call/return
%
gen_stmt(DefnInfo, Call, _) -->
- { Call = call(_Signature, FuncRval, MaybeObject, CallArgs,
+ { Call = mlcall(_Signature, FuncRval, MaybeObject, CallArgs,
Results, CallKind) },
{ expect(unify(MaybeObject, no), this_file, "method call") },
build_args(CallArgs, DefnInfo, GCC_ArgList),
@@ -3301,7 +3306,7 @@
% symbol table. If it's not in either of those,
% we check if its an RTTI enumeration constant.
%
- { Name = qual(ModuleName, QualKind, data(var(VarName))) },
+ { Name = qual(ModuleName, QualKind, entity_data(var(VarName))) },
(
{ map__search(DefnInfo ^ local_vars, Name, LocalVarDecl) }
->
@@ -3347,7 +3352,8 @@
)
->
ClassName = qual(ModuleName, QualKind, UnqualClassName),
- Name = qual(ModuleName, QualKind, type(UnqualClassName, Arity))
+ Name = qual(ModuleName, QualKind,
+ entity_type(UnqualClassName, Arity))
;
unexpected(this_file, "non-class_type in get_type_name")
).
@@ -3639,10 +3645,10 @@
io__state, io__state).
:- mode build_rval_const(in, in, out, di, uo) is det.
-build_rval_const(true, _, Expr) -->
+build_rval_const(true_const, _, Expr) -->
% XXX currently we don't use a separate boolean type
gcc__build_int(1, Expr).
-build_rval_const(false, _, Expr) -->
+build_rval_const(false_const, _, Expr) -->
% XXX currently we don't use a separate boolean type
gcc__build_int(0, Expr).
build_rval_const(int_const(N), _, Expr) -->
@@ -3677,7 +3683,7 @@
% so we can use make_func_decl below
{ Label = qual(ModuleName, QualKind,
mlds_proc_label(PredLabel, ProcId)) },
- { Name = qual(ModuleName, QualKind, function(PredLabel, ProcId,
+ { Name = qual(ModuleName, QualKind, entity_function(PredLabel, ProcId,
MaybeSeqNum, invalid_pred_id)) },
% build a function declaration for the function,
% and take its address.
Index: compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.163
diff -u -b -r1.163 mlds_to_il.m
--- compiler/mlds_to_il.m 19 Jul 2006 15:18:57 -0000 1.163
+++ compiler/mlds_to_il.m 28 Jul 2006 02:58:58 -0000
@@ -395,7 +395,7 @@
AllExports = list.condense(
list.map(
(func(mlds_foreign_code(_, _, _, Exports)) = Exports),
- map.values(MLDS0 ^ foreign_code))
+ map.values(MLDS0 ^ foreign_code_map))
),
% Generate the exports for this file, they will be placed into
@@ -417,7 +417,7 @@
wrapper_class(Members) =
mlds_defn(
- export(wrapper_class_name),
+ entity_export(wrapper_class_name),
mlds_make_context(term.context_init),
ml_gen_type_decl_flags,
mlds_class(mlds_class_defn(mlds_package, [], [], [], [], Members))
@@ -435,11 +435,11 @@
Entity0 = mlds_function(MaybePredProcId, Params, FunctionBody0,
Attributes),
(
- FunctionBody0 = defined_here(Stmt),
- FunctionBody = defined_here(rename_statement(Stmt))
+ FunctionBody0 = body_defined_here(Stmt),
+ FunctionBody = body_defined_here(rename_statement(Stmt))
;
- FunctionBody0 = external,
- FunctionBody = external
+ FunctionBody0 = body_external,
+ FunctionBody = body_external
),
Entity = mlds_function(MaybePredProcId, Params, FunctionBody,
Attributes)
@@ -491,9 +491,9 @@
= statement(computed_goto(rename_rval(Rval), Labels), Context).
rename_statement(statement(
- call(Signature, Rval, MaybeThis0, Args, Results, TailCall),
+ mlcall(Signature, Rval, MaybeThis0, Args, Results, TailCall),
Context))
- = statement(call(Signature, rename_rval(Rval),
+ = statement(mlcall(Signature, rename_rval(Rval),
MaybeThis, list.map(rename_rval, Args),
list.map(rename_lval, Results), TailCall), Context) :-
(
@@ -555,8 +555,8 @@
:- func rename_const(mlds_rval_const) = mlds_rval_const.
-rename_const(true) = true.
-rename_const(false) = false.
+rename_const(true_const) = true_const.
+rename_const(false_const) = false_const.
rename_const(int_const(I)) = int_const(I).
rename_const(float_const(F)) = float_const(F).
rename_const(string_const(S)) = string_const(S).
@@ -714,12 +714,12 @@
Stmt = statement(block([], []), Context),
Attributes = [],
- Ctor = mlds_function(no, mlds_func_params([], []), defined_here(Stmt),
- Attributes),
+ Ctor = mlds_function(no, mlds_func_params([], []),
+ body_defined_here(Stmt), Attributes),
CtorFlags = init_decl_flags(public, per_instance, non_virtual,
overridable, modifiable, concrete),
- CtorDefn = mlds_defn(export(".ctor"), Context, CtorFlags, Ctor),
+ CtorDefn = mlds_defn(entity_export(".ctor"), Context, CtorFlags, Ctor),
Ctors = [CtorDefn]
;
Ctors = Ctors0
@@ -936,12 +936,13 @@
:- func entity_name_to_ilds_id(mlds_entity_name) = ilds.id.
-entity_name_to_ilds_id(export(Name)) = Name.
-entity_name_to_ilds_id(function(PredLabel, ProcId, MaybeSeqNum, _)) = Name :-
+entity_name_to_ilds_id(entity_export(Name)) = Name.
+entity_name_to_ilds_id(entity_function(PredLabel, ProcId, MaybeSeqNum, _))
+ = Name :-
predlabel_to_id(PredLabel, ProcId, MaybeSeqNum, Name).
-entity_name_to_ilds_id(type(Name, Arity))
+entity_name_to_ilds_id(entity_type(Name, Arity))
= string.format("%s_%d", [s(Name), i(Arity)]).
-entity_name_to_ilds_id(data(DataName))
+entity_name_to_ilds_id(entity_data(DataName))
= mangle_dataname(DataName).
:- func interface_id_to_class_name(mlds_interface_id) = ilds.class_name.
@@ -1086,7 +1087,7 @@
% Generate the code of the statement.
(
- MaybeStatement = defined_here(Statement),
+ MaybeStatement = body_defined_here(Statement),
statement_to_il(Statement, InstrsTree1, !Info),
% Need to insert a ret for functions returning void (MLDS doesn't).
(
@@ -1097,7 +1098,7 @@
MaybeRet = empty
)
;
- MaybeStatement = external,
+ MaybeStatement = body_external,
% XXX The external reference must currently reside in the
% C# file associated with this file. This is very hackish.
@@ -1140,7 +1141,7 @@
% in an exception handler and call the initialization instructions
% in the cctor of this module.
(
- Name = function(PredLabel, _ProcId, MaybeSeqNum, _PredId),
+ Name = entity_function(PredLabel, _ProcId, MaybeSeqNum, _PredId),
PredLabel = mlds_user_pred_label(predicate, no, "main", 2,
model_det, no),
MaybeSeqNum = no
@@ -1382,7 +1383,7 @@
), RetTypes, ReturnVars, 0, _),
EntNameToVarName = (func(EntName) = VarName :-
- ( EntName = data(var(VarName0)) ->
+ ( EntName = entity_data(var(VarName0)) ->
VarName = qual(ModuleName, module_qual, VarName0)
;
unexpected(this_file,
@@ -1400,7 +1401,7 @@
ReturnRvals = list.map((func(X) = lval(X)), ReturnLvals),
Signature = mlds_func_signature(ArgTypes, RetTypes),
- ( UnqualName = function(PredLabel, ProcId, _MaybeSeq, _PredId) ->
+ ( UnqualName = entity_function(PredLabel, ProcId, _MaybeSeq, _PredId) ->
CodeRval = const(code_addr_const(proc(
qual(ModuleName, module_qual, mlds_proc_label(PredLabel, ProcId)),
Signature)))
@@ -1410,7 +1411,7 @@
% XXX Should we look for tail calls?
CallStatement = statement(
- call(Signature, CodeRval, no, ArgRvals, ReturnLvals,
+ mlcall(Signature, CodeRval, no, ArgRvals, ReturnLvals,
ordinary_call), Context),
ReturnStatement = statement(return(ReturnRvals), Context),
@@ -1423,12 +1424,12 @@
), Context),
Attributes = [],
- DefnEntity = mlds_function(no, Params, defined_here(Statement),
+ DefnEntity = mlds_function(no, Params, body_defined_here(Statement),
Attributes),
Flags = init_decl_flags(public, one_copy, non_virtual, overridable,
const, concrete),
- Defn = mlds_defn(export(ExportName), Context, Flags, DefnEntity).
+ Defn = mlds_defn(entity_export(ExportName), Context, Flags, DefnEntity).
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
@@ -1445,7 +1446,7 @@
generate_defn_initializer(mlds_defn(Name, Context, _DeclFlags, Entity),
!Tree, !Info) :-
(
- Name = data(DataName),
+ Name = entity_data(DataName),
Entity = mlds_data(MLDSType, Initializer, _GC_TraceCode)
->
( Initializer = no_initializer ->
@@ -1637,8 +1638,9 @@
atomic_statement_to_il(Atomic, AtomicInstrs, !Info),
Instrs = tree(context_node(Context), AtomicInstrs).
-statement_to_il(statement(call(Sig, Function, _This, Args, Returns, CallKind),
- Context), Instrs, !Info) :-
+statement_to_il(statement(
+ mlcall(Sig, Function, _This, Args, Returns, CallKind), Context),
+ Instrs, !Info) :-
VerifiableCode = !.Info ^ verifiable_code,
ByRefTailCalls = !.Info ^ il_byref_tailcalls,
MsCLR = !.Info ^ support_ms_clr,
@@ -2036,7 +2038,8 @@
(
MaybeCtorName = yes(QualifiedCtorName),
QualifiedCtorName = qual(_, _, ctor_id(CtorName, CtorArity)),
- CtorType = entity_name_to_ilds_id(type(CtorName, CtorArity)),
+ CtorType =
+ entity_name_to_ilds_id(entity_type(CtorName, CtorArity)),
ClassName = append_nested_class_name(ClassName0, [CtorType])
;
MaybeCtorName = no,
@@ -2316,10 +2319,10 @@
DataRep = !.Info ^ il_data_rep,
% true and false are just the integers 1 and 0
(
- Const = true,
+ Const = true_const,
Instrs = instr_node(ldc(bool, i(1)))
;
- Const = false,
+ Const = false_const,
Instrs = instr_node(ldc(bool, i(0)))
;
Const = string_const(Str),
@@ -3424,13 +3427,13 @@
:- pred mangle_entity_name(mlds_entity_name::in, string::out) is det.
-mangle_entity_name(type(_TypeName, _), _MangledName) :-
+mangle_entity_name(entity_type(_TypeName, _), _MangledName) :-
unexpected(this_file, "can't mangle type names").
-mangle_entity_name(data(DataName), MangledName) :-
+mangle_entity_name(entity_data(DataName), MangledName) :-
mangle_dataname(DataName, MangledName).
-mangle_entity_name(function(_, _, _, _), _MangledName) :-
+mangle_entity_name(entity_function(_, _, _, _), _MangledName) :-
unexpected(this_file, "can't mangle function names").
-mangle_entity_name(export(_), _MangledName) :-
+mangle_entity_name(entity_export(_), _MangledName) :-
unexpected(this_file, "can't mangle export names").
% Any valid Mercury identifier will be fine here too.
@@ -3601,8 +3604,8 @@
= mercury_type(FloatType, type_cat_float,
non_foreign_type(FloatType)) :-
FloatType = builtin(float).
-rval_const_to_type(false) = mlds_native_bool_type.
-rval_const_to_type(true) = mlds_native_bool_type.
+rval_const_to_type(false_const) = mlds_native_bool_type.
+rval_const_to_type(true_const) = mlds_native_bool_type.
rval_const_to_type(string_const(_))
= mercury_type(StrType, type_cat_string, non_foreign_type(StrType)) :-
StrType = builtin(string).
@@ -3756,7 +3759,7 @@
defn_to_local(ModuleName, Defn, Id - MLDSType) :-
Defn = mlds_defn(Name, _Context, _DeclFlags, Entity),
(
- Name = data(DataName),
+ Name = entity_data(DataName),
Entity = mlds_data(MLDSType0, _Initializer, _GC_TraceCode)
->
mangle_dataname(DataName, MangledDataName),
Index: compiler/mlds_to_java.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_java.m,v
retrieving revision 1.78
diff -u -b -r1.78 mlds_to_java.m
--- compiler/mlds_to_java.m 19 Jul 2006 15:18:57 -0000 1.78
+++ compiler/mlds_to_java.m 28 Jul 2006 03:16:36 -0000
@@ -589,10 +589,10 @@
method_ptrs_in_entity_defn(mlds_function(_MaybeID, _Params, Body,
_Attributes), !CodeAddrs) :-
(
- Body = defined_here(Statement),
+ Body = body_defined_here(Statement),
method_ptrs_in_statement(Statement, !CodeAddrs)
;
- Body = external
+ Body = body_external
).
method_ptrs_in_entity_defn(mlds_data(_Type, Initializer, _GC_TraceCode),
!CodeAddrs) :-
@@ -662,7 +662,7 @@
% of type mlds_commit_type.
method_ptrs_in_stmt(return(Rvals), !CodeAddrs) :-
method_ptrs_in_rvals(Rvals, !CodeAddrs).
-method_ptrs_in_stmt(call(_FuncSig, _Rval, _MaybeThis, Rvals, _ReturnVars,
+method_ptrs_in_stmt(mlcall(_FuncSig, _Rval, _MaybeThis, Rvals, _ReturnVars,
_IsTailCall), !CodeAddrs) :-
% We don't check "_Rval" - it may be a code address but is a
% standard call rather than a function pointer use.
@@ -848,7 +848,7 @@
% Put it all together.
ClassMembers = [MethodDefn],
ClassCtors = [],
- ClassName = type(MangledClassEntityName, 0),
+ ClassName = entity_type(MangledClassEntityName, 0),
ClassContext = Context,
ClassFlags = ml_gen_type_decl_flags,
ClassBodyDefn = mlds_class_defn(mlds_class, ClassImports,
@@ -876,13 +876,13 @@
% Create new method name.
Label = mlds_special_pred_label("call", no, "", 0),
- MethodName = function(Label, ProcID, no, PredID),
+ MethodName = entity_function(Label, ProcID, no, PredID),
% Create method argument and return type.
% It will have the argument type java.lang.Object[]
% It will have the return type java.lang.Object
MethodArgVariable = mlds_var_name("args", no),
- MethodArgType = mlds_argument(data(var(MethodArgVariable)),
+ MethodArgType = mlds_argument(entity_data(var(MethodArgVariable)),
mlds_array_type(mlds_generic_type), no),
MethodRetType = mlds_generic_type,
MethodArgs = [MethodArgType],
@@ -905,7 +905,7 @@
ReturnVarType = mlds_array_type(mlds_generic_type)
),
ReturnLval = var(ReturnVar, ReturnVarType),
- ReturnEntityName = data(var(ReturnVarName)),
+ ReturnEntityName = entity_data(var(ReturnVarName)),
ReturnDecFlags = ml_gen_local_var_decl_flags,
GCTraceCode = no, % The Java back-end does its own garbage collection.
@@ -930,7 +930,7 @@
OrigRetTypes = [_ | _],
CallRetLvals = [ReturnLval]
),
- Call = call(OrigFuncSignature, CallRval, no, CallArgs,
+ Call = mlcall(OrigFuncSignature, CallRval, no, CallArgs,
CallRetLvals, ordinary_call),
CallStatement = statement(Call, Context),
@@ -948,7 +948,7 @@
MethodMaybeID = no,
MethodAttribs = [],
MethodBody = mlds_function(MethodMaybeID, MethodParams,
- defined_here(Statements), MethodAttribs),
+ body_defined_here(Statements), MethodAttribs),
MethodFlags = ml_gen_special_member_decl_flags,
MethodDefn = mlds_defn(MethodName, Context, MethodFlags, MethodBody).
@@ -1172,7 +1172,7 @@
output_defn(Indent, ModuleInfo, ModuleName, CtorData, Defn, !IO) :-
Defn = mlds_defn(Name, Context, Flags, DefnBody),
indent_line(Context, Indent, !IO),
- ( DefnBody = mlds_function(_, _, external, _) ->
+ ( DefnBody = mlds_function(_, _, body_external, _) ->
% This is just a function declaration, with no body.
% Java doesn't support separate declarations and definitions,
% so just output the declaration as a comment.
@@ -1219,8 +1219,9 @@
output_class(Indent, ModuleInfo, Name, _Context, ClassDefn, !IO) :-
Name = qual(ModuleName, _QualKind, UnqualName),
- ( UnqualName = type(_, _) ->
- true
+ ( UnqualName = entity_type(ClassNamePrime, ArityPrime) ->
+ ClassName = ClassNamePrime,
+ Arity = ArityPrime
;
unexpected(this_file, "output_class")
),
@@ -1231,7 +1232,7 @@
;
io.write_string("class ", !IO)
),
- output_class_name_and_arity(UnqualName, !IO),
+ output_class_name_and_arity(ClassName, Arity, !IO),
io.nl(!IO),
output_extends_list(Indent + 1, BaseClasses, !IO),
output_implements_list(Indent + 1, Implements, !IO),
@@ -1581,7 +1582,7 @@
output_func(Indent, ModuleInfo, Name, CtorData, Context, Signature, MaybeBody,
!IO) :-
(
- MaybeBody = defined_here(Body),
+ MaybeBody = body_defined_here(Body),
output_func_decl(Indent, Name, CtorData, Context, Signature, !IO),
io.write_string("\n", !IO),
indent_line(Context, Indent, !IO),
@@ -1592,7 +1593,7 @@
indent_line(Context, Indent, !IO),
io.write_string("}\n", !IO) % end the function
;
- MaybeBody = external
+ MaybeBody = body_external
).
:- pred output_func_decl(indent::in, mlds_qualified_entity_name::in,
@@ -1699,18 +1700,12 @@
output_module_name(ModuleName, !IO) :-
io.write_string(sym_name_mangle(ModuleName), !IO).
-:- pred output_class_name_and_arity(mlds_entity_name::in, io::di, io::uo)
- is det.
+:- pred output_class_name_and_arity(mlds_class_name::in, arity::in,
+ io::di, io::uo) is det.
-output_class_name_and_arity(type(Name, Arity), !IO) :-
+output_class_name_and_arity(Name, Arity, !IO) :-
output_class_name(Name, !IO),
io.format("_%d", [i(Arity)], !IO).
-output_class_name_and_arity(data(_), !IO) :-
- unexpected(this_file, "output_class_name_and_arity").
-output_class_name_and_arity(function(_, _, _, _), !IO) :-
- unexpected(this_file, "output_class_name_and_arity").
-output_class_name_and_arity(export(_), !IO) :-
- unexpected(this_file, "output_class_name_and_arity").
:- pred output_class_name(mlds_class_name::in, io::di, io::uo) is det.
@@ -1722,11 +1717,11 @@
:- pred output_name(mlds_entity_name::in, io::di, io::uo) is det.
-output_name(type(Name, Arity), !IO) :-
- output_class_name_and_arity(type(Name, Arity), !IO).
-output_name(data(DataName), !IO) :-
+output_name(entity_type(Name, Arity), !IO) :-
+ output_class_name_and_arity(Name, Arity, !IO).
+output_name(entity_data(DataName), !IO) :-
output_data_name(DataName, !IO).
-output_name(function(PredLabel, ProcId, MaybeSeqNum, _PredId), !IO) :-
+output_name(entity_function(PredLabel, ProcId, MaybeSeqNum, _PredId), !IO) :-
output_pred_label(PredLabel, !IO),
proc_id_to_int(ProcId, ModeNum),
io.format("_%d", [i(ModeNum)], !IO),
@@ -1736,7 +1731,7 @@
;
MaybeSeqNum = no
).
-output_name(export(Name), !IO) :-
+output_name(entity_export(Name), !IO) :-
io.write_string(Name, !IO).
:- pred output_pred_label(mlds_pred_label::in, io::di, io::uo) is det.
@@ -2189,7 +2184,7 @@
% The contained statement is reachable iff the while statement is
% reachable and the condition expression is not a constant expression
% whose value is false.
- ( Cond = const(false) ->
+ ( Cond = const(false_const) ->
indent_line(Indent, !IO),
io.write_string("{ /* Unreachable code */ }\n", !IO),
ExitMethods = set.make_singleton_set(can_fall_through)
@@ -2298,7 +2293,7 @@
%
output_stmt(Indent, ModuleInfo, CallerFuncInfo, Call, Context, ExitMethods,
!IO) :-
- Call = call(Signature, FuncRval, MaybeObject, CallArgs, Results,
+ Call = mlcall(Signature, FuncRval, MaybeObject, CallArgs, Results,
_IsTailCall),
Signature = mlds_func_signature(ArgTypes, RetTypes),
ModuleName = CallerFuncInfo ^ func_info_name ^ mod_name,
@@ -2532,7 +2527,7 @@
% XXX This is not a sufficient way of testing for a Java
% "constant expression", though determining these accurately
% is a little difficult to do here.
- Cond = const(true),
+ Cond = const(true_const),
not set.member(can_break, BlockExitMethods)
->
% Cannot complete normally
@@ -2798,7 +2793,7 @@
io.write_char('.', !IO),
QualifiedCtorId = qual(_ModuleName, _QualKind, CtorDefn),
CtorDefn = ctor_id(CtorName, CtorArity),
- output_class_name_and_arity(type(CtorName, CtorArity), !IO)
+ output_class_name_and_arity(CtorName, CtorArity, !IO)
;
output_type(Type, !IO)
),
@@ -2970,8 +2965,8 @@
output_lval(_, var(qual(ModName, QualKind, Name), _), CurrentModuleName,
!IO) :-
- output_maybe_qualified_name(qual(ModName, QualKind, data(var(Name))),
- CurrentModuleName, !IO).
+ QualName = qual(ModName, QualKind, entity_data(var(Name))),
+ output_maybe_qualified_name(QualName, CurrentModuleName, !IO).
:- pred output_mangled_name(string::in, io::di, io::uo) is det.
@@ -3257,10 +3252,10 @@
:- pred output_rval_const(mlds_rval_const::in, io::di, io::uo) is det.
-output_rval_const(true, !IO) :-
+output_rval_const(true_const, !IO) :-
io.write_string("true", !IO).
-output_rval_const(false, !IO) :-
+output_rval_const(false_const, !IO) :-
io.write_string("false", !IO).
output_rval_const(int_const(N), !IO) :-
Index: compiler/mlds_to_managed.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_managed.m,v
retrieving revision 1.30
diff -u -b -r1.30 mlds_to_managed.m
--- compiler/mlds_to_managed.m 19 Jul 2006 15:18:58 -0000 1.30
+++ compiler/mlds_to_managed.m 28 Jul 2006 03:03:36 -0000
@@ -345,15 +345,15 @@
:- pred generate_method_code(foreign_language::in(managed_lang),
mlds_module_name::in, mlds_defn::in, io::di, io::uo) is det.
-generate_method_code(_, _, mlds_defn(export(_), _, _, _), !IO).
-generate_method_code(_, _, mlds_defn(data(_), _, _, _), !IO).
-generate_method_code(_, _, mlds_defn(type(_, _), _, _, _), !IO).
+generate_method_code(_, _, mlds_defn(entity_export(_), _, _, _), !IO).
+generate_method_code(_, _, mlds_defn(entity_data(_), _, _, _), !IO).
+generate_method_code(_, _, mlds_defn(entity_type(_, _), _, _, _), !IO).
generate_method_code(Lang, _ModuleName, Defn, !IO) :-
- Defn = mlds_defn(function(PredLabel, ProcId, MaybeSeqNum, _PredId),
+ Defn = mlds_defn(entity_function(PredLabel, ProcId, MaybeSeqNum, _PredId),
_Context, _DeclFlags, Entity),
(
% XXX we ignore the attributes
- Entity = mlds_function(_, Params, defined_here(Statement),
+ Entity = mlds_function(_, Params, body_defined_here(Statement),
_Attributes),
has_foreign_languages(Statement, Langs),
list.member(Lang, Langs)
@@ -485,7 +485,7 @@
write_declare_and_assign_local(Lang, mlds_argument(Name, Type, _GcCode),
!IO) :-
- ( Name = data(var(VarName0)) ->
+ ( Name = entity_data(var(VarName0)) ->
VarName = VarName0
;
unexpected(this_file, "not a variable name")
@@ -523,7 +523,7 @@
mlds_argument::in, io::di, io::uo) is det.
write_assign_local_to_output(Lang, mlds_argument(Name, Type, _GcCode), !IO) :-
- ( Name = data(var(VarName0)) ->
+ ( Name = entity_data(var(VarName0)) ->
VarName = VarName0
;
unexpected(this_file, "not a variable name")
@@ -617,9 +617,9 @@
:- pred write_rval_const(foreign_language::in(managed_lang),
mlds_rval_const::in, io::di, io::uo) is det.
-write_rval_const(_Lang, true, !IO) :-
+write_rval_const(_Lang, true_const, !IO) :-
io.write_string("1", !IO).
-write_rval_const(_Lang, false, !IO) :-
+write_rval_const(_Lang, false_const, !IO) :-
io.write_string("0", !IO).
write_rval_const(_Lang, int_const(I), !IO) :-
io.write_int(I, !IO).
@@ -703,7 +703,7 @@
Defn = mlds_defn(Name, _Context, _Flags, DefnBody),
(
DefnBody = mlds_data(Type, _Initializer, _GC_TraceCode),
- Name = data(var(VarName))
+ Name = entity_data(var(VarName))
->
write_parameter_type(Lang, Type, !IO),
io.write_string(" ", !IO),
@@ -731,7 +731,7 @@
write_il_type_as_foreign_type(Lang, mlds_type_to_ilds_type(DataRep, Type),
!IO),
io.write_string(" ", !IO),
- ( EntityName = data(var(VarName)) ->
+ ( EntityName = entity_data(var(VarName)) ->
write_mlds_var_name_for_parameter(VarName, !IO)
;
unexpected(this_file, "found a variable in a list")
Index: compiler/opt_debug.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/opt_debug.m,v
retrieving revision 1.170
diff -u -b -r1.170 opt_debug.m
--- compiler/opt_debug.m 27 Jul 2006 05:01:16 -0000 1.170
+++ compiler/opt_debug.m 28 Jul 2006 02:32:01 -0000
@@ -637,7 +637,7 @@
Instr = assign(Lval, Rval),
Str = dump_lval(Lval) ++ " := " ++ dump_rval(Rval)
;
- Instr = call(Callee, ReturnLabel, _LiveInfo, _Context, _GoalPath,
+ Instr = llcall(Callee, ReturnLabel, _LiveInfo, _Context, _GoalPath,
CallModel),
(
CallModel = call_model_det,
@@ -699,8 +699,8 @@
Str = "computed_goto " ++ dump_rval(Rval) ++ ":"
++ dump_labels(ProcLabel, Labels)
;
- Instr = c_code(Code, _),
- Str = "c_code(" ++ Code ++ ")"
+ Instr = arbitrary_c_code(Code, _),
+ Str = "arbitrary_c_code(" ++ Code ++ ")"
;
Instr = if_val(Rval, CodeAddr),
Str = "if (" ++ dump_rval(Rval) ++ ") goto "
Index: compiler/opt_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/opt_util.m,v
retrieving revision 1.150
diff -u -b -r1.150 opt_util.m
--- compiler/opt_util.m 27 Jul 2006 05:01:16 -0000 1.150
+++ compiler/opt_util.m 28 Jul 2006 02:34:03 -0000
@@ -774,10 +774,13 @@
instr_refers_to_stack(Uinstr - _) = Refers :-
(
- Uinstr = comment(_),
- Refers = no
- ;
- Uinstr = livevals(_),
+ ( Uinstr = comment(_)
+ ; Uinstr = livevals(_)
+ ; Uinstr = label(_)
+ ; Uinstr = arbitrary_c_code(_, _)
+ ; Uinstr = discard_ticket
+ ; Uinstr = prune_ticket
+ ),
Refers = no
;
Uinstr = block(_, _, BlockInstrs),
@@ -788,24 +791,18 @@
lval_refers_stackvars(Lval),
rval_refers_stackvars(Rval))
;
- Uinstr = call(_, _, _, _, _, _),
+ Uinstr = llcall(_, _, _, _, _, _),
Refers = yes
;
Uinstr = mkframe(_, _),
Refers = yes
;
- Uinstr = label(_),
- Refers = no
- ;
Uinstr = goto(CodeAddr),
Refers = code_addr_refers_to_stack(CodeAddr)
;
Uinstr = computed_goto(Rval, _Labels),
Refers = rval_refers_stackvars(Rval)
;
- Uinstr = c_code(_, _),
- Refers = no
- ;
Uinstr = if_val(Rval, CodeAddr),
Refers = bool.or(
rval_refers_stackvars(Rval),
@@ -837,12 +834,6 @@
Uinstr = reset_ticket(Rval, _Reason),
Refers = rval_refers_stackvars(Rval)
;
- Uinstr = discard_ticket,
- Refers = no
- ;
- Uinstr = prune_ticket,
- Refers = no
- ;
Uinstr = mark_ticket_stack(Lval),
Refers = lval_refers_stackvars(Lval)
;
@@ -986,12 +977,12 @@
can_instr_branch_away(livevals(_), no).
can_instr_branch_away(block(_, _, _), yes).
can_instr_branch_away(assign(_, _), no).
-can_instr_branch_away(call(_, _, _, _, _, _), yes).
+can_instr_branch_away(llcall(_, _, _, _, _, _), yes).
can_instr_branch_away(mkframe(_, _), no).
can_instr_branch_away(label(_), no).
can_instr_branch_away(goto(_), yes).
can_instr_branch_away(computed_goto(_, _), yes).
-can_instr_branch_away(c_code(_, _), no).
+can_instr_branch_away(arbitrary_c_code(_, _), no).
can_instr_branch_away(if_val(_, _), yes).
can_instr_branch_away(save_maxfr(_), no).
can_instr_branch_away(restore_maxfr(_), no).
@@ -1063,12 +1054,12 @@
can_instr_fall_through(block(_, _, Instrs), FallThrough) :-
can_block_fall_through(Instrs, FallThrough).
can_instr_fall_through(assign(_, _), yes).
-can_instr_fall_through(call(_, _, _, _, _, _), no).
+can_instr_fall_through(llcall(_, _, _, _, _, _), no).
can_instr_fall_through(mkframe(_, _), yes).
can_instr_fall_through(label(_), yes).
can_instr_fall_through(goto(_), no).
can_instr_fall_through(computed_goto(_, _), no).
-can_instr_fall_through(c_code(_, _), yes).
+can_instr_fall_through(arbitrary_c_code(_, _), yes).
can_instr_fall_through(if_val(_, _), yes).
can_instr_fall_through(save_maxfr(_), yes).
can_instr_fall_through(restore_maxfr(_), yes).
@@ -1110,12 +1101,12 @@
can_use_livevals(livevals(_), no).
can_use_livevals(block(_, _, _), no).
can_use_livevals(assign(_, _), no).
-can_use_livevals(call(_, _, _, _, _, _), yes).
+can_use_livevals(llcall(_, _, _, _, _, _), yes).
can_use_livevals(mkframe(_, _), no).
can_use_livevals(label(_), no).
can_use_livevals(goto(_), yes).
can_use_livevals(computed_goto(_, _), no).
-can_use_livevals(c_code(_, _), no).
+can_use_livevals(arbitrary_c_code(_, _), no).
can_use_livevals(if_val(_, _), yes).
can_use_livevals(save_maxfr(_), no).
can_use_livevals(restore_maxfr(_), no).
@@ -1173,13 +1164,13 @@
instr_labels_2(block(_, _, Instrs), Labels, CodeAddrs) :-
instr_list_labels(Instrs, Labels, CodeAddrs).
instr_labels_2(assign(_,_), [], []).
-instr_labels_2(call(Target, Ret, _, _, _, _), [], [Target, Ret]).
+instr_labels_2(llcall(Target, Ret, _, _, _, _), [], [Target, Ret]).
instr_labels_2(mkframe(_, yes(Addr)), [], [Addr]).
instr_labels_2(mkframe(_, no), [], []).
instr_labels_2(label(_), [], []).
instr_labels_2(goto(Addr), [], [Addr]).
instr_labels_2(computed_goto(_, Labels), Labels, []).
-instr_labels_2(c_code(_, _), [], []).
+instr_labels_2(arbitrary_c_code(_, _), [], []).
instr_labels_2(if_val(_, Addr), [], [Addr]).
instr_labels_2(save_maxfr(_), [], []).
instr_labels_2(restore_maxfr(_), [], []).
@@ -1215,7 +1206,7 @@
possible_targets(block(_, _, _), _, _) :-
unexpected(this_file, "block in possible_targets").
possible_targets(assign(_, _), [], []).
-possible_targets(call(_, Return, _, _, _, _), Labels, CodeAddrs) :-
+possible_targets(llcall(_, Return, _, _, _, _), Labels, CodeAddrs) :-
( Return = label(ReturnLabel) ->
Labels = [ReturnLabel],
CodeAddrs = []
@@ -1234,7 +1225,7 @@
CodeAddrs = [CodeAddr]
).
possible_targets(computed_goto(_, Labels), Labels, []).
-possible_targets(c_code(_, _), [], []).
+possible_targets(arbitrary_c_code(_, _), [], []).
possible_targets(if_val(_, CodeAddr), Labels, CodeAddrs) :-
( CodeAddr = label(Label) ->
Labels = [Label],
@@ -1310,12 +1301,12 @@
instr_rvals_and_lvals(block(_, _, Instrs), Labels, CodeAddrs) :-
instr_list_rvals_and_lvals(Instrs, Labels, CodeAddrs).
instr_rvals_and_lvals(assign(Lval,Rval), [Rval], [Lval]).
-instr_rvals_and_lvals(call(_, _, _, _, _, _), [], []).
+instr_rvals_and_lvals(llcall(_, _, _, _, _, _), [], []).
instr_rvals_and_lvals(mkframe(_, _), [], []).
instr_rvals_and_lvals(label(_), [], []).
instr_rvals_and_lvals(goto(_), [], []).
instr_rvals_and_lvals(computed_goto(Rval, _), [Rval], []).
-instr_rvals_and_lvals(c_code(_, _), [], []).
+instr_rvals_and_lvals(arbitrary_c_code(_, _), [], []).
instr_rvals_and_lvals(if_val(Rval, _), [Rval], []).
instr_rvals_and_lvals(save_maxfr(Lval), [], [Lval]).
instr_rvals_and_lvals(restore_maxfr(Lval), [], [Lval]).
@@ -1442,7 +1433,7 @@
count_temps_instr(assign(Lval, Rval), !R, !F) :-
count_temps_lval(Lval, !R, !F),
count_temps_rval(Rval, !R, !F).
-count_temps_instr(call(_, _, _, _, _, _), !R, !F).
+count_temps_instr(llcall(_, _, _, _, _, _), !R, !F).
count_temps_instr(mkframe(_, _), !R, !F).
count_temps_instr(label(_), !R, !F).
count_temps_instr(goto(_), !R, !F).
@@ -1450,7 +1441,7 @@
count_temps_rval(Rval, !R, !F).
count_temps_instr(if_val(Rval, _), !R, !F) :-
count_temps_rval(Rval, !R, !F).
-count_temps_instr(c_code(_, _), !R, !F).
+count_temps_instr(arbitrary_c_code(_, _), !R, !F).
count_temps_instr(save_maxfr(Lval), !R, !F) :-
count_temps_lval(Lval, !R, !F).
count_temps_instr(restore_maxfr(Lval), !R, !F) :-
@@ -1578,9 +1569,9 @@
( Uinstr = mkframe(_, _)
; Uinstr = goto(_)
; Uinstr = computed_goto(_, _)
- ; Uinstr = call(_, _, _, _, _, _) % This is a safe approximation.
+ ; Uinstr = llcall(_, _, _, _, _, _) % This is a safe approximation.
; Uinstr = if_val(_, _)
- ; Uinstr = c_code(_, _)
+ ; Uinstr = arbitrary_c_code(_, _)
; Uinstr = save_maxfr(_)
; Uinstr = restore_maxfr(_)
; Uinstr = init_sync_term(_, _) % This is a safe approximation.
@@ -1819,8 +1810,8 @@
Lval = Lval0,
Rval = Rval0
).
-replace_labels_instr(call(Target, Return0, LiveInfo, CXT, GP, CM),
- ReplMap, _, call(Target, Return, LiveInfo, CXT, GP, CM)) :-
+replace_labels_instr(llcall(Target, Return0, LiveInfo, CXT, GP, CM),
+ ReplMap, _, llcall(Target, Return, LiveInfo, CXT, GP, CM)) :-
replace_labels_code_addr(Return0, ReplMap, Return).
replace_labels_instr(mkframe(NondetFrameInfo, MaybeRedoip0), ReplMap,
ReplData, mkframe(NondetFrameInfo, MaybeRedoip)) :-
@@ -1859,7 +1850,8 @@
Rval = Rval0
),
replace_labels_label_list(Labels0, ReplMap, Labels).
-replace_labels_instr(c_code(Code, Lvals), _, _, c_code(Code, Lvals)).
+replace_labels_instr(arbitrary_c_code(Code, Lvals), _, _,
+ arbitrary_c_code(Code, Lvals)).
replace_labels_instr(if_val(Rval0, Target0), ReplMap, ReplData,
if_val(Rval, Target)) :-
(
Index: compiler/proc_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/proc_gen.m,v
retrieving revision 1.3
diff -u -b -r1.3 proc_gen.m
--- compiler/proc_gen.m 27 Jul 2006 05:01:19 -0000 1.3
+++ compiler/proc_gen.m 28 Jul 2006 02:34:19 -0000
@@ -1107,12 +1107,12 @@
set.insert(LiveVals0, stackvar(StackLoc), LiveVals1),
Instrn = livevals(LiveVals1)
;
- Instrn0 = call(Target, ReturnLabel, LiveVals0, Context, GP, CM)
+ Instrn0 = llcall(Target, ReturnLabel, LiveVals0, Context, GP, CM)
->
map.init(Empty),
LiveVals = [live_lvalue(direct(stackvar(StackLoc)), succip, Empty)
| LiveVals0],
- Instrn = call(Target, ReturnLabel, LiveVals, Context, GP, CM)
+ Instrn = llcall(Target, ReturnLabel, LiveVals, Context, GP, CM)
;
Instrn = Instrn0
),
Index: compiler/reassign.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/reassign.m,v
retrieving revision 1.16
diff -u -b -r1.16 reassign.m
--- compiler/reassign.m 29 Mar 2006 08:07:20 -0000 1.16
+++ compiler/reassign.m 28 Jul 2006 02:34:32 -0000
@@ -171,7 +171,7 @@
)
)
;
- Uinstr0 = call(_, _, _, _, _, _),
+ Uinstr0 = llcall(_, _, _, _, _, _),
!:RevInstrs = [Instr0 | !.RevInstrs],
% The call may clobber any lval.
!:KnownContentsMap = map.init,
@@ -203,7 +203,7 @@
!:KnownContentsMap = map.init,
!:DepLvalMap = map.init
;
- Uinstr0 = c_code(_, _),
+ Uinstr0 = arbitrary_c_code(_, _),
!:RevInstrs = [Instr0 | !.RevInstrs],
% The C code may clobber any lval.
!:KnownContentsMap = map.init,
Index: compiler/rtti_to_mlds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/rtti_to_mlds.m,v
retrieving revision 1.71
diff -u -b -r1.71 rtti_to_mlds.m
--- compiler/rtti_to_mlds.m 8 Jun 2006 08:19:30 -0000 1.71
+++ compiler/rtti_to_mlds.m 28 Jul 2006 03:03:47 -0000
@@ -102,7 +102,7 @@
mlds_defn_is_potentially_duplicated(MLDS_Defn) :-
MLDS_Defn = mlds_defn(EntityName, _, _, _),
- EntityName = data(DataName),
+ EntityName = entity_data(DataName),
DataName = mlds_rtti(ctor_rtti_id(_, RttiName)),
( RttiName = type_info(_)
; RttiName = pseudo_type_info(_)
@@ -119,7 +119,7 @@
MLDS_Defns = []
;
rtti_data_to_id(RttiData, RttiId),
- Name = data(mlds_rtti(RttiId)),
+ Name = entity_data(mlds_rtti(RttiId)),
gen_init_rtti_data_defn(RttiData, RttiId, ModuleInfo,
Initializer, ExtraDefns),
rtti_entity_name_and_init_to_defn(Name, RttiId, Initializer,
@@ -138,7 +138,7 @@
mlds_defn::out) is det.
rtti_id_and_init_to_defn(RttiId, Initializer, MLDS_Defn) :-
- Name = data(mlds_rtti(RttiId)),
+ Name = entity_data(mlds_rtti(RttiId)),
rtti_entity_name_and_init_to_defn(Name, RttiId, Initializer, MLDS_Defn).
:- pred rtti_entity_name_and_init_to_defn(mlds_entity_name::in, rtti_id::in,
Index: compiler/trace_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trace_gen.m,v
retrieving revision 1.1
diff -u -b -r1.1 trace_gen.m
--- compiler/trace_gen.m 27 Jul 2006 05:01:28 -0000 1.1
+++ compiler/trace_gen.m 28 Jul 2006 02:34:54 -0000
@@ -660,7 +660,7 @@
),
ResetStmt = MacroStr ++ "(" ++ CallDepthStr ++ ");\n",
TraceCode = node([
- c_code(ResetStmt, live_lvals_info(set.init)) - ""
+ arbitrary_c_code(ResetStmt, live_lvals_info(set.init)) - ""
])
;
MaybeTraceInfo = no,
Index: compiler/use_local_vars.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/use_local_vars.m,v
retrieving revision 1.22
diff -u -b -r1.22 use_local_vars.m
--- compiler/use_local_vars.m 29 Mar 2006 08:07:29 -0000 1.22
+++ compiler/use_local_vars.m 28 Jul 2006 02:35:13 -0000
@@ -244,7 +244,7 @@
yes, !:MaybeCompulsoryLvals),
union_maybe_compulsory_lvals(LiveLvals, !MaybeCompulsoryLvals)
;
- Uinstr = call(_, _, _, _, _, _)
+ Uinstr = llcall(_, _, _, _, _, _)
->
expect(unify(PrevLivevals, yes),
this_file, "find_compulsory_lvals: call without livevals"),
@@ -465,7 +465,7 @@
substitute_lval_in_instr_until_defn(OldLval, NewLval, !Instrs, !N)
)
;
- Uinstr0 = call(_, _, _, _, _, _)
+ Uinstr0 = llcall(_, _, _, _, _, _)
;
Uinstr0 = mkframe(_, _)
;
@@ -526,7 +526,7 @@
;
Uinstr0 = join_and_continue(_, _)
;
- Uinstr0 = c_code(_, _)
+ Uinstr0 = arbitrary_c_code(_, _)
;
Uinstr0 = pragma_c(_, _, _, _, _, _, _, _, _)
).
Index: compiler/wrap_blocks.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/wrap_blocks.m,v
retrieving revision 1.12
diff -u -b -r1.12 wrap_blocks.m
--- compiler/wrap_blocks.m 29 Mar 2006 08:07:29 -0000 1.12
+++ compiler/wrap_blocks.m 28 Jul 2006 02:35:20 -0000
@@ -78,7 +78,7 @@
% because including it in the block causes the test case
% debugger/all_solutions to fail.
- ( ( Uinstr0 = label(_) ; Uinstr0 = call(_, _, _, _, _, _) ) ->
+ ( ( Uinstr0 = label(_) ; Uinstr0 = llcall(_, _, _, _, _, _) ) ->
list.reverse(RevSofar, BlockInstrs),
wrap_instrs(Instrs0, 0, 0, [], Instrs1),
Instrs = [block(R1, F1, BlockInstrs) - "", Instr0 | Instrs1]
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
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