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

Generation of the output assembly program implementation. More...

#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include "list.h"
#include "errors.h"
#include "target_asm_print.h"
#include "target_info.h"

Go to the source code of this file.

Macros

#define BUF_LENGTH   256
#define FORMAT_AUTO   -1
#define FORMAT_OP   0
#define FORMAT_OPIMM   1
#define FORMAT_LOAD   2
#define FORMAT_LOAD_GL   3
#define FORMAT_STORE   4
#define FORMAT_STORE_GL   5
#define FORMAT_BRANCH   6
#define FORMAT_JUMP   7
#define FORMAT_LI   8
#define FORMAT_LA   9
#define FORMAT_SYSTEM   10
#define FORMAT_FUNC   11

Functions

const char * opcodeToString (int opcode)
char * registerIDToString (t_regID regID, bool machineRegIDs)
char * registerToString (t_instrArg *reg, bool machineRegIDs)
int labelToString (char *buf, int bufsz, t_label *label, int finalColon)
int instructionToString (char *buf, int bufsz, t_instruction *instr, bool machineRegIDs)
bool translateForwardDeclarations (t_program *program, FILE *fp)
bool printInstruction (t_instruction *instr, FILE *fp, bool machineRegIDs)
bool translateCodeSegment (t_program *program, FILE *fp)
int printGlobalDeclaration (t_symbol *data, FILE *fp)
bool translateDataSegment (t_program *program, FILE *fp)
bool writeAssembly (t_program *program, const char *fn)

Detailed Description

Generation of the output assembly program implementation.

Definition in file target_asm_print.c.

Macro Definition Documentation

◆ BUF_LENGTH

#define BUF_LENGTH   256

Definition at line 12 of file target_asm_print.c.

◆ FORMAT_AUTO

#define FORMAT_AUTO   -1

Definition at line 163 of file target_asm_print.c.

◆ FORMAT_BRANCH

#define FORMAT_BRANCH   6

Definition at line 170 of file target_asm_print.c.

◆ FORMAT_FUNC

#define FORMAT_FUNC   11

Definition at line 175 of file target_asm_print.c.

◆ FORMAT_JUMP

#define FORMAT_JUMP   7

Definition at line 171 of file target_asm_print.c.

◆ FORMAT_LA

#define FORMAT_LA   9

Definition at line 173 of file target_asm_print.c.

◆ FORMAT_LI

#define FORMAT_LI   8

Definition at line 172 of file target_asm_print.c.

◆ FORMAT_LOAD

#define FORMAT_LOAD   2

Definition at line 166 of file target_asm_print.c.

◆ FORMAT_LOAD_GL

#define FORMAT_LOAD_GL   3

Definition at line 167 of file target_asm_print.c.

◆ FORMAT_OP

#define FORMAT_OP   0

Definition at line 164 of file target_asm_print.c.

◆ FORMAT_OPIMM

#define FORMAT_OPIMM   1

Definition at line 165 of file target_asm_print.c.

◆ FORMAT_STORE

#define FORMAT_STORE   4

Definition at line 168 of file target_asm_print.c.

◆ FORMAT_STORE_GL

#define FORMAT_STORE_GL   5

Definition at line 169 of file target_asm_print.c.

◆ FORMAT_SYSTEM

#define FORMAT_SYSTEM   10

Definition at line 174 of file target_asm_print.c.

Function Documentation

◆ instructionToString()

int instructionToString ( char * buf,
int bufsz,
t_instruction * instr,
bool machineRegIDs )

Definition at line 313 of file target_asm_print.c.

◆ labelToString()

int labelToString ( char * buf,
int bufsz,
t_label * label,
int finalColon )

Definition at line 293 of file target_asm_print.c.

◆ opcodeToString()

const char * opcodeToString ( int opcode)

Definition at line 15 of file target_asm_print.c.

◆ printGlobalDeclaration()

int printGlobalDeclaration ( t_symbol * data,
FILE * fp )

Definition at line 488 of file target_asm_print.c.

◆ registerToString()

char * registerToString ( t_instrArg * reg,
bool machineRegIDs )

Definition at line 285 of file target_asm_print.c.

◆ translateCodeSegment()

bool translateCodeSegment ( t_program * program,
FILE * fp )

Definition at line 462 of file target_asm_print.c.

◆ translateDataSegment()

bool translateDataSegment ( t_program * program,
FILE * fp )

Definition at line 519 of file target_asm_print.c.

◆ translateForwardDeclarations()

bool translateForwardDeclarations ( t_program * program,
FILE * fp )

Definition at line 412 of file target_asm_print.c.