CACAO
Macros | Functions
codegen.hpp File Reference

Go to the source code of this file.

Macros

#define SPLIT_OPEN(type, reg, tmpreg)
 
#define SPLIT_STORE_AND_CLOSE(type, reg, offset)
 
#define MCODECHECK(icnt)
 
#define ALIGNCODENOP   /* empty */
 
#define IS_IMM(val)   ( ((val) >= 0) && ((val) <= 255) )
 
#define IS_OFFSET(off, max)   ((s4)(off) <= (max) && (s4)(off) >= -(max))
 
#define CHECK_INT_REG(r)   assert((r)>=0 && (r)<=15)
 
#define CHECK_FLT_REG(r)   assert((r)>=0 && (r)<=15)
 
#define CHECK_OFFSET(off, max)   assert(IS_OFFSET(off,max))
 
#define BRANCH_NOPS
 
#define PATCHER_CALL_SIZE   1 * 4 /* an instruction is 4-bytes long */
 
#define PATCHER_NOPS
 
#define ASM_DEBUG_PREPARE   M_STMFD(0x7fff, REG_SP)
 
#define ASM_DEBUG_EXECUTE
 
#define COND_EQ   0x0 /* Equal Z set */
 
#define COND_NE   0x1 /* Not equal Z clear */
 
#define COND_CS   0x2 /* Carry set C set */
 
#define COND_CC   0x3 /* Carry clear C clear */
 
#define COND_MI   0x4 /* Negative N set */
 
#define COND_PL   0x5 /* Positive N clear */
 
#define COND_VS   0x6 /* Overflow V set */
 
#define COND_VC   0x7 /* No overflow V clear */
 
#define COND_HI   0x8 /* Unsigned higher */
 
#define COND_LS   0x9 /* Unsigned lower, same */
 
#define COND_GE   0xA /* Sig. greater, equal */
 
#define COND_LT   0xB /* Sig. less than */
 
#define COND_GT   0xC /* Sig. greater than */
 
#define COND_LE   0xD /* Sig. less, equal */
 
#define COND_AL   0xE /* Always */
 
#define CONDNV   0xF /* Special (see A3-5) */
 
#define UNCOND   COND_AL
 
#define M_DAT(cond, op, d, n, S, I, shift)
 
#define M_MEM(cond, L, B, d, n, adr, I, P, U, W)
 
#define M_MEM_GET_Rd(mcode)   (((mcode) >> 12) & 0x0f)
 
#define M_MEM_GET_Rbase(mcode)   (((mcode) >> 16) & 0x0f)
 
#define M_MEM2(cond, L, H, S, d, n, adr, I, P, U, W)
 
#define M_MEM_MULTI(cond, L, S, regs, n, P, U, W)
 
#define M_BRAX(cond, L, reg)
 
#define M_BRA(cond, L, offset)
 
#define M_MULT(cond, d, n, m, S, A, s)
 
#define M_NOP
 
#define M_BREAKPOINT(imm)
 
#define M_UNDEFINED(cond, imm, n)
 
#define M_CPDOS(cond, op, D, Fd, Fn, Fm)
 
#define M_CPDOD(cond, op, D, Fd, Fn, Fm)
 
#define M_CPDP(cond, p, q, r, s, cp_num, D, N, M, Fd, Fn, Fm)
 
#define M_CPDPF(cond, p, q, r, s, cp_num, Fd, Fn, Fm)   M_CPDP(cond,p,q,r,s,cp_num,(Fd)>>4,(Fn)>>4,(Fm)>>4,(Fd)&0xf,(Fn)&0xf,Fm)
 
#define M_CPDT(cond, L, T1, T0, Fd, n, off, P, U, W)
 
#define M_CPLS(cond, L, P, U, W, cp_num, D, Fd, n, off)
 
#define M_CPRT(cond, op, L, cp_num, N, Fn, n)
 
#define M_CPRTS(cond, L, d, Fn, Fm)
 
#define M_CPRTD(cond, L, d, Fn, Fm)
 
#define M_CPRTI(cond, L, d, Fn, Fm)
 
#define M_CPRTX(cond, L, d, Fn, Fm)
 
#define DCD(val)
 
#define REG_LSL(reg, shift)   ( (((shift) & 0x1f) << 7) | ((reg) & 0x0f) )
 
#define REG_LSR(reg, shift)   ( (((shift) & 0x1f) << 7) | ((reg) & 0x0f) | (1 << 5) )
 
#define REG_ASR(reg, shift)   ( (((shift) & 0x1f) << 7) | ((reg) & 0x0f) | (1 << 6) )
 
#define REG_LSL_REG(reg, s)   ( (((s) & 0x0f) << 8) | ((reg) & 0x0f) | (1 << 4) )
 
#define REG_LSR_REG(reg, s)   ( (((s) & 0x0f) << 8) | ((reg) & 0x0f) | (1 << 4) | (1 << 5) )
 
#define REG_ASR_REG(reg, s)   ( (((s) & 0x0f) << 8) | ((reg) & 0x0f) | (1 << 4) | (1 << 6) )
 
#define IMM_ROTR(imm, rot)   ( ((imm) & 0xff) | (((rot) & 0x0f) << 8) )
 
#define IMM_ROTL(imm, rot)   IMM_ROTR(imm, 16-(rot))
 
#define M_ADD(d, a, b)   M_DAT(UNCOND,0x04,d,a,0,0,b) /* d = a + b */
 
#define M_ADC(d, a, b)   M_DAT(UNCOND,0x05,d,a,0,0,b) /* d = a + b (with Carry) */
 
#define M_SUB(d, a, b)   M_DAT(UNCOND,0x02,d,a,0,0,b) /* d = a - b */
 
#define M_SBC(d, a, b)   M_DAT(UNCOND,0x06,d,a,0,0,b) /* d = a - b (with Carry) */
 
#define M_AND(a, b, d)   M_DAT(UNCOND,0x00,d,a,0,0,b) /* d = a & b */
 
#define M_ORR(a, b, d)   M_DAT(UNCOND,0x0c,d,a,0,0,b) /* d = a | b */
 
#define M_EOR(a, b, d)   M_DAT(UNCOND,0x01,d,a,0,0,b) /* d = a ^ b */
 
#define M_TST(a, b)   M_DAT(UNCOND,0x08,0,a,1,0,b) /* TST a & b */
 
#define M_TEQ(a, b)   M_DAT(UNCOND,0x09,0,a,1,0,b) /* TST a ^ b */
 
#define M_CMP(a, b)   M_DAT(UNCOND,0x0a,0,a,1,0,b) /* TST a - b */
 
#define M_MOV(d, b)   M_DAT(UNCOND,0x0d,d,0,0,0,b) /* d = b */
 
#define M_ADD_S(d, a, b)   M_DAT(UNCOND,0x04,d,a,1,0,b) /* d = a + b (update Flags) */
 
#define M_SUB_S(d, a, b)   M_DAT(UNCOND,0x02,d,a,1,0,b) /* d = a - b (update Flags) */
 
#define M_ORR_S(a, b, d)   M_DAT(UNCOND,0x0c,d,a,1,0,b) /* d = a | b (update flags) */
 
#define M_MOV_S(d, b)   M_DAT(UNCOND,0x0d,d,0,1,0,b) /* d = b (update Flags) */
 
#define M_ADD_IMM(d, a, i)   M_DAT(UNCOND,0x04,d,a,0,1,i) /* d = a + i */
 
#define M_ADC_IMM(d, a, i)   M_DAT(UNCOND,0x05,d,a,0,1,i) /* d = a + i (with Carry) */
 
#define M_SUB_IMM(d, a, i)   M_DAT(UNCOND,0x02,d,a,0,1,i) /* d = a - i */
 
#define M_SBC_IMM(d, a, i)   M_DAT(UNCOND,0x06,d,a,0,1,i) /* d = a - i (with Carry) */
 
#define M_RSB_IMM(d, a, i)   M_DAT(UNCOND,0x03,d,a,0,1,i) /* d = -a + i */
 
#define M_RSC_IMM(d, a, i)   M_DAT(UNCOND,0x07,d,a,0,1,i) /* d = -a + i (with Carry) */
 
#define M_AND_IMM(a, i, d)   M_DAT(UNCOND,0x00,d,a,0,1,i) /* d = a & i */
 
#define M_TST_IMM(a, i)   M_DAT(UNCOND,0x08,0,a,1,1,i) /* TST a & i */
 
#define M_TEQ_IMM(a, i)   M_DAT(UNCOND,0x09,0,a,1,1,i) /* TST a ^ i */
 
#define M_CMP_IMM(a, i)   M_DAT(UNCOND,0x0a,0,a,1,1,i) /* TST a - i */
 
#define M_CMN_IMM(a, i)   M_DAT(UNCOND,0x0b,0,a,1,1,i) /* TST a + i */
 
#define M_MOV_IMM(d, i)   M_DAT(UNCOND,0x0d,d,0,0,1,i) /* d = i */
 
#define M_ADD_IMMS(d, a, i)   M_DAT(UNCOND,0x04,d,a,1,1,i) /* d = a + i (update Flags) */
 
#define M_SUB_IMMS(d, a, i)   M_DAT(UNCOND,0x02,d,a,1,1,i) /* d = a - i (update Flags) */
 
#define M_RSB_IMMS(d, a, i)   M_DAT(UNCOND,0x03,d,a,1,1,i) /* d = -a + i (update Flags) */
 
#define M_ADDSUB_IMM(d, a, i)   if((i)>=0) M_ADD_IMM(d,a,i); else M_SUB_IMM(d,a,-(i))
 
#define M_MOVEQ(a, d)   M_DAT(COND_EQ,0x0d,d,0,0,0,a)
 
#define M_EORLE(d, a, b)   M_DAT(COND_LE,0x01,d,a,0,0,b)
 
#define M_MOVVS_IMM(i, d)   M_DAT(COND_VS,0x0d,d,0,0,1,i)
 
#define M_MOVEQ_IMM(i, d)   M_DAT(COND_EQ,0x0d,d,0,0,1,i)
 
#define M_MOVNE_IMM(i, d)   M_DAT(COND_NE,0x0d,d,0,0,1,i)
 
#define M_MOVLT_IMM(i, d)   M_DAT(COND_LT,0x0d,d,0,0,1,i)
 
#define M_MOVGT_IMM(i, d)   M_DAT(COND_GT,0x0d,d,0,0,1,i)
 
#define M_MOVLS_IMM(i, d)   M_DAT(COND_LS,0x0d,d,0,0,1,i)
 
#define M_ADDHI_IMM(d, a, i)   M_DAT(COND_HI,0x04,d,a,0,1,i)
 
#define M_ADDLT_IMM(d, a, i)   M_DAT(COND_LT,0x04,d,a,0,1,i)
 
#define M_ADDGT_IMM(d, a, i)   M_DAT(COND_GT,0x04,d,a,0,1,i)
 
