From fae1b41e9d6f18b719a99e91a4219896d9c19677 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Thu, 11 Jun 2015 08:49:34 -0400 Subject: some new C --- lisc/lisc.h | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 lisc/lisc.h (limited to 'lisc/lisc.h') diff --git a/lisc/lisc.h b/lisc/lisc.h new file mode 100644 index 0000000..dbe4d63 --- /dev/null +++ b/lisc/lisc.h @@ -0,0 +1,62 @@ +#include +#include + +enum { + R = -1, /* Invalid reference. */ + Temp0 = 32, /* First temporary, below are machine registers. */ + MaxPreds = 16, /* Maximum number of predecessors for a block. */ + MaxBlks = 128, + MaxInss = 128, + MaxPhis = 128, +}; + +typedef int Ref; +typedef struct Ins Ins; +typedef struct Phi Phi; +typedef struct Blk Blk; +typedef enum Op Op; +typedef enum Jmp Jmp; + +enum Op { + ONop, + OAdd, + OSub, + OSDiv, + OMod, + OParam, + OCall, + + /* x86 instructions (reserved) */ + XDiv, +}; + +enum Jmp { + JRet, + JJmp, + JCnd, +}; + +struct Ins { + Op op; + Ref res; + Ref arg0, arg1; +}; + +struct Phi { + Ref res; + int na; + Ref args[MaxPreds]; +}; + +struct Blk { + int np; + int ni; + Phi *ps; + Ins *is; + struct { + Jmp ty; + Ref arg; + } jmp; + int suc0, suc1; + int dpth; +}; -- cgit 1.4.1