]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
the codegen has to use STORE_V for .vector, not STORE_FLD - contrary to the regular...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 9 Nov 2012 19:11:17 +0000 (20:11 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 9 Nov 2012 19:11:17 +0000 (20:11 +0100)
ir.c

diff --git a/ir.c b/ir.c
index cece314de829d3af570fe819f802396bc6787c8e..940cfbb6fb050d943fa36cf3088a1d6ccd5ddfe6 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -75,6 +75,22 @@ uint16_t type_store_instr[TYPE_COUNT] = {
     INSTR_STORE_V, /* variant, should never be accessed */
 };
 
+uint16_t field_store_instr[TYPE_COUNT] = {
+    INSTR_STORE_FLD,
+    INSTR_STORE_FLD,
+    INSTR_STORE_FLD,
+    INSTR_STORE_V,
+    INSTR_STORE_FLD,
+    INSTR_STORE_FLD,
+    INSTR_STORE_FLD,
+    INSTR_STORE_FLD,
+#if 0
+    INSTR_STORE_FLD, /* integer type */
+#endif
+
+    INSTR_STORE_V, /* variant, should never be accessed */
+};
+
 uint16_t type_storep_instr[TYPE_COUNT] = {
     INSTR_STOREP_F, /* should use I when having integer support */
     INSTR_STOREP_S,
@@ -2502,7 +2518,10 @@ tailcall:
                 stmt.opcode = INSTR_STORE_F;
                 stmt.o3.u1 = 0;
 
-                stmt.opcode = type_store_instr[param->vtype];
+                if (param->vtype == TYPE_FIELD)
+                    stmt.opcode = field_store_instr[param->fieldtype];
+                else
+                    stmt.opcode = type_store_instr[param->vtype];
                 stmt.o1.u1 = ir_value_code_addr(param);
                 stmt.o2.u1 = OFS_PARM0 + 3 * p;
                 if (code_statements_add(stmt) < 0)
@@ -2521,7 +2540,10 @@ tailcall:
             if (retvalue && retvalue->store != store_return && retvalue->life_count)
             {
                 /* not to be kept in OFS_RETURN */
-                stmt.opcode = type_store_instr[retvalue->vtype];
+                if (retvalue->vtype == TYPE_FIELD)
+                    stmt.opcode = field_store_instr[retvalue->vtype];
+                else
+                    stmt.opcode = type_store_instr[retvalue->vtype];
                 stmt.o1.u1 = OFS_RETURN;
                 stmt.o2.u1 = ir_value_code_addr(retvalue);
                 stmt.o3.u1 = 0;