Add zrl opcode. Keep track of local sizes as well as offsets.
authorDavid Given <dg@cowlark.com>
Sun, 2 Oct 2016 14:08:46 +0000 (16:08 +0200)
committerDavid Given <dg@cowlark.com>
Sun, 2 Oct 2016 14:08:46 +0000 (16:08 +0200)
mach/proto/mcg/procedure.h
mach/proto/mcg/treebuilder.c

index de11c54..2414db0 100644 (file)
@@ -3,6 +3,8 @@
 
 struct local
 {
+    int size;
+    int offset;
     bool is_register;
 };
 
@@ -16,6 +18,7 @@ struct procedure
 };
 
 extern void procedure_compile(struct procedure* proc);
+extern void procedure_update_bb_graph(struct procedure* proc);
 
 #endif
 
index e8675e6..c99bb7e 100644 (file)
@@ -111,6 +111,7 @@ void tb_regvar(struct procedure* procedure, arith offset, int size, int type, in
 {
     struct local* local = calloc(1, sizeof(*local));
     local->size = size;
+    local->offset = offset;
     local->is_register = true;
     imap_put(&procedure->locals, offset, local);
 }
@@ -413,6 +414,16 @@ static void insn_ivalue(int opcode, arith value)
             change_by(new_localir(value), -1);
             break;
 
+        case op_zrl:
+            appendir(
+                new_ir2(
+                    IR_STORE, EM_wordsize,
+                    new_localir(value),
+                    new_wordir(0)
+                )
+            );
+            break;
+
         case op_loc:
             push(
                 new_wordir(value)