#define M_SUBLO_IMM(d, a, i)   M_DAT(COND_CC,0x02,d,a,0,1,i)
 
#define M_SUBLT_IMM(d, a, i)   M_DAT(COND_LT,0x02,d,a,0,1,i)
 
#define M_SUBGT_IMM(d, a, i)   M_DAT(COND_GT,0x02,d,a,0,1,i)
 
#define M_RSBMI_IMM(d, a, i)   M_DAT(COND_MI,0x03,d,a,0,1,i)
 
#define M_ADCMI_IMM(d, a, i)   M_DAT(COND_MI,0x05,d,a,0,1,i)
 
#define M_CMPEQ(a, b)   M_DAT(COND_EQ,0x0a,0,a,1,0,b) /* TST a - b */
 
#define M_CMPLE(a, b)   M_DAT(COND_LE,0x0a,0,a,1,0,b) /* TST a - b */
 
#define M_CMPEQ_IMM(a, i)   M_DAT(COND_EQ,0x0a,0,a,1,1,i)
 
#define M_MUL(d, a, b)   M_MULT(UNCOND,d,a,b,0,0,0x0) /* d = a * b */
 
#define M_B(off)   M_BRA(UNCOND,0,off) /* unconditional branch */
 
#define M_BL(off)   M_BRA(UNCOND,1,off) /* branch and link */
 
#define M_BEQ(off)   M_BRA(COND_EQ,0,off) /* conditional branches */
 
#define M_BNE(off)   M_BRA(COND_NE,0,off)
 
#define M_BGE(off)   M_BRA(COND_GE,0,off)
 
#define M_BGT(off)   M_BRA(COND_GT,0,off)
 
#define M_BLT(off)   M_BRA(COND_LT,0,off)
 
#define M_BLE(off)   M_BRA(COND_LE,0,off)
 
#define M_BHI(off)   M_BRA(COND_HI,0,off) /* unsigned conditional */
 
#define M_BHS(off)   M_BRA(COND_CS,0,off)
 
#define M_BLO(off)   M_BRA(COND_CC,0,off)
 
#define M_BLS(off)   M_BRA(COND_LS,0,off)
 
#define M_BX(a)   M_BRAX(COND_AL,0,a)
 
#define M_BLX(a)   M_BRAX(COND_AL,1,a)
 
#define M_LDMFD(regs, base)   M_MEM_MULTI(UNCOND,1,0,regs,base,0,1,1)
 
#define M_STMFD(regs, base)   M_MEM_MULTI(UNCOND,0,0,regs,base,1,0,1)
 
#define M_LDR_REG(d, base, offreg)   M_MEM(UNCOND,1,0,d,base,offreg,1,1,1,0)
 
#define M_STR_REG(d, base, offreg)   M_MEM(UNCOND,0,0,d,base,offreg,1,1,1,0)
 
#define M_LDR_INTERN(d, base, off)
 
#define M_STR_INTERN(d, base, off)
 
#define M_LDR_UPDATE(d, base, off)
 
#define M_STR_UPDATE(d, base, off)
 
#define M_LDRH(d, base, off)
 
#define M_LDRSH(d, base, off)
 
#define M_LDRSB(d, base, off)
 
#define M_STRH(d, base, off)
 
#define M_STRB(d, base, off)
 
#define M_TRAP(a, i)   M_UNDEFINED(UNCOND,i,a);
 
#define M_TRAPEQ(a, i)   M_UNDEFINED(COND_EQ,i,a);
 
#define M_TRAPNE(a, i)   M_UNDEFINED(COND_NE,i,a);
 
#define M_TRAPLT(a, i)   M_UNDEFINED(COND_LT,i,a);
 
#define M_TRAPLE(a, i)   M_UNDEFINED(COND_LE,i,a);
 
#define M_TRAPHI(a, i)   M_UNDEFINED(COND_HI,i,a);
 
#define M_TRAPHS(a, i)   M_UNDEFINED(COND_CS,i,a);
 
#define M_LDRD_INTERN(d, base, off)
 
#define M_STRD_INTERN(d, base, off)
 
#define M_LDRD_ALTERN(d, base, off)
 
#define M_LDRD_UPDATE(d, base, off)
 
#define M_STRD_UPDATE(d, base, off)
 
#define GET_FIRST_REG(d)   GET_HIGH_REG(d)
 
#define GET_SECOND_REG(d)   GET_LOW_REG(d)
 
#define M_FADD(a, b, d)   M_CPDOS(UNCOND,0x00,0,d,a,b) /* d = a + b */
 
#define M_FSUB(a, b, d)   M_CPDOS(UNCOND,0x02,0,d,a,b) /* d = a - b */
 
#define M_FMUL(a, b, d)   M_CPDOS(UNCOND,0x01,0,d,a,b) /* d = a * b */
 
#define M_FDIV(a, b, d)   M_CPDOS(UNCOND,0x04,0,d,a,b) /* d = a / b */
 
#define M_RMFS(d, a, b)   M_CPDOS(UNCOND,0x08,0,d,a,b) /* d = a % b */
 
#define M_DADD(a, b, d)   M_CPDOD(UNCOND,0x00,0,d,a,b) /* d = a + b */
 
#define M_DSUB(a, b, d)   M_CPDOD(UNCOND,0x02,0,d,a,b) /* d = a - b */
 
#define M_DMUL(a, b, d)   M_CPDOD(UNCOND,0x01,0,d,a,b) /* d = a * b */
 
#define M_DDIV(a, b, d)   M_CPDOD(UNCOND,0x04,0,d,a,b) /* d = a / b */
 
#define M_RMFD(d, a, b)   M_CPDOD(UNCOND,0x08,0,d,a,b) /* d = a % b */
 
#define M_FMOV(a, d)   M_CPDOS(UNCOND,0x00,1,d,0,a) /* d = a */
 
#define M_DMOV(a, d)   M_CPDOD(UNCOND,0x00,1,d,0,a) /* d = a */
 
#define M_FNEG(a, d)   M_CPDOS(UNCOND,0x01,1,d,0,a) /* d = - a */
 
#define M_DNEG(a, d)   M_CPDOD(UNCOND,0x01,1,d,0,a) /* d = - a */
 
#define M_FCMP(a, b)   M_CPRTX(UNCOND,1,0x0f,a,b) /* COMPARE a; b */
 
#define M_DCMP(a, b)   M_CPRTX(UNCOND,1,0x0f,a,b) /* COMPARE a; b */
 
#define M_CVTDF(a, b)   M_FMOV(a,b)
 
#define M_CVTFD(a, b)   M_DMOV(a,b)
 
#define M_CVTIF(a, d)   M_CPRTS(UNCOND,0,a,d,0) /* d = (float) a */
 
#define M_CVTID(a, d)   M_CPRTD(UNCOND,0,a,d,0) /* d = (float) a */
 
#define M_CVTFI(a, d)   M_CPRTI(UNCOND,1,d,0,a) /* d = (int) a */
 
#define M_CVTDI(a, d)   M_CPRTI(UNCOND,1,d,0,a) /* d = (int) a */
 
#define M_CAST_I2F(a, Fb)
 
#define M_CAST_L2D(a, Fb)
 
#define M_CAST_F2I(Fa, b)
 
#define M_CAST_D2L(Fa, b)
 
#define M_FLD_INTERN(d, base, off)
 
#define M_DLD_INTERN(d, base, off)
 
#define M_FST_INTERN(d, base, off)
 
#define M_DST_INTERN(d, base, off)
 
#define M_FLD_UPDATE(d, base, off)
 
#define M_DLD_UPDATE(d, base, off)
 
#define M_FST_UPDATE(d, base, off)
 
#define M_DST_UPDATE(d, base, off)
 
#define M_LDR(d, base, offset)
 
#define M_LDR_NEGATIVE(d, base, offset)
 
#define M_LDRD(d, base, offset)
 
#define M_LDFS(d, base, offset)
 
#define M_LDFD(d, base, offset)
 
#define M_STR(d, base, offset)
 
#define M_STRD(d, base, offset)
 
#define M_STFS(d, base, offset)
 
#define M_STFD(d, base, offset)
 
#define M_ADD_IMM_EXT_MUL4(d, n, imm)
 
#define M_SUB_IMM_EXT_MUL4(d, n, imm)
 
#define ICONST(d, c)   emit_iconst(cd, (d), (c))
 
#define LCONST(d, c)
 
#define FCONST(d, c)
 
#define DCONST(d, c)
 
#define M_LONGBRANCH(adr)
 
#define M_DSEG_LOAD(reg, offset)   M_LDR_NEGATIVE(reg, REG_PV, offset)
 
#define M_DSEG_BRANCH(offset)
 
#define M_ILD(a, b, c)   M_LDR(a,b,c)
 
#define M_LLD(a, b, c)   M_LDRD(a,b,c)
 
#define M_ILD_INTERN(a, b, c)   M_LDR_INTERN(a,b,c)
 
#define M_LLD_INTERN(a, b, c)   M_LDRD_INTERN(a,b,c)
 
#define M_ALD(a, b, c)   M_ILD(a,b,c)
 
#define M_ALD_INTERN(a, b, c)   M_ILD_INTERN(a,b,c)
 
#define M_ALD_DSEG(a, c)   M_DSEG_LOAD(a,c)
 
#define M_IST(a, b, c)   M_STR(a,b,c)
 
#define M_LST(a, b, c)   M_STRD(a,b,c)
 
#define M_IST_INTERN(a, b, c)   M_STR_INTERN(a,b,c)
 
#define M_LST_INTERN(a, b, c)   M_STRD_INTERN(a,b,c)
 
#define M_AST(a, b, c)   M_IST(a,b,c)
 
#define M_AST_INTERN(a, b, c)   M_IST_INTERN(a,b,c)
 
#define M_ACMP(a, b)   M_CMP(a,b)
 
#define M_ICMP(a, b)   M_CMP(a,b)
 
#define M_TEST(a)   M_TEQ_IMM(a, 0);
 
#define M_FLD(a, b, c)   M_LDFS(a,b,c)
 
#define M_DLD(a, b, c)   M_LDFD(a,b,c)
 
#define M_FST(a, b, c)   M_STFS(a,b,c)
 
#define M_DST(a, b, c)   M_STFD(a,b,c)
 

Functions

void asm_debug (int a1, int a2, int a3, int a4)
 
void asm_debug_intern (int a1, int a2, int a3, int a4)
 

Macro Definition Documentation

#define ALIGNCODENOP   /* empty */

Definition at line 81 of file codegen.hpp.

#define ASM_DEBUG_EXECUTE
Value:
M_LDMFD(0x7fff, REG_SP)
#define REG_SP
Definition: md-abi.hpp:53
void asm_debug_intern(int a1, int a2, int a3, int a4)
#define M_LONGBRANCH(adr)
Definition: codegen.hpp:1123
#define M_LDMFD(regs, base)
Definition: codegen.hpp:501

Definition at line 121 of file codegen.hpp.

