Index: m3back/src/M3C.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3C.m3,v retrieving revision 1.95 diff -u -r1.95 M3C.m3 --- m3back/src/M3C.m3 4 Oct 2012 06:58:55 -0000 1.95 +++ m3back/src/M3C.m3 12 Oct 2012 04:44:32 -0000 @@ -104,36 +104,10 @@ export_unit := export_unit; set_source_file := set_source_file; set_source_line := set_source_line; - (* declare_typename := declare_typename; *) - (* declare_array := declare_array; *) - (* declare_open_array := declare_open_array; *) - (* declare_enum := declare_enum; *) - (* declare_enum_elt := declare_enum_elt; *) - (* declare_packed := declare_packed; *) - (* declare_record := declare_record; *) - (* declare_field := declare_field; *) - (* declare_set := declare_set; *) - (* declare_subrange := declare_subrange; *) - (* declare_pointer := declare_pointer; *) - (* declare_indirect := declare_indirect; *) - (* declare_proctype := declare_proctype; *) - (* declare_formal := declare_formal; *) - (* declare_raises := declare_raises; *) - (* declare_object := declare_object; *) - (* declare_method := declare_method; *) - (* declare_opaque := declare_opaque; *) - (* reveal_opaque := reveal_opaque; *) set_runtime_proc := set_runtime_proc; - (* import_global := import_global; *) - (* declare_segment := declare_segment; *) bind_segment := bind_segment; declare_global := declare_global; declare_constant := declare_constant; - (* declare_local := declare_local; *) - (* declare_param := declare_param; *) - (* declare_temp := declare_temp; *) - (* free_temp := free_temp; *) - (* declare_exception := declare_exception; *) begin_init := begin_init; end_init := end_init; init_int := init_int; @@ -143,8 +117,6 @@ init_offset := init_offset; init_chars := init_chars; init_float := init_float; - (* import_procedure := import_procedure; *) - (* declare_procedure := declare_procedure; *) begin_procedure := begin_procedure; end_procedure := end_procedure; begin_block := begin_block; @@ -1185,8 +1157,7 @@ *) BEGIN M3CG_MultiPass.end_unit(self); (* let M3CG_MultiPass do its usual last step *) - (* BUG self.Replay(self.self, self.op_data[M3CG_Binary.Op.begin_unit]); some initialization *) - begin_unit(self.self, 0); (* hack till above is fixed *) + self.Replay(self.self, self.op_data[M3CG_Binary.Op.begin_unit]); Prefix_Start(self.self); GetStructSizes(self); Prefix_End(self.self); @@ -1577,24 +1548,6 @@ RETURN var; END DeclareGlobal; -(* -PROCEDURE ExtraScope_Open(self: T) = -BEGIN - IF NOT self.last_char_was_open_brace THEN - print(self, "{"); - self.extra_scope_close_braces := self.extra_scope_close_braces & "}"; - END; -END ExtraScope_Open; -*) - -(* -PROCEDURE ExtraScope_Close(self: T) = -BEGIN - print(self, self.extra_scope_close_braces); - self.extra_scope_close_braces := ""; -END ExtraScope_Close; -*) - TYPE Locals_t = M3CG_DoNothing.T BRANDED "M3C.Locals_t" OBJECT self: T := NIL; METHODS @@ -1904,7 +1857,7 @@ self: T; name: Name; byte_size: ByteSize; - alignment: Alignment; + <*UNUSED*>alignment: Alignment; type: Type; <*UNUSED*>typeid: TypeUID; in_memory: BOOLEAN; @@ -1915,19 +1868,10 @@ BEGIN self.comment("declare_local"); (* self.comment("declare_local " & M3ID.ToText(var.name)); *) -(* - <* ASSERT NOT self.in_proc *> - IF self.in_proc THEN - ExtraScope_Open(self); - print(self, var.Declare() & " M3_INIT;"); - <* ASSERT up_level = FALSE *> - ELSE -*) - IF up_level THEN - self.current_proc.uplevels := TRUE; - END; - self.current_proc.locals.addhi(var); -(* END; *) + IF up_level THEN + self.current_proc.uplevels := TRUE; + END; + self.current_proc.locals.addhi(var); RETURN var; END declare_local; @@ -1993,9 +1937,17 @@ self.param_proc := NIL; END last_param; -PROCEDURE internal_declare_param(self: T; name: Name; byte_size: ByteSize; alignment: Alignment; - type: Type; <*UNUSED*>typeid: TypeUID; in_memory: BOOLEAN; up_level: BOOLEAN; - <*UNUSED*>frequency: Frequency; type_text: TEXT): M3CG.Var = +PROCEDURE internal_declare_param( + self: T; + name: Name; + byte_size: ByteSize; + <*UNUSED*>alignment: Alignment; + type: Type; + <*UNUSED*>typeid: TypeUID; + in_memory: BOOLEAN; + up_level: BOOLEAN; + <*UNUSED*>frequency: Frequency; + type_text: TEXT): M3CG.Var = VAR function := self.param_proc; var := NEW(Param_t, self := self, type := type, name := name, byte_size := byte_size, in_memory := in_memory, up_level := up_level, proc := function, type_text := type_text).Init(); @@ -2289,7 +2241,6 @@ IF n_params = 0 THEN last_param(self); END; - SuppressLineDirective(self, n_params, "declare_procedure n_params"); RETURN proc; END declare_procedure; @@ -2427,7 +2378,7 @@ END begin_procedure; -PROCEDURE end_procedure(self: T; p: M3CG.Proc) = +PROCEDURE end_procedure(self: T; <*UNUSED*>p: M3CG.Proc) = (*VAR proc := NARROW(p, Proc_t);*) BEGIN self.comment("end_procedure"); @@ -2435,7 +2386,6 @@ self.in_proc := FALSE; self.current_proc := NIL; print(self, "}"); - (* ExtraScope_Close(self); *) END end_procedure; PROCEDURE begin_block(self: T) = Index: m3middle/src/M3CG_BinRd.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/M3CG_BinRd.m3,v retrieving revision 1.19 diff -u -r1.19 M3CG_BinRd.m3 --- m3middle/src/M3CG_BinRd.m3 4 Sep 2012 14:29:54 -0000 1.19 +++ m3middle/src/M3CG_BinRd.m3 12 Oct 2012 04:44:32 -0000 @@ -37,7 +37,7 @@ END; CONST - CmdMap = ARRAY Bop OF Cmd { + CmdMap = ARRAY [Bop.begin_unit..Bop.fetch_and_xor] OF Cmd { Cmd {Bop.begin_unit, begin_unit}, Cmd {Bop.end_unit, end_unit}, Cmd {Bop.import_unit, import_unit}, Index: m3middle/src/M3CG_Binary.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/M3CG_Binary.i3,v retrieving revision 1.6 diff -u -r1.6 M3CG_Binary.i3 --- m3middle/src/M3CG_Binary.i3 1 Nov 2010 09:59:44 -0000 1.6 +++ m3middle/src/M3CG_Binary.i3 12 Oct 2012 04:44:32 -0000 @@ -21,14 +21,19 @@ end_init, init_int, init_proc, init_label, init_var, init_offset, init_chars, init_float, import_procedure, declare_procedure, begin_procedure, end_procedure, begin_block, end_block, - note_procedure_origin, set_label, jump, if_true, if_false, if_eq, - if_ne, if_gt, if_ge, if_lt, if_le, case_jump, exit_proc, load, + note_procedure_origin, set_label, jump, if_true, if_false, + if_eq, if_ne, if_gt, if_ge, if_lt, if_le, (* file only; in-memory uses if_compare *) + case_jump, exit_proc, load, load_address, load_indirect, store, store_indirect, - load_nil, load_integer, load_float, eq, ne, - gt, ge, lt, le, add, subtract, multiply, divide, negate, abs, max, - min, round, trunc, floor, ceiling, cvt_float, div, mod, set_union, + load_nil, load_integer, load_float, + eq, ne, gt, ge, lt, le, (* file only; in-memory uses compare *) + add, subtract, multiply, divide, negate, abs, max, + min, + round, trunc, floor, ceiling, (* file only; in-memory uses cvt_int *) + cvt_float, div, mod, set_union, set_difference, set_intersection, set_sym_difference, set_member, - set_eq, set_ne, set_lt, set_le, set_gt, set_ge, set_range, + set_eq, set_ne, set_lt, set_le, set_gt, set_ge, (* file only; in-memory uses set_compare *) + set_range, set_singleton, not, and, or, xor, shift, shift_left, shift_right, rotate, rotate_left, rotate_right, widen, chop, extract, extract_n, extract_mn, insert, insert_n, insert_mn, swap, pop, copy_n, copy, @@ -38,7 +43,17 @@ call_indirect, pop_param, pop_struct, pop_static_link, load_procedure, load_static_link, comment, store_ordered, load_ordered, exchange, compare_exchange, fence, - fetch_and_add, fetch_and_sub, fetch_and_or, fetch_and_and, fetch_and_xor + fetch_and_add, (* file only; in-memory uses fetch_and_op *) + fetch_and_sub, (* file only; in-memory uses fetch_and_op *) + fetch_and_or, (* file only; in-memory uses fetch_and_op *) + fetch_and_and, (* file only; in-memory uses fetch_and_op *) + fetch_and_xor, (* file only; in-memory uses fetch_and_op *) + set_error_handler, (* in-memory only; contains a pointer, so silently skipped in files *) + compare, (* in-memory only; file converts to eq/ne/etc. *) + cvt_int, (* in-memory only; file converts to trunc/ceiling/etc. *) + fetch_and_op, (* in-memory only; file converts to fetch_and_add/fetch_and_sub/etc. *) + if_compare, (* in-memory only; file converts to if_eq/if_ne/etc. *) + set_compare (* in-memory only; file converts to set_eq/set_ne/etc. *) }; (* Integers are encoded as sequences of unsigned bytes, [0..255]. Index: m3middle/src/M3CG_MultiPass.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/M3CG_MultiPass.i3,v retrieving revision 1.8 diff -u -r1.8 M3CG_MultiPass.i3 --- m3middle/src/M3CG_MultiPass.i3 30 Sep 2012 06:40:21 -0000 1.8 +++ m3middle/src/M3CG_MultiPass.i3 12 Oct 2012 04:44:32 -0000 @@ -8,7 +8,7 @@ * I expect to use #3. *) -IMPORT M3CG, Target; +IMPORT M3CG, Target, M3CG_AssertFalse; FROM M3CG IMPORT Type, MType, IType, RType, AType, ZType, Sign; FROM M3CG IMPORT Name, Alignment, Label; FROM M3CG IMPORT Frequency, CallingConvention, CompareOp, ConvertOp, AtomicOp; @@ -21,7 +21,7 @@ TYPE T <: Public; -TYPE Public = M3CG.T OBJECT +TYPE Public = M3CG_AssertFalse.T OBJECT data: REF ARRAY OF op_t; op_data: ARRAY Op OF REF ARRAY OF op_t; Index: m3middle/src/M3CG_MultiPass.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/M3CG_MultiPass.m3,v retrieving revision 1.11 diff -u -r1.11 M3CG_MultiPass.m3 --- m3middle/src/M3CG_MultiPass.m3 5 Oct 2012 07:25:50 -0000 1.11 +++ m3middle/src/M3CG_MultiPass.m3 12 Oct 2012 04:44:32 -0000 @@ -56,7 +56,7 @@ REVEAL T = Public BRANDED "M3CG_MultiPass.T" OBJECT refs: GrowableRefs_t := NIL; - next_label_id := 100; + next_label_id := 1; op_counts := ARRAY Op OF INTEGER{0, ..}; total_ops: INTEGER := 0; private_data: RefSeq.T := NIL; @@ -390,7 +390,7 @@ PROCEDURE set_error_handler(self: T; proc: PROCEDURE(msg: TEXT)) = BEGIN -self.Add(NEW(set_error_handler_t, (*op := Op.set_error_handler,*) proc := proc)); +self.Add(NEW(set_error_handler_t, op := Op.set_error_handler, proc := proc)); END set_error_handler; PROCEDURE begin_procedure(self: T; proc: Proc) = @@ -619,7 +619,7 @@ END if_false; PROCEDURE if_compare(self: T; type: ZType; op: CompareOp; label: Label; frequency: Frequency) = BEGIN -self.Add(NEW(if_compare_t, (*op := Op.if_compare,*) type := type, compare_op := op, label := label, frequency := frequency)); +self.Add(NEW(if_compare_t, op := Op.if_compare, type := type, compare_op := op, label := label, frequency := frequency)); END if_compare; PROCEDURE case_jump(self: T; type: IType; READONLY labels: ARRAY OF Label) = @@ -666,7 +666,7 @@ END load_float; PROCEDURE compare(self: T; ztype: ZType; itype: IType; op: CompareOp) = BEGIN -self.Add(NEW(compare_t, (*op := Op.compare,*) ztype := ztype, itype := itype, compare_op := op)); +self.Add(NEW(compare_t, op := Op.compare, ztype := ztype, itype := itype, compare_op := op)); END compare; PROCEDURE add(self: T; type: AType) = BEGIN @@ -716,302 +716,302 @@ PROCEDURE cvt_int(self: T; rtype: RType; itype: IType; op: ConvertOp) = BEGIN -self.Add(NEW(cvt_int_t, rtype := rtype, itype := itype, convert_op := op)); +self.Add(NEW(cvt_int_t, op := Op.cvt_int, rtype := rtype, itype := itype, convert_op := op)); END cvt_int; PROCEDURE cvt_float(self: T; atype: AType; rtype: RType) = BEGIN -self.Add(NEW(cvt_float_t, atype := atype, rtype := rtype)); +self.Add(NEW(cvt_float_t, op := Op.cvt_float, atype := atype, rtype := rtype)); END cvt_float; PROCEDURE set_union(self: T; byte_size: ByteSize) = BEGIN -self.Add(NEW(set_union_t, byte_size := byte_size)); +self.Add(NEW(set_union_t, op := Op.set_union, byte_size := byte_size)); END set_union; PROCEDURE set_difference(self: T; byte_size: ByteSize) = BEGIN -self.Add(NEW(set_difference_t, byte_size := byte_size)); +self.Add(NEW(set_difference_t, op := Op.set_difference, byte_size := byte_size)); END set_difference; PROCEDURE set_intersection(self: T; byte_size: ByteSize) = BEGIN -self.Add(NEW(set_intersection_t, byte_size := byte_size)); +self.Add(NEW(set_intersection_t, op := Op.set_intersection, byte_size := byte_size)); END set_intersection; PROCEDURE set_sym_difference(self: T; byte_size: ByteSize) = BEGIN -self.Add(NEW(set_sym_difference_t, byte_size := byte_size)); +self.Add(NEW(set_sym_difference_t, op := Op.set_sym_difference, byte_size := byte_size)); END set_sym_difference; PROCEDURE set_member(self: T; byte_size: ByteSize; type: IType) = BEGIN -self.Add(NEW(set_member_t, byte_size := byte_size, type := type)); +self.Add(NEW(set_member_t, op := Op.set_member, byte_size := byte_size, type := type)); END set_member; PROCEDURE set_compare(self: T; byte_size: ByteSize; op: CompareOp; type: IType) = BEGIN -self.Add(NEW(set_compare_t, byte_size := byte_size, compare_op := op, type := type)); +self.Add(NEW(set_compare_t, op := Op.set_compare, byte_size := byte_size, compare_op := op, type := type)); END set_compare; PROCEDURE set_range(self: T; byte_size: ByteSize; type: IType) = BEGIN -self.Add(NEW(set_range_t, byte_size := byte_size, type := type)); +self.Add(NEW(set_range_t, op := Op.set_range, byte_size := byte_size, type := type)); END set_range; PROCEDURE set_singleton(self: T; byte_size: ByteSize; type: IType) = BEGIN -self.Add(NEW(set_singleton_t, byte_size := byte_size, type := type)); +self.Add(NEW(set_singleton_t, op := Op.set_singleton, byte_size := byte_size, type := type)); END set_singleton; PROCEDURE not(self: T; type: IType) = BEGIN -self.Add(NEW(not_t, type := type)); +self.Add(NEW(not_t, op := Op.not, type := type)); END not; PROCEDURE and(self: T; type: IType) = BEGIN -self.Add(NEW(and_t, type := type)); +self.Add(NEW(and_t, op := Op.and, type := type)); END and; PROCEDURE or(self: T; type: IType) = BEGIN -self.Add(NEW(or_t, type := type)); +self.Add(NEW(or_t, op := Op.or, type := type)); END or; PROCEDURE xor(self: T; type: IType) = BEGIN -self.Add(NEW(xor_t, type := type)); +self.Add(NEW(xor_t, op := Op.xor, type := type)); END xor; PROCEDURE shift(self: T; type: IType) = BEGIN -self.Add(NEW(shift_t, type := type)); +self.Add(NEW(shift_t, op := Op.shift, type := type)); END shift; PROCEDURE shift_left(self: T; type: IType) = BEGIN -self.Add(NEW(shift_left_t, type := type)); +self.Add(NEW(shift_left_t, op := Op.shift_left, type := type)); END shift_left; PROCEDURE shift_right(self: T; type: IType) = BEGIN -self.Add(NEW(shift_right_t, type := type)); +self.Add(NEW(shift_right_t, op := Op.shift_right, type := type)); END shift_right; PROCEDURE rotate(self: T; type: IType) = BEGIN -self.Add(NEW(rotate_t, type := type)); +self.Add(NEW(rotate_t, op := Op.rotate, type := type)); END rotate; PROCEDURE rotate_left(self: T; type: IType) = BEGIN -self.Add(NEW(rotate_left_t, type := type)); +self.Add(NEW(rotate_left_t, op := Op.rotate_left, type := type)); END rotate_left; PROCEDURE rotate_right(self: T; type: IType) = BEGIN -self.Add(NEW(rotate_right_t, type := type)); +self.Add(NEW(rotate_right_t, op := Op.rotate_right, type := type)); END rotate_right; PROCEDURE widen(self: T; sign: BOOLEAN) = BEGIN -self.Add(NEW(widen_t, sign := sign)); +self.Add(NEW(widen_t, op := Op.widen, sign := sign)); END widen; PROCEDURE chop(self: T) = BEGIN -self.Add(NEW(chop_t)); +self.Add(NEW(chop_t, op := Op.chop)); END chop; PROCEDURE extract(self: T; type: IType; sign_extend: BOOLEAN) = BEGIN -self.Add(NEW(extract_t, type := type, sign_extend := sign_extend)); +self.Add(NEW(extract_t, op := Op.extract, type := type, sign_extend := sign_extend)); END extract; PROCEDURE extract_n(self: T; type: IType; sign_extend: BOOLEAN; count: CARDINAL) = BEGIN -self.Add(NEW(extract_n_t, type := type, sign_extend := sign_extend, count := count)); +self.Add(NEW(extract_n_t, op := Op.extract_n, type := type, sign_extend := sign_extend, count := count)); END extract_n; PROCEDURE extract_mn(self: T; type: IType; sign_extend: BOOLEAN; offset, count: CARDINAL) = BEGIN -self.Add(NEW(extract_mn_t, type := type, sign_extend := sign_extend, offset := offset, count := count)); +self.Add(NEW(extract_mn_t, op := Op.extract_mn, type := type, sign_extend := sign_extend, offset := offset, count := count)); END extract_mn; PROCEDURE insert(self: T; type: IType) = BEGIN -self.Add(NEW(insert_t, type := type)); +self.Add(NEW(insert_t, op := Op.insert, type := type)); END insert; PROCEDURE insert_n(self: T; type: IType; count: CARDINAL) = BEGIN -self.Add(NEW(insert_n_t, type := type, count := count)); +self.Add(NEW(insert_n_t, op := Op.insert_n, type := type, count := count)); END insert_n; PROCEDURE insert_mn(self: T; type: IType; offset, count: CARDINAL) = BEGIN -self.Add(NEW(insert_mn_t, type := type, offset := offset, count := count)); +self.Add(NEW(insert_mn_t, op := Op.insert_mn, type := type, offset := offset, count := count)); END insert_mn; PROCEDURE swap(self: T; a, b: Type) = BEGIN -self.Add(NEW(swap_t, a := a, b := b)); +self.Add(NEW(swap_t, op := Op.swap, a := a, b := b)); END swap; PROCEDURE pop(self: T; type: Type) = BEGIN -self.Add(NEW(pop_t, type := type)); +self.Add(NEW(pop_t, op := Op.pop, type := type)); END pop; PROCEDURE copy_n(self: T; itype: IType; mtype: MType; overlap: BOOLEAN) = BEGIN -self.Add(NEW(copy_n_t, itype := itype, mtype := mtype, overlap := overlap)); +self.Add(NEW(copy_n_t, op := Op.copy_n, itype := itype, mtype := mtype, overlap := overlap)); END copy_n; PROCEDURE copy(self: T; n: INTEGER; mtype: MType; overlap: BOOLEAN) = BEGIN -self.Add(NEW(copy_t, n := n, mtype := mtype, overlap := overlap)); +self.Add(NEW(copy_t, op := Op.copy, n := n, mtype := mtype, overlap := overlap)); END copy; PROCEDURE zero_n(self: T; itype: IType; mtype: MType) = BEGIN -self.Add(NEW(zero_n_t, itype := itype, mtype := mtype)); +self.Add(NEW(zero_n_t, op := Op.zero_n, itype := itype, mtype := mtype)); END zero_n; PROCEDURE zero(self: T; n: INTEGER; type: MType) = BEGIN -self.Add(NEW(zero_t, n := n, type := type)); +self.Add(NEW(zero_t, op := Op.zero, n := n, type := type)); END zero; PROCEDURE loophole(self: T; from, to: ZType) = BEGIN -self.Add(NEW(loophole_t, from := from, to := to)); +self.Add(NEW(loophole_t, op := Op.loophole, from := from, to := to)); END loophole; PROCEDURE abort(self: T; code: RuntimeError) = BEGIN -self.Add(NEW(abort_t, code := code)); +self.Add(NEW(abort_t, op := Op.abort, code := code)); END abort; PROCEDURE check_nil(self: T; code: RuntimeError) = BEGIN -self.Add(NEW(check_nil_t, code := code)); +self.Add(NEW(check_nil_t, op := Op.check_nil, code := code)); END check_nil; PROCEDURE check_lo(self: T; type: IType; READONLY i: Target.Int; code: RuntimeError) = BEGIN -self.Add(NEW(check_lo_t, type := type, i := i, code := code)); +self.Add(NEW(check_lo_t, op := Op.check_lo, type := type, i := i, code := code)); END check_lo; PROCEDURE check_hi(self: T; type: IType; READONLY i: Target.Int; code: RuntimeError) = BEGIN -self.Add(NEW(check_hi_t, type := type, i := i, code := code)); +self.Add(NEW(check_hi_t, op := Op.check_hi, type := type, i := i, code := code)); END check_hi; PROCEDURE check_range(self: T; type: IType; READONLY a, b: Target.Int; code: RuntimeError) = BEGIN -self.Add(NEW(check_range_t, type := type, a := a, b := b, code := code)); +self.Add(NEW(check_range_t, op := Op.check_range, type := type, a := a, b := b, code := code)); END check_range; PROCEDURE check_index(self: T; type: IType; code: RuntimeError) = BEGIN -self.Add(NEW(check_index_t, type := type, code := code)); +self.Add(NEW(check_index_t, op := Op.check_index, type := type, code := code)); END check_index; PROCEDURE check_eq(self: T; type: IType; code: RuntimeError) = BEGIN -self.Add(NEW(check_eq_t, type := type, code := code)); +self.Add(NEW(check_eq_t, op := Op.check_eq, type := type, code := code)); END check_eq; PROCEDURE add_offset(self: T; i: INTEGER) = BEGIN -self.Add(NEW(add_offset_t, i := i)); +self.Add(NEW(add_offset_t, op := Op.add_offset, i := i)); END add_offset; PROCEDURE index_address(self: T; type: IType; size: INTEGER) = BEGIN -self.Add(NEW(index_address_t, type := type, size := size)); +self.Add(NEW(index_address_t, op := Op.index_address, type := type, size := size)); END index_address; PROCEDURE start_call_direct(self: T; proc: Proc; level: INTEGER; type: Type) = BEGIN -self.Add(NEW(start_call_direct_t, proc := NARROW(proc, proc_t).tag, level := level, type := type)); +self.Add(NEW(start_call_direct_t, op := Op.start_call_direct, proc := NARROW(proc, proc_t).tag, level := level, type := type)); END start_call_direct; PROCEDURE start_call_indirect(self: T; type: Type; callingConvention: CallingConvention) = BEGIN -self.Add(NEW(start_call_indirect_t, type := type, callingConvention := callingConvention)); +self.Add(NEW(start_call_indirect_t, op := Op.start_call_indirect, type := type, callingConvention := callingConvention)); END start_call_indirect; PROCEDURE pop_param(self: T; type: MType) = BEGIN -self.Add(NEW(pop_param_t, type := type)); +self.Add(NEW(pop_param_t, op := Op.pop_param, type := type)); END pop_param; PROCEDURE pop_struct(self: T; typeid: TypeUID; byte_size: ByteSize; alignment: Alignment) = BEGIN -self.Add(NEW(pop_struct_t, typeid := typeid, byte_size := byte_size, alignment := alignment)); +self.Add(NEW(pop_struct_t, op := Op.pop_struct, typeid := typeid, byte_size := byte_size, alignment := alignment)); END pop_struct; PROCEDURE pop_static_link(self: T) = BEGIN -self.Add(NEW(pop_static_link_t)); +self.Add(NEW(pop_static_link_t, op := Op.pop_static_link)); END pop_static_link; PROCEDURE call_direct(self: T; proc: Proc; type: Type) = BEGIN -self.Add(NEW(call_direct_t, proc := NARROW(proc, proc_t).tag, type := type)); +self.Add(NEW(call_direct_t, op := Op.call_direct, proc := NARROW(proc, proc_t).tag, type := type)); END call_direct; PROCEDURE call_indirect(self: T; type: Type; callingConvention: CallingConvention) = BEGIN -self.Add(NEW(call_indirect_t, type := type, callingConvention := callingConvention)); +self.Add(NEW(call_indirect_t, op := Op.call_indirect, type := type, callingConvention := callingConvention)); END call_indirect; PROCEDURE load_procedure(self: T; proc: Proc) = BEGIN -self.Add(NEW(load_procedure_t, proc := NARROW(proc, proc_t).tag)); +self.Add(NEW(load_procedure_t, op := Op.load_procedure, proc := NARROW(proc, proc_t).tag)); END load_procedure; PROCEDURE load_static_link(self: T; proc: Proc) = BEGIN -self.Add(NEW(load_static_link_t, proc := NARROW(proc, proc_t).tag)); +self.Add(NEW(load_static_link_t, op := Op.load_static_link, proc := NARROW(proc, proc_t).tag)); END load_static_link; PROCEDURE comment(self: T; a, b, c, d: TEXT := NIL) = BEGIN -self.Add(NEW(comment_t, a := a, b := b, c := c, d := d)); +self.Add(NEW(comment_t, op := Op.comment, a := a, b := b, c := c, d := d)); END comment; PROCEDURE store_ordered(self: T; ztype: ZType; mtype: MType; order: MemoryOrder) = BEGIN -self.Add(NEW(store_ordered_t, mtype := mtype, ztype := ztype, order := order)); +self.Add(NEW(store_ordered_t, op := Op.store_ordered, mtype := mtype, ztype := ztype, order := order)); END store_ordered; PROCEDURE load_ordered(self: T; mtype: MType; ztype: ZType; order: MemoryOrder) = BEGIN -self.Add(NEW(load_ordered_t, mtype := mtype, ztype := ztype, order := order)); +self.Add(NEW(load_ordered_t, op := Op.load_ordered, mtype := mtype, ztype := ztype, order := order)); END load_ordered; PROCEDURE exchange(self: T; mtype: MType; ztype: ZType; order: MemoryOrder) = BEGIN -self.Add(NEW(exchange_t, mtype := mtype, ztype := ztype, order := order)); +self.Add(NEW(exchange_t, op := Op.exchange, mtype := mtype, ztype := ztype, order := order)); END exchange; PROCEDURE compare_exchange(self: T; mtype: MType; ztype: ZType; r: IType; success, failure: MemoryOrder) = BEGIN -self.Add(NEW(compare_exchange_t, mtype := mtype, ztype := ztype, r := r, success := success, failure := failure)); +self.Add(NEW(compare_exchange_t, op := Op.compare_exchange, mtype := mtype, ztype := ztype, r := r, success := success, failure := failure)); END compare_exchange; PROCEDURE fence(self: T; order: MemoryOrder) = BEGIN -self.Add(NEW(fence_t, order := order)); +self.Add(NEW(fence_t, op := Op.fence, order := order)); END fence; PROCEDURE fetch_and_op(self: T; op: AtomicOp; mtype: MType; ztype: ZType; order: MemoryOrder) = BEGIN -self.Add(NEW(fetch_and_op_t, atomic_op := op, mtype := mtype, ztype := ztype, order := order)); +self.Add(NEW(fetch_and_op_t, op := Op.fetch_and_op, atomic_op := op, mtype := mtype, ztype := ztype, order := order)); END fetch_and_op; PROCEDURE Replay_Init(self: Replay_t; refcount: INTEGER): Replay_t = Index: m3cggen/src/Main.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3cggen/src/Main.m3,v retrieving revision 1.6 diff -u -r1.6 Main.m3 --- m3cggen/src/Main.m3 1 Nov 2010 09:59:44 -0000 1.6 +++ m3cggen/src/Main.m3 12 Oct 2012 04:47:30 -0000 @@ -9,7 +9,7 @@ Desc = RECORD name: TEXT; op: Op; END; CONST - Map = ARRAY Op OF Desc { + Map = ARRAY [Op.begin_unit..Op.fetch_and_xor] OF Desc { Desc { "begin_unit", Op.begin_unit }, Desc { "end_unit", Op.end_unit }, Desc { "import_unit", Op.import_unit },