#include #include "asm.h" #include "tree.h" #define LabelEq(i, l) \ (CodeBuf[(i)].label != NUL \ && strcmp(CodeBuf[(i)].label, (l)) == 0) #define OpEq(i, o) \ (CodeBuf[(i)].op != NUL \ && strcmp(CodeBuf[(i)].op, (o)) == 0) #define Arg1Eq(i, a) \ (CodeBuf[(i)].arg1 != NUL \ && strcmp(CodeBuf[(i)].arg1, (a)) == 0) #define Arg2Eq(i, a) \ (CodeBuf[(i)].arg2 != NUL \ && strcmp(CodeBuf[(i)].arg2, (a)) == 0) /* stringf.c で定義 */ char *Stringf(char *fmt, ...); /* 文字列を生成して返す (malloc 使用) */ /* asm.c で定義 */ extern Code CodeBuf[]; extern int CBp; /* プロトタイプ宣言 */ int chkjmp(int i); /* CodeBuf[i] が省略可能なjmp命令かどうかの判定 */ int chkaddesp(int i); /* 省略可能な add esp, ??? 命令かどうかの判定 */ /* コードの最適化(覗き穴最適化) */ void optCode(void) { int u, l; /* u: 処理済コードの末尾,l: 未処理コードの先頭 */ char *s; int i; for(u=l=0; l