From 5f0800bef638bb5e7997721d6cb7e6a61180b378 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 1 May 2012 12:05:47 +0200 Subject: [PATCH] support TYPE_FIELD in stores; storeP to do a different kind of type checking --- ir.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) 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;