#define ASM_DEBUG_PREPARE   M_STMFD(0x7fff, REG_SP)

Definition at line 119 of file codegen.hpp.

#define BRANCH_NOPS
Value:
do { \
} while (0)
#define M_NOP
Definition: codegen.hpp:262

Definition at line 94 of file codegen.hpp.

#define CHECK_FLT_REG (   r)    assert((r)>=0 && (r)<=15)

Definition at line 88 of file codegen.hpp.

#define CHECK_INT_REG (   r)    assert((r)>=0 && (r)<=15)

Definition at line 87 of file codegen.hpp.

#define CHECK_OFFSET (   off,
  max 
)    assert(IS_OFFSET(off,max))

Definition at line 89 of file codegen.hpp.

#define COND_AL   0xE /* Always */

Definition at line 146 of file codegen.hpp.

#define COND_CC   0x3 /* Carry clear C clear */

Definition at line 135 of file codegen.hpp.

#define COND_CS   0x2 /* Carry set C set */

Definition at line 134 of file codegen.hpp.

#define COND_EQ   0x0 /* Equal Z set */

Definition at line 132 of file codegen.hpp.

#define COND_GE   0xA /* Sig. greater, equal */

Definition at line 142 of file codegen.hpp.

#define COND_GT   0xC /* Sig. greater than */

Definition at line 144 of file codegen.hpp.

#define COND_HI   0x8 /* Unsigned higher */

Definition at line 140 of file codegen.hpp.

#define COND_LE   0xD /* Sig. less, equal */

Definition at line 145 of file codegen.hpp.

#define COND_LS   0x9 /* Unsigned lower, same */

Definition at line 141 of file codegen.hpp.

#define COND_LT   0xB /* Sig. less than */

Definition at line 143 of file codegen.hpp.

#define COND_MI   0x4 /* Negative N set */

Definition at line 136 of file codegen.hpp.

#define COND_NE   0x1 /* Not equal Z clear */

Definition at line 133 of file codegen.hpp.

#define COND_PL   0x5 /* Positive N clear */

Definition at line 137 of file codegen.hpp.

#define COND_VC   0x7 /* No overflow V clear */

Definition at line 139 of file codegen.hpp.

#define COND_VS   0x6 /* Overflow V set */

Definition at line 138 of file codegen.hpp.

#define CONDNV   0xF /* Special (see A3-5) */

Definition at line 147 of file codegen.hpp.

#define DCD (   val)
Value:
do { \
*((u4 *) cd->mcodeptr) = val; \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46

Definition at line 396 of file codegen.hpp.

#define DCONST (   d,
 
)
Value:
do { \
disp = dseg_add_double(cd, (c)); \
M_LDFD(d, REG_PV, disp); \
} while (0)
s4 dseg_add_double(codegendata *cd, double value)
Definition: dseg.cpp:465
#define REG_PV
Definition: md-abi.hpp:42
#define M_LDFD(d, base, offset)
Definition: codegen.hpp:962

Definition at line 1110 of file codegen.hpp.

#define FCONST (   d,
 
)
Value:
do { \
disp = dseg_add_float(cd, (c)); \
M_LDFS(d, REG_PV, disp); \
} while (0)
#define M_LDFS(d, base, offset)
Definition: codegen.hpp:946
#define REG_PV
Definition: md-abi.hpp:42
s4 dseg_add_float(codegendata *cd, float value)
Definition: dseg.cpp:392

Definition at line 1104 of file codegen.hpp.

#define GET_FIRST_REG (   d)    GET_HIGH_REG(d)

Definition at line 652 of file codegen.hpp.

#define GET_SECOND_REG (   d)    GET_LOW_REG(d)

Definition at line 653 of file codegen.hpp.

#define ICONST (   d,
 
)    emit_iconst(cd, (d), (c))

Definition at line 1087 of file codegen.hpp.

#define IMM_ROTL (   imm,
  rot 
)    IMM_ROTR(imm, 16-(rot))

Definition at line 414 of file codegen.hpp.

#define IMM_ROTR (   imm,
  rot 
)    ( ((imm) & 0xff) | (((rot) & 0x0f) << 8) )

Definition at line 413 of file codegen.hpp.

#define IS_IMM (   val)    ( ((val) >= 0) && ((val) <= 255) )

Definition at line 84 of file codegen.hpp.

#define IS_OFFSET (   off,
  max 
)    ((s4)(off) <= (max) && (s4)(off) >= -(max))

Definition at line 85 of file codegen.hpp.

#define LCONST (   d,
 
)
Value:
if (IS_IMM((c) >> 32)) { \
M_MOV_IMM(GET_HIGH_REG(d), (s4) ((s8) (c) >> 32)); \
ICONST(GET_LOW_REG(d), (s4) ((s8) (c) & 0xffffffff)); \
} else if (IS_IMM((c) & 0xffffffff)) { \
M_MOV_IMM(GET_LOW_REG(d), (s4) ((s8) (c) & 0xffffffff)); \
ICONST(GET_HIGH_REG(d), (s4) ((s8) (c) >> 32)); \
} else { \
disp = dseg_add_s8(cd, (c)); \
M_LDRD(d, REG_PV, disp); \
}
#define GET_HIGH_REG(a)
#define REG_PV
Definition: md-abi.hpp:42
int64_t s8
Definition: types.hpp:48
#define ICONST(d, c)
Definition: codegen.hpp:1087
#define M_MOV_IMM(d, i)
Definition: codegen.hpp:448
#define GET_LOW_REG(a)
int32_t s4
Definition: types.hpp:45
s4 dseg_add_s8(codegendata *cd, s8 value)
Definition: dseg.cpp:319
#define IS_IMM(val)
Definition: codegen.hpp:84
#define M_LDRD(d, base, offset)
Definition: codegen.hpp:921

Definition at line 1089 of file codegen.hpp.

#define M_ACMP (   a,
 
)    M_CMP(a,b)

Definition at line 1170 of file codegen.hpp.

#define M_ADC (   d,
  a,
 
)    M_DAT(UNCOND,0x05,d,a,0,0,b) /* d = a + b (with Carry) */

Definition at line 422 of file codegen.hpp.

#define M_ADC_IMM (   d,
  a,
  i 
)    M_DAT(UNCOND,0x05,d,a,0,1,i) /* d = a + i (with Carry) */

Definition at line 438 of file codegen.hpp.

#define M_ADCMI_IMM (   d,
  a,
  i 
)    M_DAT(COND_MI,0x05,d,a,0,1,i)

Definition at line 471 of file codegen.hpp.

#define M_ADD (   d,
  a,
 
)    M_DAT(UNCOND,0x04,d,a,0,0,b) /* d = a + b */

Definition at line 421 of file codegen.hpp.

#define M_ADD_IMM (   d,
  a,
  i 
)    M_DAT(UNCOND,0x04,d,a,0,1,i) /* d = a + i */

Definition at line 437 of file codegen.hpp.

#define M_ADD_IMM_EXT_MUL4 (   d,
  n,
  imm 
)
Value:
do { \
assert(d != REG_PC); \
assert((imm) >= 0 && (imm) <= 0x00ffffff); \
M_ADD_IMM(d, n, IMM_ROTL(imm, 1)); \
if ((imm) > 0x000000ff) M_ADD_IMM(d, d, IMM_ROTL((imm) >> 8, 5)); \
if ((imm) > 0x0000ffff) M_ADD_IMM(d, d, IMM_ROTL((imm) >> 16, 9)); \
} while (0)
#define M_ADD_IMM(d, a, i)
Definition: codegen.hpp:437
#define REG_PC
Definition: md-abi.hpp:42
#define IMM_ROTL(imm, rot)
Definition: codegen.hpp:414

Definition at line 1064 of file codegen.hpp.

#define M_ADD_IMMS (   d,
  a,
  i 
)    M_DAT(UNCOND,0x04,d,a,1,1,i) /* d = a + i (update Flags) */

Definition at line 449 of file codegen.hpp.

#define M_ADD_S (   d,
  a,
 
)    M_DAT(UNCOND,0x04,d,a,1,0,b) /* d = a + b (update Flags) */

Definition at line 432 of file codegen.hpp.

#define M_ADDGT_IMM (   d,
  a,
  i 
)    M_DAT(COND_GT,0x04,d,a,0,1,i)

Definition at line 466 of file codegen.hpp.

#define M_ADDHI_IMM (   d,
  a,
  i 
)    M_DAT(COND_HI,0x04,d,a,0,1,i)

Definition at line 464 of file codegen.hpp.

#define M_ADDLT_IMM (   d,
  a,
  i 
)    M_DAT(COND_LT,0x04,d,a,0,1,i)

Definition at line 465 of file codegen.hpp.

#define M_ADDSUB_IMM (   d,
  a,
  i 
)    if((i)>=0) M_ADD_IMM(d,a,i); else M_SUB_IMM(d,a,-(i))

Definition at line 453 of file codegen.hpp.

#define M_ALD (   a,
  b,
 
)    M_ILD(a,b,c)

Definition at line 1155 of file codegen.hpp.

#define M_ALD_DSEG (   a,
 
)    M_DSEG_LOAD(a,c)

Definition at line 1157 of file codegen.hpp.

#define M_ALD_INTERN (   a,
  b,
 
)    M_ILD_INTERN(a,b,c)

Definition at line 1156 of file codegen.hpp.

#define M_AND (   a,
  b,
 
)    M_DAT(UNCOND,0x00,d,a,0,0,b) /* d = a & b */

Definition at line 425 of file codegen.hpp.

#define M_AND_IMM (   a,
  i,
 
)    M_DAT(UNCOND,0x00,d,a,0,1,i) /* d = a & i */

Definition at line 443 of file codegen.hpp.

#define M_AST (   a,
  b,
 
)    M_IST(a,b,c)

Definition at line 1166 of file codegen.hpp.

#define M_AST_INTERN (   a,
  b,
 
)    M_IST_INTERN(a,b,c)

Definition at line 1167 of file codegen.hpp.

#define M_B (   off)    M_BRA(UNCOND,0,off) /* unconditional branch */

Definition at line 480 of file codegen.hpp.

#define M_BEQ (   off)    M_BRA(COND_EQ,0,off) /* conditional branches */

Definition at line 482 of file codegen.hpp.

#define M_BGE (   off)    M_BRA(COND_GE,0,off)

Definition at line 484 of file codegen.hpp.

#define M_BGT (   off)    M_BRA(COND_GT,0,off)

Definition at line 485 of file codegen.hpp.

#define M_BHI (   off)    M_BRA(COND_HI,0,off) /* unsigned conditional */

Definition at line 488 of file codegen.hpp.

#define M_BHS (   off)    M_BRA(COND_CS,0,off)

Definition at line 489 of file codegen.hpp.

#define M_BL (   off)    M_BRA(UNCOND,1,off) /* branch and link */

Definition at line 481 of file codegen.hpp.

#define M_BLE (   off)    M_BRA(COND_LE,0,off)

Definition at line 487 of file codegen.hpp.

#define M_BLO (   off)    M_BRA(COND_CC,0,off)

Definition at line 490 of file codegen.hpp.

#define M_BLS (   off)    M_BRA(COND_LS,0,off)

Definition at line 491 of file codegen.hpp.

#define M_BLT (   off)    M_BRA(COND_LT,0,off)

Definition at line 486 of file codegen.hpp.

#define M_BLX (   a)    M_BRAX(COND_AL,1,a)

Definition at line 494 of file codegen.hpp.

#define M_BNE (   off)    M_BRA(COND_NE,0,off)

Definition at line 483 of file codegen.hpp.

#define M_BRA (   cond,
  L,
  offset 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (0x5 << 25) | ((L) << 24) | ((offset) & 0x00ffffff)); \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46

Definition at line 237 of file codegen.hpp.

#define M_BRAX (   cond,
  L,
  reg 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (0x12 << 20) | (0xfff << 8) | (L << 5) | (1 << 4) | ((reg) & 0xf)); \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46

Definition at line 224 of file codegen.hpp.

#define M_BREAKPOINT (   imm)
Value:
do { \
*((u4 *) cd->mcodeptr) = (0x0e12 << 20) | (0x07 << 4) | (((imm) & 0xfff0) << (8-4)) | ((imm) & 0x0f); \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46

Definition at line 271 of file codegen.hpp.

#define M_BX (   a)    M_BRAX(COND_AL,0,a)

Definition at line 493 of file codegen.hpp.

#define M_CAST_D2L (   Fa,
 
)
Value:
do { \
} while (0)
#define REG_SP
Definition: md-abi.hpp:53
#define GET_HIGH_REG(a)
#define CHECK_INT_REG(r)
Definition: codegen.hpp:87
#define M_DST_UPDATE(d, base, off)
Definition: codegen.hpp:864
#define GET_LOW_REG(a)
#define M_LDRD_UPDATE(d, base, off)
Definition: codegen.hpp:638

Definition at line 780 of file codegen.hpp.

#define M_CAST_F2I (   Fa,
 
)
Value:
do { \
} while (0)
#define REG_SP
Definition: md-abi.hpp:53
#define CHECK_INT_REG(r)
Definition: codegen.hpp:87
#define M_LDR_UPDATE(d, base, off)
Definition: codegen.hpp:519
#define CHECK_FLT_REG(r)
Definition: codegen.hpp:88
#define M_FST_UPDATE(d, base, off)
Definition: codegen.hpp:858

Definition at line 772 of file codegen.hpp.

#define M_CAST_I2F (   a,
  Fb 
)
Value:
do { \
} while (0)
#define REG_SP
Definition: md-abi.hpp:53
#define M_STR_UPDATE(d, base, off)
Definition: codegen.hpp:525
#define CHECK_INT_REG(r)
Definition: codegen.hpp:87
#define M_FLD_UPDATE(d, base, off)
Definition: codegen.hpp:846
#define CHECK_FLT_REG(r)
Definition: codegen.hpp:88

Definition at line 755 of file codegen.hpp.

#define M_CAST_L2D (   a,
  Fb 
)
Value:
do { \
} while (0)
#define REG_SP
Definition: md-abi.hpp:53
#define M_STRD_UPDATE(d, base, off)
Definition: codegen.hpp:645
#define GET_HIGH_REG(a)
#define CHECK_INT_REG(r)
Definition: codegen.hpp:87
#define GET_LOW_REG(a)
#define CHECK_FLT_REG(r)
Definition: codegen.hpp:88
#define M_DLD_UPDATE(d, base, off)
Definition: codegen.hpp:852

Definition at line 763 of file codegen.hpp.

#define M_CMN_IMM (   a,
  i 
)    M_DAT(UNCOND,0x0b,0,a,1,1,i) /* TST a + i */

Definition at line 447 of file codegen.hpp.

#define M_CMP (   a,
 
)    M_DAT(UNCOND,0x0a,0,a,1,0,b) /* TST a - b */

Definition at line 430 of file codegen.hpp.

#define M_CMP_IMM (   a,
  i 
)    M_DAT(UNCOND,0x0a,0,a,1,1,i) /* TST a - i */

Definition at line 446 of file codegen.hpp.

#define M_CMPEQ (   a,
 
)    M_DAT(COND_EQ,0x0a,0,a,1,0,b) /* TST a - b */

Definition at line 473 of file codegen.hpp.

#define M_CMPEQ_IMM (   a,
  i 
)    M_DAT(COND_EQ,0x0a,0,a,1,1,i)

Definition at line 476 of file codegen.hpp.

#define M_CMPLE (   a,
 
)    M_DAT(COND_LE,0x0a,0,a,1,0,b) /* TST a - b */

Definition at line 474 of file codegen.hpp.

#define M_CPDOD (   cond,
  op,
  D,
  Fd,
  Fn,
  Fm 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (0x0e << 24) | (1 << 8) | ((op) << 20) | ((D) << 15) | ((Fd) << 12) | ((Fn) << 16) | ((Fm) & 0x0f) | (1 << 7)); \
cd->mcodeptr += 4; \
} while (0)
u2 op
Definition: disass.cpp:129
uint32_t u4
Definition: types.hpp:46

Definition at line 309 of file codegen.hpp.

#define M_CPDOS (   cond,
  op,
  D,
  Fd,
  Fn,
  Fm 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (0x0e << 24) | (1 << 8) | ((op) << 20) | ((D) << 15) | ((Fd) << 12) | ((Fn) << 16) | ((Fm) & 0x0f)); \
cd->mcodeptr += 4; \
} while (0)
u2 op
Definition: disass.cpp:129
uint32_t u4
Definition: types.hpp:46

Definition at line 302 of file codegen.hpp.

#define M_CPDP (   cond,
  p,
  q,
  r,
  s,
  cp_num,
  D,
  N,
  M,
  Fd,
  Fn,
  Fm 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (0x0e << 24) | ((p) << 23) | ((q) << 21) | ((r) << 20) | ((s) << 6) | ((cp_num) << 8) | ((D) << 22) | ((N) << 7) | ((M) << 5) | ((Fd) << 12) | ((Fn) << 16) | ((Fm) & 0x0f)); \
cd->mcodeptr += 4; \
} while (0)
#define N(name)
Definition: icmd.cpp:34
uint32_t u4
Definition: types.hpp:46
const Method & M

Definition at line 316 of file codegen.hpp.

#define M_CPDPF (   cond,
  p,
  q,
  r,
  s,
  cp_num,
  Fd,
  Fn,
  Fm 
)    M_CPDP(cond,p,q,r,s,cp_num,(Fd)>>4,(Fn)>>4,(Fm)>>4,(Fd)&0xf,(Fn)&0xf,Fm)

Definition at line 322 of file codegen.hpp.

#define M_CPDT (   cond,
  L,
  T1,
  T0,
  Fd,
  n,
  off,
  P,
  U,
 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (0x0c << 24) | (1 << 8) | ((L) << 20) | ((T1) << 22) | ((T0) << 15) | ((Fd) << 12) | ((n) << 16) | ((off) & 0xff) | ((P) << 24) | ((U) << 23) | ((W) << 21)); \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46

Definition at line 336 of file codegen.hpp.

#define M_CPLS (   cond,
  L,
  P,
  U,
  W,
  cp_num,
  D,
  Fd,
  n,
  off 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (0x0c << 24) | ((P) << 24) | ((U) << 23) | ((W) << 21) | ((L) << 20) | ((cp_num) << 8) | ((D) << 22) | ((Fd) << 12) | ((n) << 16) | ((off) & 0xff)); \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46

Definition at line 342 of file codegen.hpp.

#define M_CPRT (   cond,
  op,
  L,
  cp_num,
  N,
  Fn,
 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (0x0e << 24) | (1 << 4) | ((op) << 21) | ((L) << 20) | ((cp_num) << 8) | ((N) << 7) | ((Fn) << 16) | ((n) << 12)); \
cd->mcodeptr += 4; \
} while (0)
#define N(name)
Definition: icmd.cpp:34
u2 op
Definition: disass.cpp:129
uint32_t u4
Definition: types.hpp:46

Definition at line 357 of file codegen.hpp.

#define M_CPRTD (   cond,
  L,
  d,
  Fn,
  Fm 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (0x0e << 24) | (1 << 8) | (1 << 4) | ((L) << 20) | ((d) << 12) | ((Fn) << 16) | (Fm) | (1 << 7)); \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46

Definition at line 370 of file codegen.hpp.

#define M_CPRTI (   cond,
  L,
  d,
  Fn,
  Fm 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (0x0e << 24) | (1 << 8) | (1 << 4) | ((L) << 20) | ((d) << 12) | ((Fn) << 16) | (Fm) | (3 << 5)); \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46

Definition at line 377 of file codegen.hpp.

#define M_CPRTS (   cond,
  L,
  d,
  Fn,
  Fm 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (0x0e << 24) | (1 << 8) | (1 << 4) | ((L) << 20) | ((d) << 12) | ((Fn) << 16) | (Fm)); \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46

Definition at line 363 of file codegen.hpp.

#define M_CPRTX (   cond,
  L,
  d,
  Fn,
  Fm 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (0x0e << 24) | (1 << 8) | (1 << 4) | ((L) << 20) | ((d) << 12) | ((Fn) << 16) | (Fm) | (1 << 23)); \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46

Definition at line 386 of file codegen.hpp.

#define M_CVTDF (   a,
 
)    M_FMOV(a,b)

Definition at line 720 of file codegen.hpp.

#define M_CVTDI (   a,
 
)    M_CPRTI(UNCOND,1,d,0,a) /* d = (int) a */

Definition at line 725 of file codegen.hpp.

#define M_CVTFD (   a,
 
)    M_DMOV(a,b)

Definition at line 721 of file codegen.hpp.

#define M_CVTFI (   a,
 
)    M_CPRTI(UNCOND,1,d,0,a) /* d = (int) a */

Definition at line 724 of file codegen.hpp.

#define M_CVTID (   a,
 
)    M_CPRTD(UNCOND,0,a,d,0) /* d = (float) a */

Definition at line 723 of file codegen.hpp.

#define M_CVTIF (   a,
 
)    M_CPRTS(UNCOND,0,a,d,0) /* d = (float) a */

Definition at line 722 of file codegen.hpp.

#define M_DADD (   a,
  b,
 
)    M_CPDOD(UNCOND,0x00,0,d,a,b) /* d = a + b */

Definition at line 706 of file codegen.hpp.

#define M_DAT (   cond,
  op,
  d,
  n,
  S,
  I,
  shift 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | ((op) << 21) | ((d) << 12) | ((n) << 16) | ((I) << 25) | ((S) << 20) | ((shift) & 0x00000fff)); \
cd->mcodeptr += 4; \
} while (0)
u2 op
Definition: disass.cpp:129
uint32_t u4
Definition: types.hpp:46
#define I(value)
Definition: codegen.c:279

