* src/vm/jit/codegen-common.cpp (codegen_emit): New generic version of the
[cacao.git] / src / vm / jit / i386 / codegen.h
index 2efb24532981093b2619f8ef40198b84ae0c039c..375154c059cd69940cf299ad122852a867126257 100644 (file)
     } while (0)
 
 
-/* M_INTMOVE:
-     generates an integer-move from register a to b.
-     if a and b are the same int-register, no code will be generated.
-*/ 
-
-#define M_INTMOVE(a,b) \
-    do { \
-        if ((a) != (b)) \
-            M_MOV(a, b); \
-    } while (0)
-
-#define M_LNGMOVE(a,b) \
-    do { \
-        if (GET_HIGH_REG(a) == GET_LOW_REG(b)) { \
-            assert((GET_LOW_REG(a) != GET_HIGH_REG(b))); \
-            M_INTMOVE(GET_HIGH_REG(a), GET_HIGH_REG(b)); \
-            M_INTMOVE(GET_LOW_REG(a), GET_LOW_REG(b)); \
-        } else { \
-            M_INTMOVE(GET_LOW_REG(a), GET_LOW_REG(b)); \
-            M_INTMOVE(GET_HIGH_REG(a), GET_HIGH_REG(b)); \
-        } \
-    } while (0)
-
-
-/* M_FLTMOVE:
-    generates a floating-point-move from register a to b.
-    if a and b are the same float-register, no code will be generated
-*/
-
-#define M_FLTMOVE(reg,dreg)                                          \
+#define M_FMOV(reg,dreg)                                             \
     do {                                                             \
-        if ((reg) != (dreg)) {                                       \
-            log_text("M_FLTMOVE");                                   \
-            assert(0);                                               \
-        }                                                            \
+        log_text("M_FMOV");                                          \
+        assert(0);                                                   \
     } while (0)
 
+#define M_DMOV(a,b) M_FMOV(a,b)
 
 #define ICONST(d,c) \
     do { \
 
 #define M_ISUB_IMM_MEMABS(a,b)  emit_alu_imm_memabs(cd, ALU_SUB, (a), (b))
 
+#define M_IINC(a)               emit_inc_reg(cd, (a))
+
 #define M_IADDC(a,b)            emit_alu_reg_reg(cd, ALU_ADC, (a), (b))
 #define M_ISUBB(a,b)            emit_alu_reg_reg(cd, ALU_SBB, (a), (b))
 
 
 #define M_MOV(a,b)              emit_mov_reg_reg(cd, (a), (b))
 #define M_MOV_IMM(a,b)          emit_mov_imm_reg(cd, (u4) (a), (b))
+#define M_MOV_IMM2(a,b)         emit_mov_imm2_reg(cd, (u4) (a), (b))
 
 #define M_TEST(a)               emit_test_reg_reg(cd, (a), (a))
 #define M_TEST_IMM(a,b)         emit_test_imm_reg(cd, (a), (b))
 
 #define M_CMP(a,b)              emit_alu_reg_reg(cd, ALU_CMP, (a), (b))
 #define M_CMP_MEMBASE(a,b,c)    emit_alu_membase_reg(cd, ALU_CMP, (a), (b), (c))
+#define M_CMP_MEMINDEX(a,b,c,d,e)    emit_alu_memindex_reg(cd, ALU_CMP, (b), (a), (c), (d), (e))
 
 #define M_CMP_IMM(a,b)          emit_alu_imm_reg(cd, ALU_CMP, (a), (b))
 #define M_CMP_IMM_MEMBASE(a,b,c) emit_alu_imm_membase(cd, ALU_CMP, (a), (b), (c))
 #define M_CALL_IMM(a)           emit_call_imm(cd, (a))
 #define M_RET                   M_BYTE1(0xc3)
 
+#define M_ACMP(a,b)             M_CMP(a,b)
+
+#define M_ICMP(a,b)             M_CMP(a,b)
+#define M_ICMP_IMM(a,b)         emit_alu_imm_reg(cd, ALU_CMP, (a), (b))
+
 #define M_BEQ(a)                emit_jcc(cd, CC_E, (a))
 #define M_BNE(a)                emit_jcc(cd, CC_NE, (a))
 #define M_BLT(a)                emit_jcc(cd, CC_L, (a))
 #define M_BNS(a)                emit_jcc(cd, CC_NS, (a))
 #define M_BS(a)                 emit_jcc(cd, CC_S, (a))
 
+#define M_SETE(a)               emit_setcc_reg(cd, CC_E, (a))
+
 #define M_JMP(a)                emit_jmp_reg(cd, (a))
 #define M_JMP_IMM(a)            emit_jmp_imm(cd, (a))