📄 ex86asm.h
字号:
// Ex86asm.h: interface for the Ex86asm class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_EX86ASM_H__C704C173_50C6_4975_ADB1_F4AC56011F2C__INCLUDED_)
#define AFX_EX86ASM_H__C704C173_50C6_4975_ADB1_F4AC56011F2C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "tac.h"
#include "taclist.h"
class Declaration;
class Ex86asm
{
private:
void StoreVarInEAX(Declaration * decl);
void StoreEAXInVar(Declaration * decl);
void StoreVarInEDX(Declaration * decl);
void StoreEDXInVar(Declaration * decl);
int nStringCount;
public:
void EmitGVar(Declaration *decl);
void EmitPreamble();
Ex86asm();
virtual ~Ex86asm();
static void Emit(const char *fmt, ...);
static void EmitOp2(const char *op, const char *dst,const char * src,const char * comment=NULL,const char * comment2=NULL )
{
if(comment2!=NULL)
Emit("%-6s %-9s , %-9s \t ;%s (%s)",op,dst,src,comment,comment2);
else if (comment!=NULL)
Emit("%-6s %-9s , %-9s \t ;%s",op,dst,src,comment);
else
Emit("%-6s %-9s , %-9s",op,dst,src);
}
static void EmitOp1(const char *op, const char *dst,const char * comment=NULL,const char * comment2=NULL )
{
if(comment2!=NULL)
Emit("%-6s %-9s %11s \t ;%s (%s)",op,dst,"",comment,comment2);
else if (comment!=NULL)
Emit("%-6s %-9s %11s \t ;%s",op,dst,"",comment);
else
Emit("%-6s %-9s",op,dst);
}
static void EmitOp0(const char *op, const char * comment=NULL,const char * comment2=NULL )
{
if(comment2!=NULL)
Emit("%-6s %21s \t ;%s (%s)",op,"",comment,comment2);
else if(comment!=NULL)
Emit("%-6s %21s \t ;%s",op,"",comment);
else
Emit("%-6s",op);
}
void EmitLoadConstant(Declaration *dst, int val);
void EmitLoadStringConstant(Declaration *dst, const char *str);
void EmitLoadLabel(Declaration *dst, const char *label);
void EmitLoad(Declaration *dst, Declaration *reference, int offset);
void EmitStore(Declaration *reference, Declaration *value, int offset);
void EmitCopy(Declaration *dst, Declaration *src);
void EmitBinaryOp(Tac::OpCode code, Declaration *dst,
Declaration *op1, Declaration *op2);
void EmitLabel(const char *label);
void EmitGoto(const char *label);
void EmitIfZ(Declaration *test, const char*label);
void EmitReturn(Declaration *returnVal);
void EmitBeginFunction(Declaration * fun,int frameSize);
void EmitEndFunction(Declaration * fun);
void EmitArg(Declaration *arg);
void EmitLCall(Declaration *result, const char* label, int bytes);
void EmitACall(Declaration *result, Declaration *fnAddr, int bytes);
void EmitVTable(const char *label, DeclList *methods);
};
#endif // !defined(AFX_EX86ASM_H__C704C173_50C6_4975_ADB1_F4AC56011F2C__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -