mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
- Change MachineInstr::findRegisterDefOperandIdx so it can also look for defs
that are aliases of the specified register. - Rename modifiesRegister to definesRegister since it's looking a def of the specific register or one of its super-registers. It's not looking for def of a sub-register or alias that could change the specified register. - Added modifiesRegister to look for defs of aliases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104377 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -813,20 +813,25 @@ MachineInstr::readsWritesVirtualRegister(unsigned Reg,
|
||||
/// the specified register or -1 if it is not found. If isDead is true, defs
|
||||
/// that are not dead are skipped. If TargetRegisterInfo is non-null, then it
|
||||
/// also checks if there is a def of a super-register.
|
||||
int MachineInstr::findRegisterDefOperandIdx(unsigned Reg, bool isDead,
|
||||
const TargetRegisterInfo *TRI) const {
|
||||
int
|
||||
MachineInstr::findRegisterDefOperandIdx(unsigned Reg, bool isDead, bool Overlap,
|
||||
const TargetRegisterInfo *TRI) const {
|
||||
bool isPhys = TargetRegisterInfo::isPhysicalRegister(Reg);
|
||||
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
|
||||
const MachineOperand &MO = getOperand(i);
|
||||
if (!MO.isReg() || !MO.isDef())
|
||||
continue;
|
||||
unsigned MOReg = MO.getReg();
|
||||
if (MOReg == Reg ||
|
||||
(TRI &&
|
||||
TargetRegisterInfo::isPhysicalRegister(MOReg) &&
|
||||
TargetRegisterInfo::isPhysicalRegister(Reg) &&
|
||||
TRI->isSubRegister(MOReg, Reg)))
|
||||
if (!isDead || MO.isDead())
|
||||
return i;
|
||||
bool Found = (MOReg == Reg);
|
||||
if (!Found && TRI && isPhys &&
|
||||
TargetRegisterInfo::isPhysicalRegister(MOReg)) {
|
||||
if (Overlap)
|
||||
Found = TRI->regsOverlap(MOReg, Reg);
|
||||
else
|
||||
Found = TRI->isSubRegister(MOReg, Reg);
|
||||
}
|
||||
if (Found && (!isDead || MO.isDead()))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user