Project restucture with IR and CG
This commit is contained in:
@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "intermediate_code.h"
|
||||
#include "symbol_table.h"
|
||||
|
||||
extern FILE *cg_flag;
|
||||
|
||||
typedef struct CGNode {
|
||||
TableNode *tn;
|
||||
int address;
|
||||
CGNode *next;
|
||||
} CGNode;
|
||||
|
||||
int generate();
|
||||
CGNode *getNextCG(CGNode *cg);
|
||||
int getAddress(CGNode *cg);
|
||||
TableNode *getTNofCG(CGNode *cg);
|
||||
CGNode *findCG(TableNode *tn);
|
||||
CGNode *addCG(TableNode *tn, int sp);
|
||||
int generateLabel(Instruction *inst);
|
||||
int generateAdd(Instruction *inst);
|
||||
int generateSub(Instruction *instruction);
|
||||
int generateMult(Instruction *inst);
|
||||
int generateDiv(Instruction *inst);
|
||||
int generateMod(Instruction *inst);
|
||||
int generateOr(Instruction *inst);
|
||||
int generateAnd(Instruction *inst);
|
||||
int generateNeg(Instruction *inst);
|
||||
int generateNot(Instruction *inst);
|
||||
int generateAssign(Instruction *inst);
|
||||
int generateGoto(Instruction *instruction);
|
||||
int generateCondGoto(Instruction *instruction);
|
||||
int generateIfTrue(Instruction *instruction);
|
||||
int generateIfFalse(Instruction *instruction);
|
||||
int generateLessThan(Instruction *inst);
|
||||
int generateEqualTo(Instruction *inst);
|
||||
int generateCall(Instruction *instruction);
|
||||
int generateReturn(Instruction *instruction);
|
||||
int generateCopyRight(Instruction *instruction);
|
||||
int generateCopyLeft(Instruction *instruction);
|
||||
int generateAddressOf(Instruction *instruction);
|
||||
int generateParam(Instruction *instruction);
|
||||
|
||||
extern int label_count;
|
||||
extern Instruction *begin;
|
||||
extern Instruction *current;
|
||||
|
||||
extern int offset;
|
||||
extern int currentsp;
|
||||
extern CGNode *cgList;
|
Reference in New Issue
Block a user