aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2014-05-01 13:14:41 +0800
committerTeddy <ted.sybil@gmail.com>2014-05-01 13:14:41 +0800
commit2b30bf74245fa28d59491150395b54766783b379 (patch)
tree798cbeb37d06f125ab3842f115849f3eb92b4fc9
parent9c9ffe07398c4cb9d5167c8e876e766dad92af98 (diff)
can generate native asm
-rw-r--r--TODO.rst2
-rw-r--r--semantics.c1
-rw-r--r--semantics.h2
-rw-r--r--ssa.h7
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;