From 2b30bf74245fa28d59491150395b54766783b379 Mon Sep 17 00:00:00 2001 From: Teddy Date: Thu, 1 May 2014 13:14:41 +0800 Subject: can generate native asm --- TODO.rst | 2 ++ semantics.c | 1 - semantics.h | 2 +- ssa.h | 7 ++++--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/TODO.rst b/TODO.rst index 6981f48..14363bc 100644 --- a/TODO.rst +++ b/TODO.rst @@ -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 */ diff --git a/ssa.h b/ssa.h index 1cd57a8..240fb6e 100644 --- a/ssa.h +++ b/ssa.h @@ -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; -- cgit v1.2.3-70-g09d2