Noticed this when looking at a trace that caused flags to spill to/from
registers. The flags source/destination wasn't encoded correctly
according to both envydis and nvdisasm.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
assert(sf == FILE_GPR || df == FILE_GPR);
if (sf == FILE_FLAGS) {
+ assert(i->flagsSrc >= 0);
code[0] = 0x00000001;
code[1] = 0x20000000;
defId(i->def(0), 2);
- srcId(i->src(0), 12);
emitFlagsRd(i);
} else
if (sf == FILE_ADDRESS) {
emitFlagsRd(i);
} else
if (df == FILE_FLAGS) {
+ assert(i->flagsDef >= 0);
code[0] = 0x00000001;
code[1] = 0xa0000000;
- defId(i->def(0), 4);
srcId(i->src(0), 9);
emitFlagsRd(i);
+ emitFlagsWr(i);
} else
if (sf == FILE_IMMEDIATE) {
code[0] = 0x10008001;
st = new_Instruction(func, OP_CVT, ty);
st->setDef(0, slot);
st->setSrc(0, lval);
+ if (lval->reg.file == FILE_FLAGS)
+ st->flagsSrc = 0;
}
defi->bb->insertAfter(defi, st);
}
}
ld->setDef(0, lval);
ld->setSrc(0, slot);
+ if (lval->reg.file == FILE_FLAGS)
+ ld->flagsDef = 0;
usei->bb->insertBefore(usei, ld);
return lval;