/* * File: MOperator.h * Author: rick * * Created on November 19, 2008, 1:24 AM */ #ifndef _MOPERATOR_H #define _MOPERATOR_H /* Needs including all available instruction types */ typedef enum __moperator { /* ASM directives */ MOP_ENT, MOP_END, MOP_ALIGN, MOP_ASCII, MOP_ASCIIZ, MOP_BYTE, MOP_DATA, MOP_DOUBLE, MOP_EXTERN, MOP_FLOAT, MOP_GLOBL, MOP_HALF, MOP_KDATA, MOP_KTEXT, MOP_SPACE, MOP_TEXT, MOP_WORD, /* Arithmetic operators */ /* Absolute value - abs Rdest, Rsrc Put the absolute value of the integer from register Rsrc in register Rdest. */ MOP_ABS, /* Addition with overflow - add Rdest, Rsrc1, Src2 Addition Immediate with overflow - addi Rdest, Rsrc1, Imm Addition with overflow - add Rdest, Rsrc1, Src2 Addition Immediate without overflow - addi Rdest, Rsrc1, Imm Put the sum of the integers from register Rscr1 and Src2 (or Imm) into register Rdest. */ MOP_ADD, MOP_ADDI, MOP_ADDU, MOP_ADDIU, /* and - and Rdest, Rsrc1, Src2 and immediate - andi Rdest, Rsrc1, Imm Put the logical AND of the integers from register Rscr1and Sr2( or Imm) into register Rdest. */ MOP_AND, MOP_ANDI, /* Divide signed - div Rsrc1, Rscr2 Divide unsigned - divu Rscr1, Rscr2 Divide the contents of the two registers. Leave quotient in register lo and the remainder in register hi. */ MOP_DIV2, MOP_DIV2U, /* Divide signed - div Rdest, Rsrc1, Rscr2 Divide unsigned - divu Rdest, Rscr1, Rscr2 Divide the contents of the two registers. Leave quotient in register Rdest. */ MOP_DIV, MOP_DIVU, /* Multiply without overflow - mul Rdest, Rsrc1, Rsrc2 Multiply with overflow - mulo Rdest, Rsrc1, Rsrc2 Unsigned multiply with overflow - mulou Rdest, Rsrc1, Rsrc2 Put the product of the integers from register Rscr1 and Rscr2 into register Rdest. */ MOP_MUL, MOP_MULO, MOP_MULOU, /* Multiply - mult Rsrc1, Rsrc2 Unsigned multiply - multu Rsrc1, Rsrc2 Multiply the contents of the two registers. Leave the low-order word of the product in register lo an the high-word in register hi. */ MOP_MULT, MOP_MULTU, /* Negate value with overflow - neg Rdest, Rsrc Negate value without overflow - negu Rdest, Rsrc Put the negative of the integer from register Rsrc into Rdest. */ MOP_NEG, MOP_NEGU, /* NOR - nor Rdest, Rsrc1, Rsrc2 Put the logical NOR of the integers from register Rsrc1 and Rscr2 into register Rdes. */ MOP_NOR, /* NOT - not Rdest, Rsrc Put the bitwise logical negation of the integer from register Rscr into register Rdest. */ MOP_NOT, /* OR - or Rdest, Rsrc1, Rsrc2 OR Immediate - ori Rdest, Rsrc1, Imm Put the logical OR of the integer from registe rRsrc1 and Rsrc2(or Imm) into register Rdest. */ MOP_OR, MOP_ORI, /* Remainder - rem Rdest, Rsrc1, Rsrc2 Unsigned remainder - remu Rdest, Rsrc1, Rsrc2 Put the remainder from dividing Rsrc1 with the integer Rsrc2 into Rdest. If an operand is negative the remainder is unspecified. */ MOP_REM, MOP_REMU, /* Rotate left - rol Rdest, Rscr1, Src2 Rotate right - ror Rdest, Rsrc1, Src2 Rotate the contents of register Rsrc by the distance indicated by Src2 and store in Rdest. */ MOP_ROL, MOP_ROR, /* Shift left logical - sll Rdest, Rsrc1, Src2 Shift left logical variable - sllv Rdest, Rsrc1, Rsrc2 Shift right arithmetic - sra Rdest, Rsrc1, src2 Shift right logical - srl Rdest, Rsrc1, src2 Shift right variable - srlv Rdest, Rsrc1, Rsrc2 Shift the contents of Rsrc1 by the distance in Src2 and put the result in Rdest. */ MOP_SLL, MOP_SLLV, MOP_SRA, MOP_SRL, MOP_SRLV, /* Subtract with overflow - sub Rdest Rsrc, Src2 Subtract without overflow - subu Rdest, Rsrc, Src2 Put the difference of the integers from register Rssrc1 and Src2 into Rdest */ MOP_SUB, MOP_SUBU, /* XOR - xor Rdest, Rsrc1, Src2 XOR immediate - xori Rdest, Rsrc1, Imm Put the logiacal xor of the integer from register Rscr1 and Src2 (or Imm) into register Rdest. */ MOP_XOR, MOP_XORI, /* Load immediate - li Rdest, imm Move the immediate imm into register Rdest. */ MOP_LI, /* Load upper immediate -lui Rdest, imm Load the lower halfword of the immediate imm into the upper halfword of register Rdest . The lower bits of the resgister are set to 0. */ MOP_LUI, /* Comparison operators */ /* Set equal - seq Rdest, Rsrc1, Src2 Set register Rdest to 1 if register Rsrc1 equals Src2 and to 0 otherwise. */ MOP_SEQ, MOP_SGE, MOP_SGEU, MOP_SGT, MOP_SGTU, MOP_SLE, MOP_SLEU, MOP_SLT, MOP_SLTI, MOP_SLTU, MOP_SLTIU, MOP_SNE, /* Branching operators */ MOP_B, MOP_BCZT, MOP_BCZF, MOP_BEQ, MOP_BEQZ, MOP_BGE, MOP_BGEU, MOP_BGEZ, MOP_BGEZAL, MOP_BGT, MOP_BGTU, MOP_BGTZ, MOP_BLE, MOP_BLEU, MOP_BLEZ, MOP_BLTZAL, MOP_BLT, MOP_BLTU, MOP_BLTZ, MOP_BNE, MOP_BNEZ, /* Jump operators */ MOP_J, MOP_JAL, MOP_JR, /* Load operators */ MOP_LA, MOP_LB, MOP_LBU, MOP_LD, MOP_LH, MOP_LHU, MOP_LW, MOP_LWCZ, MOP_LWL, MOP_LWR, MOP_ULH, MOP_ULHU, MOP_ULW, /* Store operators */ MOP_SB, MOP_SD, MOP_SH, MOP_SW, MOP_SWCZ, MOP_SWL, MOP_SWR, MOP_USH, MOP_USW, /* Copy operators */ MOP_MOVE, MOP_MFHI, MOP_MTLO, MOP_MFC1, MOP_MFC1_D, MOP_MTC1, /* Floating point operators */ MOP_ABS_D, MOP_ABS_S, MOP_ADD_D, MOP_ADD_S, MOP_C_EQ_D, MOP_C_EQ_S, MOP_C_LE_D, MOP_C_LE_S, MOP_C_LT_D, MOP_C_LT_S, MOP_CVT_D_S, MOP_CVT_D_W, MOP_CVT_S_D, MOP_CVT_S_W, MOP_CVT_W_D, MOP_CVT_W_S, MOP_DIV_D, MOP_DIV_S, MOP_L_D, MOP_L_S, MOP_MOV_D, MOP_MOV_S, MOP_MUL_D, MOP_MUL_S, MOP_NEG_D, MOP_NEG_S, MOP_S_D, MOP_S_S, MOP_SUB_D, MOP_SUB_S, /* Hidden features, pseudo instructions ;-) */ MOP_LI_S, /* Exceptions and trap instructions */ MOP_RFE, MOP_SYSCALL, MOP_BREAK, MOP_NOP, /* Special labels, for processing only */ MOP_LABEL, MOP_NOPERATORS } MOperator; const char *MOperatorToString(MOperator op); #endif /* _MOPERATOR_H */