mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-08 15:24:21 +00:00
Handle sub-register operands in recomputeRegClass().
Now that getMatchingSuperRegClass() returns accurate results, it can be used to compute constraints imposed by instructions using a sub-register of a virtual register. This means we can recompute the register class of any virtual register by combining the constraints from all its uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146874 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -76,12 +76,14 @@ MachineRegisterInfo::recomputeRegClass(unsigned Reg, const TargetMachine &TM) {
|
|||||||
// Accumulate constraints from all uses.
|
// Accumulate constraints from all uses.
|
||||||
for (reg_nodbg_iterator I = reg_nodbg_begin(Reg), E = reg_nodbg_end(); I != E;
|
for (reg_nodbg_iterator I = reg_nodbg_begin(Reg), E = reg_nodbg_end(); I != E;
|
||||||
++I) {
|
++I) {
|
||||||
// TRI doesn't have accurate enough information to model this yet.
|
|
||||||
if (I.getOperand().getSubReg())
|
|
||||||
return false;
|
|
||||||
const TargetRegisterClass *OpRC =
|
const TargetRegisterClass *OpRC =
|
||||||
I->getRegClassConstraint(I.getOperandNo(), TII, TRI);
|
I->getRegClassConstraint(I.getOperandNo(), TII, TRI);
|
||||||
if (OpRC)
|
if (unsigned SubIdx = I.getOperand().getSubReg()) {
|
||||||
|
if (OpRC)
|
||||||
|
NewRC = TRI->getMatchingSuperRegClass(NewRC, OpRC, SubIdx);
|
||||||
|
else
|
||||||
|
NewRC = TRI->getSubClassWithSubReg(NewRC, SubIdx);
|
||||||
|
} else if (OpRC)
|
||||||
NewRC = TRI->getCommonSubClass(NewRC, OpRC);
|
NewRC = TRI->getCommonSubClass(NewRC, OpRC);
|
||||||
if (!NewRC || NewRC == OldRC)
|
if (!NewRC || NewRC == OldRC)
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user