diff options
author | Teddy <ted.sybil@gmail.com> | 2014-05-05 02:04:39 +0800 |
---|---|---|
committer | Teddy <ted.sybil@gmail.com> | 2014-05-05 02:04:39 +0800 |
commit | 6586df0797ad60af031cb80889f8205b6adcdfe3 (patch) | |
tree | e85ca5ff863f823f32702d68608121900cfc5170 /ssa.h | |
parent | 7bf7dcbefc89fd67e62c0bb625089c1d53e8e878 (diff) |
higher code-gen quality
Diffstat (limited to 'ssa.h')
-rw-r--r-- | ssa.h | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -53,15 +53,15 @@ struct COList { void colist_remove(COList_t node); struct CInst { - enum { + enum OpCode { BEQZ, /* conditional jump */ BNEZ, GOTO, /* unconditional jump */ ARR, /* displacement */ - WARR, PUSH, /* push to stack top */ CALL, /* call function */ RET, /* return */ + WARR, MOVE, LOAD, /* load from memory */ ADDR, /* get address */ @@ -141,6 +141,23 @@ typedef struct CInterv { CRange_t range; } CInterv; +typedef struct CENode CENode; +typedef struct CExpMap { + struct CENode { + CInst_t exp; + CENode *next; + } *head[MAX_TABLE_SIZE]; +} CExpMap; +typedef CExpMap *CExpMap_t; + +CExpMap_t cexpmap_create(void); +unsigned int cexpmap_hash(CInst_t exp); +int cexpmap_comp(CInst_t exp1, CInst_t exp2); +void cexpmap_insert(CExpMap_t cem, CInst_t exp); +CInst_t cexpmap_lookup(CExpMap_t cem, CInst_t exp); +void cexpmap_clear(CExpMap_t cem); +void cexpmap_destroy(CExpMap_t cem); + void ssa_generate(void); COpr_t cinterv_repr(COpr_t opr); void cinst_print(FILE *stream, CInst_t inst); |