From: Wolfgang Bumiller Date: Tue, 1 May 2012 10:05:47 +0000 (+0200) Subject: support TYPE_FIELD in stores; storeP to do a different kind of type checking X-Git-Tag: 0.1-rc1~542 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5f0800bef638bb5e7997721d6cb7e6a61180b378;p=xonotic%2Fgmqcc.git support TYPE_FIELD in stores; storeP to do a different kind of type checking --- diff --git a/ir.c b/ir.c index 7e66459..f001e27 100644 --- 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;