From 698dd8d2ebcba45a79c6126c698991110d0c9a76 Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Wed, 9 Oct 2019 09:56:19 -0400 Subject: Add Multiply /Division code generation --- gen_code.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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"); } -- cgit v1.1