aboutsummaryrefslogtreecommitdiff
path: root/mips.c
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2014-05-04 11:41:39 +0800
committerTeddy <ted.sybil@gmail.com>2014-05-04 11:41:39 +0800
commit5aba86743d63a9d7000ce4e410ff7c61bcb0547f (patch)
treed96984551fb4c628e539b0e421ede0ad88080a6a /mips.c
parent5f8c8cb8293ecdd76a9fda30a9a7fdf7b89232cd (diff)
argument opt has been postponed
Diffstat (limited to 'mips.c')
-rw-r--r--mips.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/mips.c b/mips.c
index 6f85c1b..5fa5831 100644
--- a/mips.c
+++ b/mips.c
@@ -254,6 +254,7 @@ void mips_func_end() {
void mips_generate() {
CBlock_t p;
+ /* int arg_cnt = 0; */
mips_space_alloc();
if (strcmp(func->name, "main"))
printf("_func_%s:\n",func->name);
@@ -275,7 +276,9 @@ void mips_generate() {
switch (i->op)
{
case LOAD:
- if (i->dest->kind == VAR && i->dest->reg > 0)
+ if (i->dest->kind == VAR &&
+ i->dest->reg > 0) /* &&
+ i->dest->info.var->loc >= 0) */
mips_load(i->dest->reg, i->dest);
break;
case MOVE:
@@ -364,8 +367,18 @@ void mips_generate() {
case PUSH:
{
int rs = mips_to_reg(i->src1, reg_v0);
+ /*
+ if (arg_cnt < 4)
+ {
+ printf("\tmove $%d, $%d\n", arg_cnt + 4, rs);
+ }
+ else
+ {
+ */
/* TODO: push struct */
printf("\tsw $%d, %d($sp) # push\n", rs, i->offset);
+ /* }
+ arg_cnt++; */
}
break;
case CALL: