[m-rev.] diff: delete LLDS support for nondet foreign code
Julien Fischer
juliensf at csse.unimelb.edu.au
Fri Jun 17 17:10:33 AEST 2011
Branches: main
Delete LLDS support for nondet foreign code.
compiler/llds.m:
Remove support for save structs from the LLDS.
compiler/dupproc.m:
compiler/frameopt.m:
compiler/llds_out_instr.m:
compiler/opt_debug.m:
compiler/peephole.m:
compiler/proc_gen.m:
Conform to the above change.
compiler/.cvsignore:
Ignore .compiler_tags; delete references to Aditi backend
files.
Julien.
Index: compiler/.cvsignore
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/.cvsignore,v
retrieving revision 1.26
diff -u -r1.26 .cvsignore
--- compiler/.cvsignore 15 Jun 2007 12:41:46 -0000 1.26
+++ compiler/.cvsignore 17 Jun 2011 07:05:07 -0000
@@ -15,7 +15,6 @@
*.date0
*.date3
*.used
-aditi_backend.m rl_file.m rl_out.m
maybe_mlds_to_gcc.m
*.pp_date
mercury_compile.stats
@@ -40,3 +39,4 @@
*.trans_opt_date
COMP_FLAGS
config.log
+.compiler_tags
Index: compiler/dupproc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dupproc.m,v
retrieving revision 1.30
diff -u -r1.30 dupproc.m
--- compiler/dupproc.m 23 May 2011 05:08:02 -0000 1.30
+++ compiler/dupproc.m 17 Jun 2011 06:54:50 -0000
@@ -195,8 +195,8 @@
FrameInfo = temp_frame(_),
StdFrameInfo = FrameInfo
;
- FrameInfo = ordinary_frame(_, NumSlots, MaybePragma),
- StdFrameInfo = ordinary_frame("", NumSlots, MaybePragma)
+ FrameInfo = ordinary_frame(_, NumSlots),
+ StdFrameInfo = ordinary_frame("", NumSlots)
),
standardize_maybe_code_addr(MaybeCodeAddr, MaybeStdCodeAddr,
DupProcMap),
Index: compiler/frameopt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/frameopt.m,v
retrieving revision 1.125
diff -u -r1.125 frameopt.m
--- compiler/frameopt.m 23 May 2011 05:08:02 -0000 1.125
+++ compiler/frameopt.m 17 Jun 2011 06:55:54 -0000
@@ -308,7 +308,7 @@
nondetstack_setup(Instrs0, FrameInfo, Redoip, MkframeInstr, Remain) :-
Instrs0 = [MkframeInstr | Remain],
MkframeInstr = llds_instr(mkframe(FrameInfo, yes(Redoip)), _),
- FrameInfo = ordinary_frame(_, _, _).
+ FrameInfo = ordinary_frame(_, _).
:- pred find_succeed_labels(list(instruction)::in, tailmap::in, tailmap::out)
is det.
@@ -799,7 +799,7 @@
% then even this entry block needs a stack frame, so frameopt cannot do
% anything.
Redoip = do_fail,
- FrameInfo = ordinary_frame(Msg, Size, no),
+ FrameInfo = ordinary_frame(Msg, Size),
EntryInfo = nondet_entry(Msg, Size, Redoip).
%-----------------------------------------------------------------------------%
@@ -2149,7 +2149,7 @@
:- func nondet_late_setup(nondet_entry_info) = list(instruction).
nondet_late_setup(nondet_entry(Msg, FrameSize, Redoip)) =
- [llds_instr(mkframe(ordinary_frame(Msg, FrameSize, no), yes(Redoip)),
+ [llds_instr(mkframe(ordinary_frame(Msg, FrameSize), yes(Redoip)),
"late setup")].
:- func nondet_non_teardown_exit_code(nondet_exit_info) = list(instruction).
Index: compiler/llds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds.m,v
retrieving revision 1.375
diff -u -r1.375 llds.m
--- compiler/llds.m 24 May 2011 00:53:01 -0000 1.375
+++ compiler/llds.m 17 Jun 2011 06:54:09 -0000
@@ -664,11 +664,7 @@
)
; ordinary_frame(
string, % Name of the predicate.
- int, % Number of framevar slots.
- maybe(foreign_proc_struct)
- % If yes, the frame should also contain
- % this struct (for use by a model_non
- % pragma C code).
+ int % Number of framevar slots.
).
:- type c_code_live_lvals
@@ -703,23 +699,6 @@
% whether cell reuse was actually possible.
).
- % Procedures defined by nondet pragma C codes must have some way of
- % preserving information after a success, so that when control
- % backtracks to the procedure, the C code knows what to do.
- % Our implementation saves this information in a C struct.
- % Programmers must include the declaration of the fields of this
- % C struct in the `pragma c_code' declaration itself.
- % A foreign_proc_struct holds information about this C struct.
- %
-:- type foreign_proc_struct
- ---> foreign_proc_struct(
- string, % The name of the struct tag.
- string, % The field declarations, supplied by the user
- % in the `pragma foreign_proc' % declaration.
- maybe(prog_context)
- % Where the field declarations originally appeared.
- ).
-
% A foreign_proc_decl holds the information needed for the declaration
% of a local variable in a block of C code emitted for a foreign_proc_code
% instruction.
@@ -732,13 +711,6 @@
% in the C code.
string % The name of the local variable that will hold
% the value of that argument inside the C block.
- )
- ; foreign_proc_struct_ptr_decl(
- % This local variable holds the address of the save struct.
- string, % The name of the C struct tag of the save struct;
- % the type of the local variable will be a pointer
- % to a struct with this tag.
- string % The name of the local variable.
).
% A foreign_proc_component holds one component of a foreign_proc_code
Index: compiler/llds_out_instr.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds_out_instr.m,v
retrieving revision 1.8
diff -u -r1.8 llds_out_instr.m
--- compiler/llds_out_instr.m 24 May 2011 00:53:01 -0000 1.8
+++ compiler/llds_out_instr.m 17 Jun 2011 06:58:24 -0000
@@ -125,36 +125,7 @@
output_record_code_addr_decls(Info, Target, !DeclSet, !IO),
output_record_code_addr_decls(Info, ContLabel, !DeclSet, !IO)
;
- Instr = mkframe(FrameInfo, MaybeFailureContinuation),
- (
- FrameInfo = ordinary_frame(_, _, yes(Struct)),
- Struct = foreign_proc_struct(StructName, StructFields,
- MaybeStructFieldsContext)
- ->
- DeclId = decl_foreign_proc_struct(StructName),
- ( decl_set_is_member(DeclId, !.DeclSet) ->
- unexpected($module, $pred,
- "struct " ++ StructName ++ " has been declared already")
- ;
- true
- ),
- io.write_string("struct ", !IO),
- io.write_string(StructName, !IO),
- io.write_string(" {\n", !IO),
- (
- MaybeStructFieldsContext = yes(StructFieldsContext),
- output_set_line_num(Info, StructFieldsContext, !IO),
- io.write_string(StructFields, !IO),
- output_reset_line_num(Info, !IO)
- ;
- MaybeStructFieldsContext = no,
- io.write_string(StructFields, !IO)
- ),
- io.write_string("\n};\n", !IO),
- decl_set_insert(DeclId, !DeclSet)
- ;
- true
- ),
+ Instr = mkframe(_FrameInfo, MaybeFailureContinuation),
(
MaybeFailureContinuation = yes(FailureContinuation),
output_record_code_addr_decls(Info, FailureContinuation,
@@ -516,50 +487,23 @@
;
Instr = mkframe(FrameInfo, MaybeFailCont),
(
- FrameInfo = ordinary_frame(Msg, Num, MaybeStruct),
+ FrameInfo = ordinary_frame(Msg, Num),
(
- MaybeStruct = yes(foreign_proc_struct(StructName, _, _)),
- (
- MaybeFailCont = yes(FailCont),
- io.write_string("\tMR_mkpragmaframe(""", !IO),
- c_util.output_quoted_string(Msg, !IO),
- io.write_string(""", ", !IO),
- io.write_int(Num, !IO),
- io.write_string(",\n\t\t", !IO),
- io.write_string(StructName, !IO),
- io.write_string(", ", !IO),
- output_code_addr(FailCont, !IO),
- io.write_string(");\n", !IO)
- ;
- MaybeFailCont = no,
- io.write_string("\tMR_mkpragmaframe_no_redoip(""", !IO),
- c_util.output_quoted_string(Msg, !IO),
- io.write_string(""", ", !IO),
- io.write_int(Num, !IO),
- io.write_string(",\n\t\t", !IO),
- io.write_string(StructName, !IO),
- io.write_string(");\n", !IO)
- )
+ MaybeFailCont = yes(FailCont),
+ io.write_string("\tMR_mkframe(""", !IO),
+ c_util.output_quoted_string(Msg, !IO),
+ io.write_string(""", ", !IO),
+ io.write_int(Num, !IO),
+ io.write_string(",\n\t\t", !IO),
+ output_code_addr(FailCont, !IO),
+ io.write_string(");\n", !IO)
;
- MaybeStruct = no,
- (
- MaybeFailCont = yes(FailCont),
- io.write_string("\tMR_mkframe(""", !IO),
- c_util.output_quoted_string(Msg, !IO),
- io.write_string(""", ", !IO),
- io.write_int(Num, !IO),
- io.write_string(",\n\t\t", !IO),
- output_code_addr(FailCont, !IO),
- io.write_string(");\n", !IO)
- ;
- MaybeFailCont = no,
- io.write_string("\tMR_mkframe_no_redoip(""",
- !IO),
- c_util.output_quoted_string(Msg, !IO),
- io.write_string(""", ", !IO),
- io.write_int(Num, !IO),
- io.write_string(");\n", !IO)
- )
+ MaybeFailCont = no,
+ io.write_string("\tMR_mkframe_no_redoip(""", !IO),
+ c_util.output_quoted_string(Msg, !IO),
+ io.write_string(""", ", !IO),
+ io.write_int(Num, !IO),
+ io.write_string(");\n", !IO)
)
;
FrameInfo = temp_frame(Kind),
@@ -1776,22 +1720,13 @@
output_foreign_proc_decls([], !IO).
output_foreign_proc_decls([Decl | Decls], !IO) :-
- (
- % Apart from special cases, the local variables are MR_Words
- Decl = foreign_proc_arg_decl(_Type, TypeString, VarName),
- io.write_string("\t", !IO),
- io.write_string(TypeString, !IO),
- io.write_string("\t", !IO),
- io.write_string(VarName, !IO),
- io.write_string(";\n", !IO)
- ;
- Decl = foreign_proc_struct_ptr_decl(StructTag, VarName),
- io.write_string("\tstruct ", !IO),
- io.write_string(StructTag, !IO),
- io.write_string("\t*", !IO),
- io.write_string(VarName, !IO),
- io.write_string(";\n", !IO)
- ),
+ % Apart from special cases, the local variables are MR_Words
+ Decl = foreign_proc_arg_decl(_Type, TypeString, VarName),
+ io.write_string("\t", !IO),
+ io.write_string(TypeString, !IO),
+ io.write_string("\t", !IO),
+ io.write_string(VarName, !IO),
+ io.write_string(";\n", !IO),
output_foreign_proc_decls(Decls, !IO).
% Output declarations for any rvals used to initialize the inputs.
Index: compiler/opt_debug.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/opt_debug.m,v
retrieving revision 1.219
diff -u -r1.219 opt_debug.m
--- compiler/opt_debug.m 20 May 2011 04:16:49 -0000 1.219
+++ compiler/opt_debug.m 17 Jun 2011 06:59:30 -0000
@@ -846,16 +846,9 @@
R_str = "no_redoip"
),
(
- FrameInfo = ordinary_frame(Name, Size, MaybePragma),
- (
- MaybePragma = yes(foreign_proc_struct(StructName, Fields, _)),
- P_str = "yes(" ++ StructName ++ ", " ++ Fields ++ ")"
- ;
- MaybePragma = no,
- P_str = "no"
- ),
+ FrameInfo = ordinary_frame(Name, Size),
Str = "mkframe(" ++ Name ++ ", " ++ int_to_string(Size) ++ ", "
- ++ P_str ++ ", " ++ R_str ++ ")"
+ ++ R_str ++ ")"
;
FrameInfo = temp_frame(Kind),
(
@@ -1142,8 +1135,6 @@
dump_decl(foreign_proc_arg_decl(_MerType, TypeStr, VarName)) =
"decl " ++ TypeStr ++ " " ++ VarName ++ "\n".
-dump_decl(foreign_proc_struct_ptr_decl(StructTag, VarName)) =
- "decl struct" ++ StructTag ++ " " ++ VarName ++ "\n".
:- func dump_components(maybe(proc_label), list(foreign_proc_component))
= string.
Index: compiler/peephole.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/peephole.m,v
retrieving revision 1.106
diff -u -r1.106 peephole.m
--- compiler/peephole.m 3 May 2011 04:34:57 -0000 1.106
+++ compiler/peephole.m 17 Jun 2011 06:59:49 -0000
@@ -281,7 +281,7 @@
% A mkframe sets curfr to point to the new frame
% only for ordinary frames, not temp frames.
(
- NondetFrameInfo = ordinary_frame(_, _, _),
+ NondetFrameInfo = ordinary_frame(_, _),
AllowedBases = [maxfr, curfr]
;
NondetFrameInfo = temp_frame(_),
Index: compiler/proc_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/proc_gen.m,v
retrieving revision 1.47
diff -u -r1.47 proc_gen.m
--- compiler/proc_gen.m 23 May 2011 05:08:09 -0000 1.47
+++ compiler/proc_gen.m 17 Jun 2011 07:00:11 -0000
@@ -917,7 +917,7 @@
(
CodeModel = model_non,
resume_point_stack_addr(OutsideResumePoint, OutsideResumeAddress),
- NondetFrameInfo = ordinary_frame(PushMsg, TotalSlots, no),
+ NondetFrameInfo = ordinary_frame(PushMsg, TotalSlots),
AllocCode = singleton(
llds_instr(mkframe(NondetFrameInfo, yes(OutsideResumeAddress)),
"Allocate stack frame")
--------------------------------------------------------------------------
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