Definition at line 160 of file codegen.hpp.

#define M_DCMP (   a,
 
)    M_CPRTX(UNCOND,1,0x0f,a,b) /* COMPARE a; b */

Definition at line 718 of file codegen.hpp.

#define M_DDIV (   a,
  b,
 
)    M_CPDOD(UNCOND,0x04,0,d,a,b) /* d = a / b */

Definition at line 709 of file codegen.hpp.

#define M_DLD (   a,
  b,
 
)    M_LDFD(a,b,c)

Definition at line 1180 of file codegen.hpp.

#define M_DLD_INTERN (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x03ff); \
M_CPDT(UNCOND,1,0,1,d,base,(((off) < 0) ? -(off) >> 2 : (off) >> 2),1,(((off) < 0) ? 0 : 1),0); \
} while (0)
#define M_CPDT(cond, L, T1, T0, Fd, n, off, P, U, W)
Definition: codegen.hpp:336
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define UNCOND
Definition: codegen.hpp:148

Definition at line 828 of file codegen.hpp.

#define M_DLD_UPDATE (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x03ff); \
M_CPDT(UNCOND,1,0,1,d,base,(((off) < 0) ? -(off) >> 2 : (off) >> 2),0,(((off) < 0) ? 0 : 1),1); \
} while (0)
#define M_CPDT(cond, L, T1, T0, Fd, n, off, P, U, W)
Definition: codegen.hpp:336
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define UNCOND
Definition: codegen.hpp:148

Definition at line 852 of file codegen.hpp.

#define M_DMOV (   a,
 
)    M_CPDOD(UNCOND,0x00,1,d,0,a) /* d = a */

Definition at line 713 of file codegen.hpp.

#define M_DMUL (   a,
  b,
 
)    M_CPDOD(UNCOND,0x01,0,d,a,b) /* d = a * b */

Definition at line 708 of file codegen.hpp.

#define M_DNEG (   a,
 
)    M_CPDOD(UNCOND,0x01,1,d,0,a) /* d = - a */

Definition at line 715 of file codegen.hpp.

#define M_DSEG_BRANCH (   offset)
Value:
if (IS_OFFSET(offset, 0x0fff)) { \
} else { \
/*assert((offset) <= 0);*/ \
CHECK_OFFSET(offset,0x0fffff); \
M_SUB_IMM(REG_ITMP3, REG_PV, ((-(offset) >> 12) & 0xff) | (((10) & 0x0f) << 8)); /*TODO: more to go*/ \
M_LDR_INTERN(REG_PC, REG_ITMP3, -(-(offset) & 0x0fff)); /*TODO: this looks ugly*/ \
}
#define REG_LR
Definition: md-abi.hpp:40
#define REG_PV
Definition: md-abi.hpp:42
#define REG_PC
Definition: md-abi.hpp:42
#define M_MOV(d, b)
Definition: codegen.hpp:431
#define M_LDR_INTERN(d, base, off)
Definition: codegen.hpp:507
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_SUB_IMM(d, a, i)
Definition: codegen.hpp:439
#define IS_OFFSET(off, max)
Definition: codegen.hpp:85
#define REG_ITMP3
Definition: md-abi.hpp:48

Definition at line 1136 of file codegen.hpp.

#define M_DSEG_LOAD (   reg,
  offset 
)    M_LDR_NEGATIVE(reg, REG_PV, offset)

Definition at line 1133 of file codegen.hpp.

#define M_DST (   a,
  b,
 
)    M_STFD(a,b,c)

Definition at line 1183 of file codegen.hpp.

#define M_DST_INTERN (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x03ff); \
M_CPDT(UNCOND,0,0,1,d,base,(((off) < 0) ? -(off) >> 2 : (off) >> 2),1,(((off) < 0) ? 0 : 1),0); \
} while (0)
#define M_CPDT(cond, L, T1, T0, Fd, n, off, P, U, W)
Definition: codegen.hpp:336
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define UNCOND
Definition: codegen.hpp:148

Definition at line 840 of file codegen.hpp.

#define M_DST_UPDATE (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x03ff); \
M_CPDT(UNCOND,0,0,1,d,base,(((off) < 0) ? -(off) >> 2 : (off) >> 2),1,(((off) < 0) ? 0 : 1),1); \
} while (0)
#define M_CPDT(cond, L, T1, T0, Fd, n, off, P, U, W)
Definition: codegen.hpp:336
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define UNCOND
Definition: codegen.hpp:148

Definition at line 864 of file codegen.hpp.

#define M_DSUB (   a,
  b,
 
)    M_CPDOD(UNCOND,0x02,0,d,a,b) /* d = a - b */

Definition at line 707 of file codegen.hpp.

#define M_EOR (   a,
  b,
 
)    M_DAT(UNCOND,0x01,d,a,0,0,b) /* d = a ^ b */

Definition at line 427 of file codegen.hpp.

#define M_EORLE (   d,
  a,
 
)    M_DAT(COND_LE,0x01,d,a,0,0,b)

Definition at line 455 of file codegen.hpp.

#define M_FADD (   a,
  b,
 
)    M_CPDOS(UNCOND,0x00,0,d,a,b) /* d = a + b */

Definition at line 701 of file codegen.hpp.

#define M_FCMP (   a,
 
)    M_CPRTX(UNCOND,1,0x0f,a,b) /* COMPARE a; b */

Definition at line 717 of file codegen.hpp.

#define M_FDIV (   a,
  b,
 
)    M_CPDOS(UNCOND,0x04,0,d,a,b) /* d = a / b */

Definition at line 704 of file codegen.hpp.

#define M_FLD (   a,
  b,
 
)    M_LDFS(a,b,c)

Definition at line 1179 of file codegen.hpp.

#define M_FLD_INTERN (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x03ff); \
M_CPDT(UNCOND,1,0,0,d,base,(((off) < 0) ? -(off) >> 2 : (off) >> 2),1,(((off) < 0) ? 0 : 1),0); \
} while (0)
#define M_CPDT(cond, L, T1, T0, Fd, n, off, P, U, W)
Definition: codegen.hpp:336
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define UNCOND
Definition: codegen.hpp:148

Definition at line 822 of file codegen.hpp.

#define M_FLD_UPDATE (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x03ff); \
M_CPDT(UNCOND,1,0,0,d,base,(((off) < 0) ? -(off) >> 2 : (off) >> 2),0,(((off) < 0) ? 0 : 1),1); \
} while (0)
#define M_CPDT(cond, L, T1, T0, Fd, n, off, P, U, W)
Definition: codegen.hpp:336
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define UNCOND
Definition: codegen.hpp:148

Definition at line 846 of file codegen.hpp.

#define M_FMOV (   a,
 
)    M_CPDOS(UNCOND,0x00,1,d,0,a) /* d = a */

Definition at line 712 of file codegen.hpp.

#define M_FMUL (   a,
  b,
 
)    M_CPDOS(UNCOND,0x01,0,d,a,b) /* d = a * b */

Definition at line 703 of file codegen.hpp.

#define M_FNEG (   a,
 
)    M_CPDOS(UNCOND,0x01,1,d,0,a) /* d = - a */

Definition at line 714 of file codegen.hpp.

#define M_FST (   a,
  b,
 
)    M_STFS(a,b,c)

Definition at line 1182 of file codegen.hpp.

#define M_FST_INTERN (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x03ff); \
M_CPDT(UNCOND,0,0,0,d,base,(((off) < 0) ? -(off) >> 2 : (off) >> 2),1,(((off) < 0) ? 0 : 1),0); \
} while (0)
#define M_CPDT(cond, L, T1, T0, Fd, n, off, P, U, W)
Definition: codegen.hpp:336
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define UNCOND
Definition: codegen.hpp:148

Definition at line 834 of file codegen.hpp.

#define M_FST_UPDATE (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x03ff); \
M_CPDT(UNCOND,0,0,0,d,base,(((off) < 0) ? -(off) >> 2 : (off) >> 2),1,(((off) < 0) ? 0 : 1),1); \
} while (0)
#define M_CPDT(cond, L, T1, T0, Fd, n, off, P, U, W)
Definition: codegen.hpp:336
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define UNCOND
Definition: codegen.hpp:148

Definition at line 858 of file codegen.hpp.

#define M_FSUB (   a,
  b,
 
)    M_CPDOS(UNCOND,0x02,0,d,a,b) /* d = a - b */

Definition at line 702 of file codegen.hpp.

#define M_ICMP (   a,
 
)    M_CMP(a,b)

Definition at line 1171 of file codegen.hpp.

#define M_ILD (   a,
  b,
 
)    M_LDR(a,b,c)

Definition at line 1149 of file codegen.hpp.

#define M_ILD_INTERN (   a,
  b,
 
)    M_LDR_INTERN(a,b,c)

Definition at line 1152 of file codegen.hpp.

#define M_IST (   a,
  b,
 
)    M_STR(a,b,c)

Definition at line 1160 of file codegen.hpp.

#define M_IST_INTERN (   a,
  b,
 
)    M_STR_INTERN(a,b,c)

Definition at line 1163 of file codegen.hpp.

#define M_LDFD (   d,
  base,
  offset 
)
Value:
do { \
CHECK_OFFSET(offset, 0x03ffff); \
if (IS_OFFSET(offset, 0x03ff)) { \
M_DLD_INTERN(d, base, offset); \
} else { \
if ((offset) > 0) { \
M_ADD_IMM(REG_ITMP3, base, IMM_ROTL((offset) >> 10, 5)); \
M_DLD_INTERN(d, REG_ITMP3, (offset) & 0x03ff); \
} else { \
M_SUB_IMM(REG_ITMP3, base, IMM_ROTL((-(offset)) >> 10, 5)); \
M_DLD_INTERN(d, REG_ITMP3, -(-(offset) & 0x03ff)); \
} \
} \
} while (0)
#define M_ADD_IMM(d, a, i)
Definition: codegen.hpp:437
#define M_DLD_INTERN(d, base, off)
Definition: codegen.hpp:828
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_SUB_IMM(d, a, i)
Definition: codegen.hpp:439
#define IS_OFFSET(off, max)
Definition: codegen.hpp:85
#define REG_ITMP3
Definition: md-abi.hpp:48
#define IMM_ROTL(imm, rot)
Definition: codegen.hpp:414

Definition at line 962 of file codegen.hpp.

