]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
support TYPE_FIELD in stores; storeP to do a different kind of type checking
authorWolfgang Bumiller <wolfgang.linux@bumiller.com>
Tue, 1 May 2012 10:05:47 +0000 (12:05 +0200)
committerWolfgang Bumiller <wolfgang.linux@bumiller.com>
Tue, 1 May 2012 10:05:47 +0000 (12:05 +0200)
ir.c

diff --git a/ir.c b/ir.c
index 7e6645979e43ad4372c26b6207b8bd1fbf0f892a..f001e278ef5dc7a3772bb341a44e5d1189f1c2dd 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -608,6 +608,9 @@ bool ir_block_create_store(ir_block *self, ir_value *target, ir_value *what)
         case TYPE_STRING:
             op = INSTR_STORE_S;
             break;
+        case TYPE_FIELD:
+            op = INSTR_STORE_FLD;
+            break;
 #if 0
         case TYPE_INTEGER:
             if (what->vtype == TYPE_INTEGER)
@@ -634,16 +637,14 @@ bool ir_block_create_storep(ir_block *self, ir_value *target, ir_value *what)
 {
     int op = 0;
     int vtype;
-    if (target->vtype == TYPE_VARIANT)
-        vtype = what->vtype;
-    else
-        vtype = target->vtype;
 
-    if (vtype != what->vtype)
-    {
-        /* Cannot implicitly convert when storing through a pointer */
+    if (target->vtype != TYPE_POINTER)
         return false;
-    }
+
+    /* storing using pointer - target is a pointer, type must be
+     * inferred from source
+     */
+    vtype = what->vtype;
 
     switch (vtype) {
         case TYPE_FLOAT:
@@ -658,6 +659,9 @@ bool ir_block_create_storep(ir_block *self, ir_value *target, ir_value *what)
         case TYPE_STRING:
             op = INSTR_STOREP_S;
             break;
+        case TYPE_FIELD:
+            op = INSTR_STOREP_FLD;
+            break;
 #if 0
         case TYPE_INTEGER:
             op = INSTR_STOREP_I;