add pretty printing function

This commit is contained in:
Quentin Carbonneaux 2015-07-15 02:55:10 -04:00
parent ba1b430524
commit 68c6feefbd
2 changed files with 104 additions and 19 deletions

View file

@ -16,6 +16,7 @@ enum {
NIns = 256,
};
typedef struct OpDesc OpDesc;
typedef struct Ins Ins;
typedef struct Phi Phi;
typedef struct Blk Blk;
@ -29,7 +30,7 @@ enum {
RMask = 1,
RShift = 1,
NRefs = ((ushort)-1)>>RShift,
NRef = ((ushort)-1)>>RShift,
};
#define SYM(x) (((x)<<RShift) | RSym)
@ -45,8 +46,16 @@ enum {
/* reserved instructions */
OX86Div,
OLast
};
struct OpDesc {
int arity;
int commut:1;
char *name;
};
extern OpDesc opdesc[];
enum {
JXXX,
JRet,
@ -110,6 +119,7 @@ struct Fn {
/* parse.c */
void *alloc(size_t);
Fn *parsefn(FILE *);
void printfn(Fn *, FILE *);
/* ssa.c */
void fillpreds(Fn *);