📄 midcode.h
字号:
// midcode.h: interface for the Cmidcode class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_MIDCODE_H__64B47C88_9CBC_4D4E_8F81_746C997FF429__INCLUDED_)
#define AFX_MIDCODE_H__64B47C88_9CBC_4D4E_8F81_746C997FF429__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "global.h"
class Cmidcode : public Cglobal
{
public:
Cmidcode();
virtual ~Cmidcode();
Cglobal::CodeFile *GenMidCode(TreeNode *t,int StoreNoff);
/*临时变量编号,全局变量,每个过程开始都对TempOffset进行
初始化,注:所以,不同过程中,可能有编号相同的临时变量,但是
由于他们互不相干,所以不会有问题;而且优化部分是对基本块进行优化,
每个基本块最大是一个过程,也不会有问题*/
int TempOffset ;
/*标号值,全局变量*/
int Label ;
int mainOff;
/*指向第一条中间代码*/
Cglobal::CodeFile *firstCode ;
/*指向当前最后一条中间代码*/
Cglobal::CodeFile *lastCode ;
/*******************实用函数声明***********************/
bool FindField(char * Id , fieldChain *head,fieldChain **Entry );
Cglobal::ArgRecord *NewTemp (AccessKind access );
int NewLabel();
Cglobal::ArgRecord *ARGAddr(char *id ,int level, int off, AccessKind access);
Cglobal::ArgRecord *ARGLabel(int label );
Cglobal::ArgRecord *ARGValue(int value);
Cglobal::CodeFile *GenCode (CodeKind codekind , ArgRecord *Arg1 ,
ArgRecord *Arg2 ,ArgRecord *Arg3 );
void PrintCodeName(CodeKind kind);
void PrintContent(ArgRecord *arg);
void PrintOneCode(CodeFile *code);
void PrintMidCode(CodeFile *firstCode);
/***********中间代码生成函数声明******************/
void GenProcDec(TreeNode *t);
void GenBody(TreeNode *t);
void GenStatement(TreeNode *t);
void GenAssignS(TreeNode *t);
Cglobal::ArgRecord *GenVar(TreeNode *t);
Cglobal::ArgRecord *GenArray(ArgRecord *V1arg,TreeNode *t,int low ,int size);
Cglobal::ArgRecord *GenField(ArgRecord *V1arg,TreeNode *t ,fieldChain *head );
Cglobal::ArgRecord *GenExpr(TreeNode *t);
void GenCallS(TreeNode *t );
void GenReadS (TreeNode *t );
void GenWriteS(TreeNode *t );
void GenIfS(TreeNode *t );
void GenWhileS(TreeNode *t);
};
#endif // !defined(AFX_MIDCODE_H__64B47C88_9CBC_4D4E_8F81_746C997FF429__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -