[qfcc] Create alias def for defs accessed via pointer

This the fixes the incorrect flow analysis caused by the def being seen
to have the wrong size (structure field of structure def seen through a
constant pointer). Fixes the ICE, but the pointer constant is broken
somewhere in dags, presumably.
This commit is contained in:
Bill Currie 2020-03-07 01:30:36 +09:00
parent faa6eabfbe
commit 48514ba2f3
2 changed files with 10 additions and 2 deletions

View file

@ -859,8 +859,10 @@ flow_analyze_statement (statement_t *s, set_t *use, set_t *def, set_t *kill,
&& s->opc->o.value->lltype == ev_pointer && s->opc->o.value->lltype == ev_pointer
&& s->opc->o.value->v.pointer.def) { && s->opc->o.value->v.pointer.def) {
operand_t *op; operand_t *op;
def_t *alias;
ex_pointer_t *ptr = &s->opc->o.value->v.pointer; ex_pointer_t *ptr = &s->opc->o.value->v.pointer;
op = def_operand (ptr->def, ptr->type); alias = alias_def (ptr->def, ptr->type, ptr->val);
op = def_operand (alias, ptr->type);
flow_add_op_var (def, op); flow_add_op_var (def, op);
if (operands) if (operands)
operands[0] = op; operands[0] = op;

View file

@ -103,7 +103,13 @@ operand_string (operand_t *op)
op->o.value->v.quaternion_val[2], op->o.value->v.quaternion_val[2],
op->o.value->v.quaternion_val[3]); op->o.value->v.quaternion_val[3]);
case ev_pointer: case ev_pointer:
return va ("ptr %d", op->o.value->v.pointer.val); if (op->o.value->v.pointer.def) {
return va ("ptr %s+%d",
op->o.value->v.pointer.def->name,
op->o.value->v.pointer.val);
} else {
return va ("ptr %d", op->o.value->v.pointer.val);
}
case ev_field: case ev_field:
return va ("field %d", op->o.value->v.pointer.val); return va ("field %d", op->o.value->v.pointer.val);
case ev_entity: case ev_entity: