diff options
author | Teddy <[email protected]> | 2014-05-01 13:14:41 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2014-05-01 13:14:41 +0800 |
commit | 2b30bf74245fa28d59491150395b54766783b379 (patch) | |
tree | 798cbeb37d06f125ab3842f115849f3eb92b4fc9 | |
parent | 9c9ffe07398c4cb9d5167c8e876e766dad92af98 (diff) |
can generate native asm
-rw-r--r-- | TODO.rst | 2 | ||||
-rw-r--r-- | semantics.c | 1 | ||||
-rw-r--r-- | semantics.h | 2 | ||||
-rw-r--r-- | ssa.h | 7 |
4 files changed, 7 insertions, 5 deletions
@@ -22,9 +22,11 @@ TODO - const function name (done) - remove the redundant edge from blocks that break a loop - ``<<`` operation in pre-calculation + - support ``addui``, ``sll``, etc. - Not Implemented: - complex type name (to be in agreement with complex decl) (done) - initializer checking (done) - typedef support (via adding mid-rule actions to bision to inform flex) (done) + - ``&&`` and ``||`` diff --git a/semantics.c b/semantics.c index 49a782d..1361dd6 100644 --- a/semantics.c +++ b/semantics.c @@ -1875,7 +1875,6 @@ void semantics_check(CNode *p) { p->start = size; size += calc_size(p->type); } - func->rec.func.params_size = size; size = 0; for (p = func->rec.func.local; p; p = p->next) { diff --git a/semantics.h b/semantics.h index f1aa5a5..7fb8273 100644 --- a/semantics.h +++ b/semantics.h @@ -76,7 +76,7 @@ struct CType { CType_t ret; CNode *body; int local_size; - int params_size; + int frame_size; } func; /* for a function */ } rec; int size; /* memory footprint */ @@ -58,8 +58,8 @@ struct CInst { LOAD, /* load from memory */ ADDR, /* get address */ MUL, DIV, MOD, ADD, SUB, - SHL, SHR, AND, XOR, OR, - LOR, LAND, NOR, + SHL, SHR, AND, XOR, OR, NOR, + LOR, LAND, EQ, NE, LT, GT, LE, GE, NEG } op; @@ -67,7 +67,8 @@ struct CInst { CInst_t next, prev; int id; int is_def; - int bret; + int bret; /* for CALL */ + int offset; /* for PUSH */ }; typedef struct CPhi CPhi; |