]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
ir_instr can now store a list of parameters, will be used for CALLs
authorWolfgang (Blub) Bumiller <blub@speed.at>
Thu, 28 Jun 2012 13:50:51 +0000 (15:50 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Thu, 28 Jun 2012 13:50:51 +0000 (15:50 +0200)
ir.c
ir.h

diff --git a/ir.c b/ir.c
index d81cdcecf1a838c963189c5990692da9767b213a..3d4db01ffad0803d68ac0dd60fedfa7fc1b61d9c 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -356,6 +356,7 @@ ir_instr* ir_instr_new(ir_block* owner, int op)
     self->bops[0] = NULL;
     self->bops[1] = NULL;
     MEM_VECTOR_INIT(self, phi);
+    MEM_VECTOR_INIT(self, params);
 
     self->eid = 0;
     return self;
@@ -379,6 +380,14 @@ void ir_instr_delete(ir_instr *self)
             if (ir_value_reads_remove (self->phi[i].value, idx)) GMQCC_SUPRESS_EMPTY_BODY;
     }
     MEM_VECTOR_CLEAR(self, phi);
+    for (i = 0; i < self->params_count; ++i) {
+        size_t idx;
+        if (ir_value_writes_find(self->params[i], self, &idx))
+            if (ir_value_writes_remove(self->params[i], idx)) GMQCC_SUPRESS_EMPTY_BODY;
+        if (ir_value_reads_find(self->params[i], self, &idx))
+            if (ir_value_reads_remove (self->params[i], idx)) GMQCC_SUPRESS_EMPTY_BODY;
+    }
+    MEM_VECTOR_CLEAR(self, params);
     if (ir_instr_op(self, 0, NULL, false)) GMQCC_SUPRESS_EMPTY_BODY;
     if (ir_instr_op(self, 1, NULL, false)) GMQCC_SUPRESS_EMPTY_BODY;
     if (ir_instr_op(self, 2, NULL, false)) GMQCC_SUPRESS_EMPTY_BODY;
@@ -2109,6 +2118,9 @@ tailcall:
         }
 
         if (instr->opcode >= INSTR_CALL0 && instr->opcode <= INSTR_CALL8) {
+            /* Trivial call translation:
+             * copy all params to OFS_PARM*
+             */
             printf("TODO: call instruction\n");
             return false;
         }
diff --git a/ir.h b/ir.h
index a611dba13cba29e8f655f8e26ad9da27ecd7f272..8bb0789922ca5f86c81bdb34755f0c625f171c4b 100644 (file)
--- a/ir.h
+++ b/ir.h
@@ -115,6 +115,7 @@ typedef struct ir_instr_s
     struct ir_block_s* (bops[2]);
 
     MEM_VECTOR_MAKE(ir_phi_entry_t, phi);
+    MEM_VECTOR_MAKE(ir_value*, params);
 
     /* For the temp-allocation */
     size_t eid;