#define M_LDFS (   d,
  base,
  offset 
)
Value:
do { \
CHECK_OFFSET(offset, 0x03ffff); \
if (IS_OFFSET(offset, 0x03ff)) { \
M_FLD_INTERN(d, base, offset); \
} else { \
if ((offset) > 0) { \
M_ADD_IMM(REG_ITMP3, base, IMM_ROTL((offset) >> 10, 5)); \
M_FLD_INTERN(d, REG_ITMP3, (offset) & 0x03ff); \
} else { \
M_SUB_IMM(REG_ITMP3, base, IMM_ROTL((-(offset)) >> 10, 5)); \
M_FLD_INTERN(d, REG_ITMP3, -(-(offset) & 0x03ff)); \
} \
} \
} while (0)
#define M_ADD_IMM(d, a, i)
Definition: codegen.hpp:437
#define M_FLD_INTERN(d, base, off)
Definition: codegen.hpp:822
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_SUB_IMM(d, a, i)
Definition: codegen.hpp:439
#define IS_OFFSET(off, max)
Definition: codegen.hpp:85
#define REG_ITMP3
Definition: md-abi.hpp:48
#define IMM_ROTL(imm, rot)
Definition: codegen.hpp:414

Definition at line 946 of file codegen.hpp.

#define M_LDMFD (   regs,
  base 
)    M_MEM_MULTI(UNCOND,1,0,regs,base,0,1,1)

Definition at line 501 of file codegen.hpp.

#define M_LDR (   d,
  base,
  offset 
)
Value:
do { \
CHECK_OFFSET(offset, 0x0fffff); \
if (IS_OFFSET(offset, 0x000fff)) { \
M_LDR_INTERN(d, base, offset); \
} else { \
/* we cannot handle REG_PC here */ \
assert((d) != REG_PC); \
if ((offset) > 0) { \
M_ADD_IMM(d, base, IMM_ROTL((offset) >> 12, 6)); \
M_LDR_INTERN(d, d, (offset) & 0x000fff); \
} else { \
M_SUB_IMM(d, base, IMM_ROTL((-(offset)) >> 12, 6)); \
M_LDR_INTERN(d, d, -(-(offset) & 0x000fff)); \
} \
} \
} while (0)
#define M_ADD_IMM(d, a, i)
Definition: codegen.hpp:437
#define REG_PC
Definition: md-abi.hpp:42
#define M_LDR_INTERN(d, base, off)
Definition: codegen.hpp:507
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_SUB_IMM(d, a, i)
Definition: codegen.hpp:439
#define IS_OFFSET(off, max)
Definition: codegen.hpp:85
#define IMM_ROTL(imm, rot)
Definition: codegen.hpp:414

Definition at line 891 of file codegen.hpp.

#define M_LDR_INTERN (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x0fff); \
M_MEM(UNCOND,1,0,d,base,(((off) < 0) ? -(off) : off),0,1,(((off) < 0) ? 0 : 1),0); \
} while (0)
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_MEM(cond, L, B, d, n, adr, I, P, U, W)
Definition: codegen.hpp:176
#define UNCOND
Definition: codegen.hpp:148

Definition at line 507 of file codegen.hpp.

#define M_LDR_NEGATIVE (   d,
  base,
  offset 
)
Value:
{ \
/*assert((offset) <= 0);*/ \
if (IS_OFFSET(offset, 0x000fff)) { \
M_LDR_INTERN(d, base, offset); \
} else { \
/* we cannot handle REG_PC here */ \
assert((d) != REG_PC); \
M_SUB_IMM(d, base, IMM_ROTL((-(offset)) >> 12, 6)); \
M_LDR_INTERN(d, d, -(-(offset) & 0x000fff)); \
} \
}
#define REG_PC
Definition: md-abi.hpp:42
#define M_LDR_INTERN(d, base, off)
Definition: codegen.hpp:507
#define M_SUB_IMM(d, a, i)
Definition: codegen.hpp:439
#define IS_OFFSET(off, max)
Definition: codegen.hpp:85
#define IMM_ROTL(imm, rot)
Definition: codegen.hpp:414

Definition at line 909 of file codegen.hpp.

#define M_LDR_REG (   d,
  base,
  offreg 
)    M_MEM(UNCOND,1,0,d,base,offreg,1,1,1,0)

Definition at line 504 of file codegen.hpp.

#define M_LDR_UPDATE (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x0fff); \
M_MEM(UNCOND,1,0,d,base,(((off) < 0) ? -(off) : off),0,0,(((off) < 0) ? 0 : 1),0); \
} while (0)
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_MEM(cond, L, B, d, n, adr, I, P, U, W)
Definition: codegen.hpp:176
#define UNCOND
Definition: codegen.hpp:148

Definition at line 519 of file codegen.hpp.

#define M_LDRD (   d,
  base,
  offset 
)
Value:
do { \
CHECK_OFFSET(offset, 0x0fffff - 4); \
if (IS_OFFSET(offset, 0x000fff - 4)) { \
if (GET_FIRST_REG(d) != (base)) { \
M_LDRD_INTERN(d, base, offset); \
} else { \
M_LDRD_ALTERN(d, base, offset); \
} \
} else if (IS_OFFSET(offset, 0x000fff)) { \
dolog("M_LDRD: this offset seems to be complicated (%d)", offset); \
assert(0); \
} else { \
if ((offset) > 0) { \
M_ADD_IMM(GET_SECOND_REG(d), base, IMM_ROTL((offset) >> 12, 6)); \
M_LDRD_INTERN(d, GET_SECOND_REG(d), (offset) & 0x000fff); \
} else { \
M_SUB_IMM(GET_SECOND_REG(d), base, IMM_ROTL((-(offset)) >> 12, 6)); \
M_LDRD_INTERN(d, GET_SECOND_REG(d), -(-(offset) & 0x000fff)); \
} \
} \
} while (0)
#define dolog
Definition: logging.hpp:171
#define GET_FIRST_REG(d)
Definition: codegen.hpp:652
#define M_ADD_IMM(d, a, i)
Definition: codegen.hpp:437
#define GET_SECOND_REG(d)
Definition: codegen.hpp:653
#define M_LDRD_INTERN(d, base, off)
Definition: codegen.hpp:620
#define M_LDRD_ALTERN(d, base, off)
Definition: codegen.hpp:632
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_SUB_IMM(d, a, i)
Definition: codegen.hpp:439
#define IS_OFFSET(off, max)
Definition: codegen.hpp:85
#define IMM_ROTL(imm, rot)
Definition: codegen.hpp:414

Definition at line 921 of file codegen.hpp.

#define M_LDRD_ALTERN (   d,
  base,
  off 
)
Value:
do { \
M_LDR_INTERN(GET_LOW_REG(d), base, (off) + 4); \
M_LDR_INTERN(GET_HIGH_REG(d), base, off); \
} while (0)
#define GET_HIGH_REG(a)
#define GET_LOW_REG(a)
#define M_LDR_INTERN(d, base, off)
Definition: codegen.hpp:507

Definition at line 632 of file codegen.hpp.

#define M_LDRD_INTERN (   d,
  base,
  off 
)
Value:
do { \
M_LDR_INTERN(GET_HIGH_REG(d), base, off); \
M_LDR_INTERN(GET_LOW_REG(d), base, (off) + 4); \
} while (0)
#define GET_HIGH_REG(a)
#define GET_LOW_REG(a)
#define M_LDR_INTERN(d, base, off)
Definition: codegen.hpp:507

Definition at line 620 of file codegen.hpp.

#define M_LDRD_UPDATE (   d,
  base,
  off 
)
Value:
do { \
assert((off) == +8); \
M_LDR_UPDATE(GET_LOW_REG(d), base, 4); \
} while (0)
#define GET_HIGH_REG(a)
#define M_LDR_UPDATE(d, base, off)
Definition: codegen.hpp:519
#define GET_LOW_REG(a)

Definition at line 638 of file codegen.hpp.

#define M_LDRH (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x00ff); \
assert(off >= 0); \
M_MEM2(UNCOND,1,1,0,d,base,off,1,1,1,0); \
} while (0)
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_MEM2(cond, L, H, S, d, n, adr, I, P, U, W)
Definition: codegen.hpp:196
#define UNCOND
Definition: codegen.hpp:148

Definition at line 532 of file codegen.hpp.

#define M_LDRSB (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x00ff); \
assert(off >= 0); \
M_MEM2(UNCOND,1,0,1,d,base,off,1,1,1,0); \
} while (0)
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_MEM2(cond, L, H, S, d, n, adr, I, P, U, W)
Definition: codegen.hpp:196
#define UNCOND
Definition: codegen.hpp:148

Definition at line 546 of file codegen.hpp.

#define M_LDRSH (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x00ff); \
assert(off >= 0); \
M_MEM2(UNCOND,1,1,1,d,base,off,1,1,1,0); \
} while (0)
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_MEM2(cond, L, H, S, d, n, adr, I, P, U, W)
Definition: codegen.hpp:196
#define UNCOND
Definition: codegen.hpp:148

Definition at line 539 of file codegen.hpp.

#define M_LLD (   a,
  b,
 
)    M_LDRD(a,b,c)

Definition at line 1150 of file codegen.hpp.

#define M_LLD_INTERN (   a,
  b,
 
)    M_LDRD_INTERN(a,b,c)

Definition at line 1153 of file codegen.hpp.

#define M_LONGBRANCH (   adr)
Value:
DCD((s4) adr);
#define REG_LR
Definition: md-abi.hpp:40
#define M_ADD_IMM(d, a, i)
Definition: codegen.hpp:437
#define DCD(val)
Definition: codegen.hpp:396
#define REG_PC
Definition: md-abi.hpp:42
#define M_LDR_INTERN(d, base, off)
Definition: codegen.hpp:507
int32_t s4
Definition: types.hpp:45

Definition at line 1123 of file codegen.hpp.

#define M_LST (   a,
  b,
 
)    M_STRD(a,b,c)

Definition at line 1161 of file codegen.hpp.

#define M_LST_INTERN (   a,
  b,
 
)    M_STRD_INTERN(a,b,c)

Definition at line 1164 of file codegen.hpp.

#define M_MEM (   cond,
  L,
  B,
  d,
  n,
  adr,
  I,
  P,
  U,
 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (1 << 26) | ((L) << 20) | ((B) << 22) | ((d) << 12) | ((n) << 16) | ((adr) & 0x0fff) | ((I) << 25) | ((P) << 24) | ((U) << 23) | ((W) << 21)); \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46
#define I(value)
Definition: codegen.c:279

Definition at line 176 of file codegen.hpp.

#define M_MEM2 (   cond,
  L,
  H,
  S,
  d,
  n,
  adr,
  I,
  P,
  U,
 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (1 << 22) | (0x9 << 4) | ((L) << 20) | ((H) << 5) | ((S) << 6) | ((d) << 12) | ((n) << 16) | ((adr) & 0x0f) | (((adr) & 0xf0) << (8-4)) | ((I) << 22) | ((P) << 24) | ((U) << 23) | ((W) << 21)); \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46
#define I(value)
Definition: codegen.c:279

Definition at line 196 of file codegen.hpp.

#define M_MEM_GET_Rbase (   mcode)    (((mcode) >> 16) & 0x0f)

Definition at line 183 of file codegen.hpp.

#define M_MEM_GET_Rd (   mcode)    (((mcode) >> 12) & 0x0f)

Definition at line 182 of file codegen.hpp.

