14#define RD(i) (i->rDest->ID)
15#define RS1(i) (i->rSrc1->ID)
16#define RS2(i) (i->rSrc2->ID)
17#define IMM(i) (i->immediate)
19#define SYSCALL_ID_PRINT_INT 1
20#define SYSCALL_ID_READ_INT 5
21#define SYSCALL_ID_EXIT_0 10
22#define SYSCALL_ID_PRINT_CHAR 11
42 va_start(args, regObj);
137 return immediate < (1 << 11) && immediate >= -(1 << 11);
201 program, curi,
genSLTIU(NULL,
RD(instr),
RD(instr), 1));
Code generation functions.
t_instruction * genXORI(t_program *program, t_regID rd, t_regID rs1, int immediate)
t_instruction * genSUB(t_program *program, t_regID rd, t_regID rs1, t_regID rs2)
t_instruction * genSLTU(t_program *program, t_regID rd, t_regID rs1, t_regID rs2)
t_instruction * genLI(t_program *program, t_regID rd, int immediate)
t_instruction * genSLTIU(t_program *program, t_regID rd, t_regID rs1, int immediate)
t_instruction * genADDI(t_program *program, t_regID rd, t_regID rs1, int immediate)
void * data
Pointer to the data associated to this node.
t_listNode * listInsertAfter(t_listNode *list, t_listNode *listPos, void *data)
t_listNode * listInsert(t_listNode *list, void *data, int pos)
#define INT_TO_LIST_DATA(data)
Convert an integer from a list data pointer.
t_listNode * deleteList(t_listNode *list)
t_listNode * instructions
List of instructions.
t_listNode * mcRegWhitelist
t_instrArg * rSrc1
First source argument (or NULL if none).
t_instrArg * rSrc2
Second source argument (or NULL if none).
int immediate
Immediate argument.
t_regID ID
The register identifier.
t_instrArg * rDest
Destination argument (or NULL if none).
int opcode
Instruction opcode.
t_regID getNewRegister(t_program *program)
#define REG_INVALID
Constant used for invalid register identifiers.
#define REG_0
Constant identifying a register whose value is always zero.
void removeInstructionAt(t_program *program, t_listNode *instrLi)
t_instruction * genInstruction(t_program *program, int opcode, t_regID rd, t_regID rs1, t_regID rs2, t_label *label, int immediate)
int t_regID
Type for register identifiers.
void doTargetSpecificTransformations(t_program *program)
Properties of the target machine.