aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTucker Evans <tuckerevans24@gmail.com>2019-10-09 09:56:19 -0400
committerTucker Evans <tuckerevans24@gmail.com>2019-10-09 09:56:19 -0400
commit698dd8d2ebcba45a79c6126c698991110d0c9a76 (patch)
treec91029b2cfb72b1a9f7e2487c8b772bd8fe30d1c
parente96b0e885aecc66377fc020a74169ceaea450a38 (diff)
Add Multiply /Division code generation
-rw-r--r--gen_code.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gen_code.c b/gen_code.c
index 45dbf6c..312267c 100644
--- a/gen_code.c
+++ b/gen_code.c
@@ -123,9 +123,12 @@ int c;
break;
case MUL:
fprintf(stdout, "imulq\t");
+ if (c == 1)
+ goto case1;
+ goto case23;
break;
case DIV:
- fprintf(stdout, "idivq\t");
+ gen_load(t);
break;
default:
fprintf(stderr, "OPVAL: %d\n", t->attr.opval);
@@ -229,6 +232,8 @@ ptree *t;
gen_load(t->l);
fprintf(stdout, "negq\t%s\n", *reg_ptr);
break;
+ case DIV:
+ yyerror("DIV not imlemented\n");
default:
fprintf(stdout, "movq OTHER");
}