#define M_MEM_MULTI (   cond,
  L,
  S,
  regs,
  n,
  P,
  U,
 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | (1 << 27) | ((L) << 20) | ((S) << 22) | ((n) << 16) | ((regs) & 0xffff) | ((P) << 24) | ((U) << 23) | ((W) << 21)); \
cd->mcodeptr += 4; \
} while (0)
char * regs[]
Definition: disass.c:51
uint32_t u4
Definition: types.hpp:46

Definition at line 211 of file codegen.hpp.

#define M_MOV (   d,
 
)    M_DAT(UNCOND,0x0d,d,0,0,0,b) /* d = b */

Definition at line 431 of file codegen.hpp.

#define M_MOV_IMM (   d,
  i 
)    M_DAT(UNCOND,0x0d,d,0,0,1,i) /* d = i */

Definition at line 448 of file codegen.hpp.

#define M_MOV_S (   d,
 
)    M_DAT(UNCOND,0x0d,d,0,1,0,b) /* d = b (update Flags) */

Definition at line 435 of file codegen.hpp.

#define M_MOVEQ (   a,
 
)    M_DAT(COND_EQ,0x0d,d,0,0,0,a)

Definition at line 454 of file codegen.hpp.

#define M_MOVEQ_IMM (   i,
 
)    M_DAT(COND_EQ,0x0d,d,0,0,1,i)

Definition at line 458 of file codegen.hpp.

#define M_MOVGT_IMM (   i,
 
)    M_DAT(COND_GT,0x0d,d,0,0,1,i)

Definition at line 461 of file codegen.hpp.

#define M_MOVLS_IMM (   i,
 
)    M_DAT(COND_LS,0x0d,d,0,0,1,i)

Definition at line 462 of file codegen.hpp.

#define M_MOVLT_IMM (   i,
 
)    M_DAT(COND_LT,0x0d,d,0,0,1,i)

Definition at line 460 of file codegen.hpp.

#define M_MOVNE_IMM (   i,
 
)    M_DAT(COND_NE,0x0d,d,0,0,1,i)

Definition at line 459 of file codegen.hpp.

#define M_MOVVS_IMM (   i,
 
)    M_DAT(COND_VS,0x0d,d,0,0,1,i)

Definition at line 457 of file codegen.hpp.

#define M_MUL (   d,
  a,
 
)    M_MULT(UNCOND,d,a,b,0,0,0x0) /* d = a * b */

Definition at line 478 of file codegen.hpp.

#define M_MULT (   cond,
  d,
  n,
  m,
  S,
  A,
 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = (((cond) << 28) | ((d) << 16) | ((n) << 8) | (m) | (0x09 << 4) | ((S) << 20) | ((A) << 21) | ((s) << 12)); \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46

Definition at line 253 of file codegen.hpp.

#define M_NOP
Value:
do { \
*((u4 *) cd->mcodeptr) = (0xe1a00000); \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46

Definition at line 262 of file codegen.hpp.

#define M_ORR (   a,
  b,
 
)    M_DAT(UNCOND,0x0c,d,a,0,0,b) /* d = a | b */

Definition at line 426 of file codegen.hpp.

#define M_ORR_S (   a,
  b,
 
)    M_DAT(UNCOND,0x0c,d,a,1,0,b) /* d = a | b (update flags) */

Definition at line 434 of file codegen.hpp.

#define M_RMFD (   d,
  a,
 
)    M_CPDOD(UNCOND,0x08,0,d,a,b) /* d = a % b */

Definition at line 710 of file codegen.hpp.

#define M_RMFS (   d,
  a,
 
)    M_CPDOS(UNCOND,0x08,0,d,a,b) /* d = a % b */

Definition at line 705 of file codegen.hpp.

#define M_RSB_IMM (   d,
  a,
  i 
)    M_DAT(UNCOND,0x03,d,a,0,1,i) /* d = -a + i */

Definition at line 441 of file codegen.hpp.

#define M_RSB_IMMS (   d,
  a,
  i 
)    M_DAT(UNCOND,0x03,d,a,1,1,i) /* d = -a + i (update Flags) */

Definition at line 451 of file codegen.hpp.

#define M_RSBMI_IMM (   d,
  a,
  i 
)    M_DAT(COND_MI,0x03,d,a,0,1,i)

Definition at line 470 of file codegen.hpp.

#define M_RSC_IMM (   d,
  a,
  i 
)    M_DAT(UNCOND,0x07,d,a,0,1,i) /* d = -a + i (with Carry) */

Definition at line 442 of file codegen.hpp.

#define M_SBC (   d,
  a,
 
)    M_DAT(UNCOND,0x06,d,a,0,0,b) /* d = a - b (with Carry) */

Definition at line 424 of file codegen.hpp.

#define M_SBC_IMM (   d,
  a,
  i 
)    M_DAT(UNCOND,0x06,d,a,0,1,i) /* d = a - i (with Carry) */

Definition at line 440 of file codegen.hpp.

#define M_STFD (   d,
  base,
  offset 
)
Value:
do { \
CHECK_OFFSET(offset, 0x03ffff); \
if (IS_OFFSET(offset, 0x03ff)) { \
M_DST_INTERN(d, base, offset); \
} else { \
if ((offset) > 0) { \
M_ADD_IMM(REG_ITMP3, base, IMM_ROTL((offset) >> 10, 5)); \
M_DST_INTERN(d, REG_ITMP3, (offset) & 0x03ff); \
} else { \
M_SUB_IMM(REG_ITMP3, base, IMM_ROTL((-(offset)) >> 10, 5)); \
M_DST_INTERN(d, REG_ITMP3, -(-(offset) & 0x03ff)); \
} \
} \
} while (0)
#define M_DST_INTERN(d, base, off)
Definition: codegen.hpp:840
#define M_ADD_IMM(d, a, i)
Definition: codegen.hpp:437
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_SUB_IMM(d, a, i)
Definition: codegen.hpp:439
#define IS_OFFSET(off, max)
Definition: codegen.hpp:85
#define REG_ITMP3
Definition: md-abi.hpp:48
#define IMM_ROTL(imm, rot)
Definition: codegen.hpp:414

Definition at line 1036 of file codegen.hpp.

#define M_STFS (   d,
  base,
  offset 
)
Value:
do { \
CHECK_OFFSET(offset, 0x03ffff); \
if (IS_OFFSET(offset, 0x03ff)) { \
M_FST_INTERN(d, base, offset); \
} else { \
if ((offset) > 0) { \
M_ADD_IMM(REG_ITMP3, base, IMM_ROTL((offset) >> 10, 5)); \
M_FST_INTERN(d, REG_ITMP3, (offset) & 0x03ff); \
} else { \
M_SUB_IMM(REG_ITMP3, base, IMM_ROTL((-(offset)) >> 10, 5)); \
M_FST_INTERN(d, REG_ITMP3, -(-(offset) & 0x03ff)); \
} \
} \
} while (0)
#define M_ADD_IMM(d, a, i)
Definition: codegen.hpp:437
#define M_FST_INTERN(d, base, off)
Definition: codegen.hpp:834
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_SUB_IMM(d, a, i)
Definition: codegen.hpp:439
#define IS_OFFSET(off, max)
Definition: codegen.hpp:85
#define REG_ITMP3
Definition: md-abi.hpp:48
#define IMM_ROTL(imm, rot)
Definition: codegen.hpp:414

Definition at line 1020 of file codegen.hpp.

#define M_STMFD (   regs,
  base 
)    M_MEM_MULTI(UNCOND,0,0,regs,base,1,0,1)

Definition at line 502 of file codegen.hpp.

#define M_STR (   d,
  base,
  offset 
)
Value:
do { \
CHECK_OFFSET(offset, 0x0fffff); \
if (IS_OFFSET(offset, 0x000fff)) { \
M_STR_INTERN(d, base, offset); \
} else { \
assert((d) != REG_ITMP3); \
if ((offset) > 0) { \
M_ADD_IMM(REG_ITMP3, base, IMM_ROTL((offset) >> 12, 6)); \
M_STR_INTERN(d, REG_ITMP3, (offset) & 0x000fff); \
} else { \
M_SUB_IMM(REG_ITMP3, base, IMM_ROTL((-(offset)) >> 12, 6)); \
M_STR_INTERN(d, REG_ITMP3, -(-(offset) & 0x000fff)); \
} \
} \
} while (0)
#define M_ADD_IMM(d, a, i)
Definition: codegen.hpp:437
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_SUB_IMM(d, a, i)
Definition: codegen.hpp:439
#define IS_OFFSET(off, max)
Definition: codegen.hpp:85
#define M_STR_INTERN(d, base, off)
Definition: codegen.hpp:513
#define REG_ITMP3
Definition: md-abi.hpp:48
#define IMM_ROTL(imm, rot)
Definition: codegen.hpp:414

Definition at line 980 of file codegen.hpp.

#define M_STR_INTERN (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x0fff); \
M_MEM(UNCOND,0,0,d,base,(((off) < 0) ? -(off) : off),0,1,(((off) < 0) ? 0 : 1),0); \
} while (0)
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_MEM(cond, L, B, d, n, adr, I, P, U, W)
Definition: codegen.hpp:176
#define UNCOND
Definition: codegen.hpp:148

Definition at line 513 of file codegen.hpp.

#define M_STR_REG (   d,
  base,
  offreg 
)    M_MEM(UNCOND,0,0,d,base,offreg,1,1,1,0)

Definition at line 505 of file codegen.hpp.

#define M_STR_UPDATE (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off,0x0fff); \
M_MEM(UNCOND,0,0,d,base,(((off) < 0) ? -(off) : off),0,1,(((off) < 0) ? 0 : 1),1); \
} while (0)
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_MEM(cond, L, B, d, n, adr, I, P, U, W)
Definition: codegen.hpp:176
#define UNCOND
Definition: codegen.hpp:148

Definition at line 525 of file codegen.hpp.

#define M_STRB (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x0fff); \
assert(off >= 0); \
M_MEM(UNCOND,0,1,d,base,off,0,1,1,0); \
} while (0)
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_MEM(cond, L, B, d, n, adr, I, P, U, W)
Definition: codegen.hpp:176
#define UNCOND
Definition: codegen.hpp:148

Definition at line 560 of file codegen.hpp.

#define M_STRD (   d,
  base,
  offset 
)
Value:
do { \
CHECK_OFFSET(offset, 0x0fffff - 4); \
if (IS_OFFSET(offset, 0x000fff - 4)) { \
M_STRD_INTERN(d,base,offset); \
} else if (IS_OFFSET(offset, 0x000fff)) { \
dolog("M_STRD: this offset seems to be complicated (%d)", offset); \
assert(0); \
} else { \
assert(GET_LOW_REG(d) != REG_ITMP3); \
assert(GET_HIGH_REG(d) != REG_ITMP3); \
if ((offset) > 0) { \
M_ADD_IMM(REG_ITMP3, base, IMM_ROTL((offset) >> 12, 6)); \
M_STRD_INTERN(d, REG_ITMP3, (offset) & 0x000fff); \
} else { \
M_SUB_IMM(REG_ITMP3, base, IMM_ROTL((-(offset)) >> 12, 6)); \
M_STRD_INTERN(d, REG_ITMP3, -(-(offset) & 0x000fff)); \
} \
} \
} while (0)
#define dolog
Definition: logging.hpp:171
#define GET_HIGH_REG(a)
#define M_ADD_IMM(d, a, i)
Definition: codegen.hpp:437
#define GET_LOW_REG(a)
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_SUB_IMM(d, a, i)
Definition: codegen.hpp:439
#define M_STRD_INTERN(d, base, off)
Definition: codegen.hpp:626
#define IS_OFFSET(off, max)
Definition: codegen.hpp:85
#define REG_ITMP3
Definition: md-abi.hpp:48
#define IMM_ROTL(imm, rot)
Definition: codegen.hpp:414

Definition at line 997 of file codegen.hpp.

#define M_STRD_INTERN (   d,
  base,
  off 
)
Value:
do { \
M_STR_INTERN(GET_HIGH_REG(d), base, off); \
M_STR_INTERN(GET_LOW_REG(d), base, (off) + 4); \
} while (0)
#define GET_HIGH_REG(a)
#define GET_LOW_REG(a)
#define M_STR_INTERN(d, base, off)
Definition: codegen.hpp:513

Definition at line 626 of file codegen.hpp.

#define M_STRD_UPDATE (   d,
  base,
  off 
)
Value:
do { \
assert((off) == -8); \
M_STR_UPDATE(GET_LOW_REG(d), base, -4); \
M_STR_UPDATE(GET_HIGH_REG(d) ,base, -4); \
} while (0)
#define M_STR_UPDATE(d, base, off)
Definition: codegen.hpp:525
#define GET_HIGH_REG(a)
#define GET_LOW_REG(a)

Definition at line 645 of file codegen.hpp.

#define M_STRH (   d,
  base,
  off 
)
Value:
do { \
CHECK_OFFSET(off, 0x00ff); \
assert(off >= 0); \
M_MEM2(UNCOND,0,1,0,d,base,off,1,1,1,0); \
} while (0)
#define CHECK_OFFSET(off, max)
Definition: codegen.hpp:89
#define M_MEM2(cond, L, H, S, d, n, adr, I, P, U, W)
Definition: codegen.hpp:196
#define UNCOND
Definition: codegen.hpp:148

Definition at line 553 of file codegen.hpp.

#define M_SUB (   d,
  a,
 
)    M_DAT(UNCOND,0x02,d,a,0,0,b) /* d = a - b */

Definition at line 423 of file codegen.hpp.

#define M_SUB_IMM (   d,
  a,
  i 
)    M_DAT(UNCOND,0x02,d,a,0,1,i) /* d = a - i */

Definition at line 439 of file codegen.hpp.

#define M_SUB_IMM_EXT_MUL4 (   d,
  n,
  imm 
)
Value:
do { \
assert(d != REG_PC); \
assert((imm) >= 0 && (imm) <= 0x00ffffff); \
M_SUB_IMM(d, n, IMM_ROTL(imm, 1)); \
if ((imm) > 0x000000ff) M_SUB_IMM(d, d, IMM_ROTL((imm) >> 8, 5)); \
if ((imm) > 0x0000ffff) M_SUB_IMM(d, d, IMM_ROTL((imm) >> 16, 9)); \
} while (0)
#define REG_PC
Definition: md-abi.hpp:42
#define M_SUB_IMM(d, a, i)
Definition: codegen.hpp:439
#define IMM_ROTL(imm, rot)
Definition: codegen.hpp:414

Definition at line 1073 of file codegen.hpp.

#define M_SUB_IMMS (   d,
  a,
  i 
)    M_DAT(UNCOND,0x02,d,a,1,1,i) /* d = a - i (update Flags) */

Definition at line 450 of file codegen.hpp.

#define M_SUB_S (   d,
  a,
 
)    M_DAT(UNCOND,0x02,d,a,1,0,b) /* d = a - b (update Flags) */

Definition at line 433 of file codegen.hpp.

#define M_SUBGT_IMM (   d,
  a,
  i 
)    M_DAT(COND_GT,0x02,d,a,0,1,i)

Definition at line 469 of file codegen.hpp.

#define M_SUBLO_IMM (   d,
  a,
  i 
)    M_DAT(COND_CC,0x02,d,a,0,1,i)

Definition at line 467 of file codegen.hpp.

#define M_SUBLT_IMM (   d,
  a,
  i 
)    M_DAT(COND_LT,0x02,d,a,0,1,i)

Definition at line 468 of file codegen.hpp.

#define M_TEQ (   a,
 
)    M_DAT(UNCOND,0x09,0,a,1,0,b) /* TST a ^ b */

Definition at line 429 of file codegen.hpp.

#define M_TEQ_IMM (   a,
  i 
)    M_DAT(UNCOND,0x09,0,a,1,1,i) /* TST a ^ i */

Definition at line 445 of file codegen.hpp.

#define M_TEST (   a)    M_TEQ_IMM(a, 0);

Definition at line 1174 of file codegen.hpp.

#define M_TRAP (   a,
  i 
)    M_UNDEFINED(UNCOND,i,a);

Definition at line 568 of file codegen.hpp.

#define M_TRAPEQ (   a,
  i 
)    M_UNDEFINED(COND_EQ,i,a);

Definition at line 569 of file codegen.hpp.

#define M_TRAPHI (   a,
  i 
)    M_UNDEFINED(COND_HI,i,a);

Definition at line 573 of file codegen.hpp.

#define M_TRAPHS (   a,
  i 
)    M_UNDEFINED(COND_CS,i,a);

Definition at line 574 of file codegen.hpp.

#define M_TRAPLE (   a,
  i 
)    M_UNDEFINED(COND_LE,i,a);

Definition at line 572 of file codegen.hpp.

#define M_TRAPLT (   a,
  i 
)    M_UNDEFINED(COND_LT,i,a);

Definition at line 571 of file codegen.hpp.

#define M_TRAPNE (   a,
  i 
)    M_UNDEFINED(COND_NE,i,a);

Definition at line 570 of file codegen.hpp.

#define M_TST (   a,
 
)    M_DAT(UNCOND,0x08,0,a,1,0,b) /* TST a & b */

Definition at line 428 of file codegen.hpp.

#define M_TST_IMM (   a,
  i 
)    M_DAT(UNCOND,0x08,0,a,1,1,i) /* TST a & i */

Definition at line 444 of file codegen.hpp.

#define M_UNDEFINED (   cond,
  imm,
 
)
Value:
do { \
*((u4 *) cd->mcodeptr) = ((cond) << 28) | (0x7f << 20) | (((imm) & 0x0fff) << 8) | (0x0f << 4) | (n); \
cd->mcodeptr += 4; \
} while (0)
uint32_t u4
Definition: types.hpp:46

Definition at line 280 of file codegen.hpp.

#define MCODECHECK (   icnt)
Value:
do { \
if ((cd->mcodeptr + (icnt) * 4) > cd->mcodeend) \
} while (0)
void codegen_increase(codegendata *cd)

Definition at line 75 of file codegen.hpp.

#define PATCHER_CALL_SIZE   1 * 4 /* an instruction is 4-bytes long */

Definition at line 102 of file codegen.hpp.

#define PATCHER_NOPS
Value:
do { \
} while (0)
#define M_NOP
Definition: codegen.hpp:262

Definition at line 104 of file codegen.hpp.

#define REG_ASR (   reg,
  shift 
)    ( (((shift) & 0x1f) << 7) | ((reg) & 0x0f) | (1 << 6) )

Definition at line 406 of file codegen.hpp.

#define REG_ASR_REG (   reg,
 
)    ( (((s) & 0x0f) << 8) | ((reg) & 0x0f) | (1 << 4) | (1 << 6) )

Definition at line 409 of file codegen.hpp.

#define REG_LSL (   reg,
  shift 
)    ( (((shift) & 0x1f) << 7) | ((reg) & 0x0f) )

Definition at line 404 of file codegen.hpp.

#define REG_LSL_REG (   reg,
 
)    ( (((s) & 0x0f) << 8) | ((reg) & 0x0f) | (1 << 4) )

Definition at line 407 of file codegen.hpp.

#define REG_LSR (   reg,
  shift 
)    ( (((shift) & 0x1f) << 7) | ((reg) & 0x0f) | (1 << 5) )

Definition at line 405 of file codegen.hpp.

#define REG_LSR_REG (   reg,
 
)    ( (((s) & 0x0f) << 8) | ((reg) & 0x0f) | (1 << 4) | (1 << 5) )

Definition at line 408 of file codegen.hpp.

#define SPLIT_OPEN (   type,
  reg,
  tmpreg 
)
Value:
if (IS_2_WORD_TYPE(type) && GET_LOW_REG(reg)==REG_SPLIT) { \
/*dolog("SPLIT_OPEN({SPL;R%d} > {R%d;R%d})", GET_HIGH_REG(reg), tmpreg, GET_HIGH_REG(reg));*/ \
/*assert(GET_HIGH_REG(reg) == 3);*/ \
(reg) = PACK_REGS(tmpreg, GET_HIGH_REG(reg)); \
}
#define GET_HIGH_REG(a)
#define IS_2_WORD_TYPE(a)
Definition: global.hpp:132
#define GET_LOW_REG(a)
#define PACK_REGS(low, high)
#define REG_SPLIT
Definition: md-abi.hpp:58

Definition at line 54 of file codegen.hpp.

#define SPLIT_STORE_AND_CLOSE (   type,
  reg,
  offset 
)
Value:
if (IS_2_WORD_TYPE(type) && GET_HIGH_REG(reg)==3) { \
/*dolog("SPLIT_STORE({R%d;R%d} to [%x])", GET_LOW_REG(reg), GET_HIGH_REG(reg), offset);*/ \
M_STR(GET_LOW_REG(reg), REG_SP, 4 * (offset)); \
(reg) = PACK_REGS(REG_SPLIT, GET_HIGH_REG(reg)); \
}
#define REG_SP
Definition: md-abi.hpp:53
#define GET_HIGH_REG(a)
#define IS_2_WORD_TYPE(a)
Definition: global.hpp:132
#define GET_LOW_REG(a)
#define PACK_REGS(low, high)
#define M_STR(d, base, offset)
Definition: codegen.hpp:980
#define REG_SPLIT
Definition: md-abi.hpp:58

Definition at line 61 of file codegen.hpp.

#define UNCOND   COND_AL

Definition at line 148 of file codegen.hpp.

Function Documentation

void asm_debug ( int  a1,
int  a2,
int  a3,
int  a4 
)

Definition at line 2698 of file codegen.cpp.

void asm_debug_intern ( int  a1,
int  a2,
int  a3,
int  a4 
)