diff --git a/src/alloy/backend/x64/lowering/lowering_sequences.cc b/src/alloy/backend/x64/lowering/lowering_sequences.cc index 7d55a4f6c..f9caadca7 100644 --- a/src/alloy/backend/x64/lowering/lowering_sequences.cc +++ b/src/alloy/backend/x64/lowering/lowering_sequences.cc @@ -29,6 +29,8 @@ enum ArgType { NULL_ARG_TYPE, VALUE_ARG_TYPE, CONSTANT_ARG_TYPE, + SYMBOL_ARG_TYPE, + LABEL_ARG_TYPE, OUT_ARG_TYPE, IN_ARG_TYPE, REG_ARG_TYPE, @@ -44,7 +46,13 @@ class NullArg : public Arg {}; template class ValueRef : public Arg { public: - enum { type = TYPE }; + const static int type = TYPE; +}; +class SymbolRef : public Arg { +public: +}; +class LabelRef : public Arg { +public: }; template { public: - enum { type = TYPE }; - enum : bool { has_value = HAS_VALUE }; + const static int type = TYPE; + const static bool has_value = HAS_VALUE; const static int8_t i8 = INT8_VALUE; const static int16_t i16 = INT16_VALUE; const static int32_t i32 = INT32_VALUE; @@ -87,20 +95,20 @@ class Float64Constant : public Constant class Out : public Arg { public: - enum { slot = SLOT }; + const static int slot = SLOT; }; template class In : public Arg { public: - enum { slot = SLOT }; - enum { arg = ARG }; + const static int slot = SLOT; + const static int arg = ARG; }; template class Reg : public Arg { public: - enum { reg_name = REG_NAME }; + const static int reg_name = REG_NAME; }; @@ -117,6 +125,14 @@ public: return op.value->type == T::type; } template + static bool CheckArg(Instr* instr_list[], Instr::Op& op, IntType) { + return true; + } + template + static bool CheckArg(Instr* instr_list[], Instr::Op& op, IntType) { + return true; + } + template static bool CheckArg(Instr* instr_list[], Instr::Op& op, IntType) { if (op.value->type != T::type) { return false; @@ -397,11 +413,138 @@ public: void alloy::backend::x64::lowering::RegisterSequences(LoweringTable* table) { + // TODO(benvanik): translate comments somehow - special type? + Translate + >, tuple< + >> (table); + Translate >, tuple< >> (table); + // -------------------------------------------------------------------------- + // Debugging + // -------------------------------------------------------------------------- + + // TODO(benvanik): translate source offsets for mapping + Translate> + >, tuple< + >> (table); + + Translate + >, tuple< + // int3 + >> (table); + Translate> + >, tuple< + // test if 0 + // jz label + // int3 + // label: + >> (table); + + Translate + >, tuple< + // int3 + >> (table); + Translate> + >, tuple< + // test if 0 + // jz label + // int3 + // label: + >> (table); + + // -------------------------------------------------------------------------- + // Calls + // -------------------------------------------------------------------------- + + Translate + >, tuple< + // call + >> (table); + Translate, SymbolRef> + >, tuple< + // call + >> (table); + Translate> + >, tuple< + // call + >> (table); + Translate, ValueRef> + >, tuple< + // call + >> (table); + // return / set return address + + // -------------------------------------------------------------------------- + // Branches + // -------------------------------------------------------------------------- + + Translate + >, tuple< + // branch + >> (table); + Translate, LabelRef> + >, tuple< + // branch + >> (table); + Translate, LabelRef> + >, tuple< + // branch + >> (table); + + // -------------------------------------------------------------------------- + // Types + // -------------------------------------------------------------------------- + + // int 8/etc + Translate, ValueRef> + >, tuple< + LIR_MOV_I32, In<0, 0>> + >> (table); + + // -------------------------------------------------------------------------- + // Constants + // -------------------------------------------------------------------------- + + // -------------------------------------------------------------------------- + // Context + // -------------------------------------------------------------------------- + + // -------------------------------------------------------------------------- + // Memory + // -------------------------------------------------------------------------- + + // -------------------------------------------------------------------------- + // Comparisons + // -------------------------------------------------------------------------- + + // -------------------------------------------------------------------------- + // Math + // -------------------------------------------------------------------------- + + // -------------------------------------------------------------------------- + // Atomic + // -------------------------------------------------------------------------- + + // Tests: + Translate, ValueRef, ValueRef> >, tuple<