mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-23 20:33:05 +00:00
support TYPE_FIELD in stores; storeP to do a different kind of type checking
This commit is contained in:
parent
340daeabc4
commit
5f0800bef6
1 changed files with 12 additions and 8 deletions
20
ir.c
20
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;
|
||||
|
|
Loading…
Reference in a new issue