ACSE 2.0.3
Advanced Compiler System for Education
Loading...
Searching...
No Matches
target_transform.c File Reference

Transformation pass for lowering target machine details implementation. More...

#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "target_transform.h"
#include "codegen.h"
#include "list.h"
#include "target_info.h"

Go to the source code of this file.

Macros

#define RD(i)
#define RS1(i)
#define RS2(i)
#define IMM(i)
#define SYSCALL_ID_PRINT_INT   1
#define SYSCALL_ID_READ_INT   5
#define SYSCALL_ID_EXIT_0   10
#define SYSCALL_ID_PRINT_CHAR   11

Functions

t_listNodeaddInstrAfter (t_program *program, t_listNode *prev, t_instruction *instr)
void setMCRegisterWhitelist (t_instrArg *regObj,...)
bool isImmediateArgumentInstrOpcode (int opcode)
int getMatchingNonImmediateOpcode (int orig)
bool isInt12 (int immediate)
void fixUnsupportedImmediates (t_program *program)
void fixPseudoInstructions (t_program *program)
void fixSyscalls (t_program *program)
void doTargetSpecificTransformations (t_program *program)

Detailed Description

Transformation pass for lowering target machine details implementation.

Definition in file target_transform.c.

Macro Definition Documentation

◆ IMM

#define IMM ( i)
Value:
(i->immediate)

Definition at line 17 of file target_transform.c.

◆ RD

#define RD ( i)
Value:
(i->rDest->ID)

Definition at line 14 of file target_transform.c.

◆ RS1

#define RS1 ( i)
Value:
(i->rSrc1->ID)

Definition at line 15 of file target_transform.c.

◆ RS2

#define RS2 ( i)
Value:
(i->rSrc2->ID)

Definition at line 16 of file target_transform.c.

◆ SYSCALL_ID_EXIT_0

#define SYSCALL_ID_EXIT_0   10

Definition at line 21 of file target_transform.c.

◆ SYSCALL_ID_PRINT_CHAR

#define SYSCALL_ID_PRINT_CHAR   11

Definition at line 22 of file target_transform.c.

◆ SYSCALL_ID_PRINT_INT

#define SYSCALL_ID_PRINT_INT   1

Definition at line 19 of file target_transform.c.

◆ SYSCALL_ID_READ_INT

#define SYSCALL_ID_READ_INT   5

Definition at line 20 of file target_transform.c.

Function Documentation

◆ addInstrAfter()

t_listNode * addInstrAfter ( t_program * program,
t_listNode * prev,
t_instruction * instr )

Definition at line 25 of file target_transform.c.

◆ fixPseudoInstructions()

void fixPseudoInstructions ( t_program * program)

Definition at line 179 of file target_transform.c.

◆ fixSyscalls()

void fixSyscalls ( t_program * program)

Definition at line 282 of file target_transform.c.

◆ fixUnsupportedImmediates()

void fixUnsupportedImmediates ( t_program * program)

Definition at line 141 of file target_transform.c.

◆ getMatchingNonImmediateOpcode()

int getMatchingNonImmediateOpcode ( int orig)

Definition at line 85 of file target_transform.c.

◆ isImmediateArgumentInstrOpcode()

bool isImmediateArgumentInstrOpcode ( int opcode)

Definition at line 55 of file target_transform.c.

◆ isInt12()

bool isInt12 ( int immediate)

Definition at line 135 of file target_transform.c.

◆ setMCRegisterWhitelist()

void setMCRegisterWhitelist ( t_instrArg * regObj,
... )

Definition at line 36 of file target_transform.c.