mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
Simplify some more getAliasSet callers.
MCRegAliasIterator can include Reg itself in the list. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157848 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2090766f6e
commit
8c70ea47fa
@ -711,13 +711,10 @@ void RAFast::handleThroughOperands(MachineInstr *MI,
|
||||
if (!MO.isReg() || !MO.isDef()) continue;
|
||||
unsigned Reg = MO.getReg();
|
||||
if (!Reg || !TargetRegisterInfo::isPhysicalRegister(Reg)) continue;
|
||||
UsedInInstr.set(Reg);
|
||||
if (ThroughRegs.count(PhysRegState[Reg]))
|
||||
definePhysReg(MI, Reg, regFree);
|
||||
for (const uint16_t *AS = TRI->getAliasSet(Reg); *AS; ++AS) {
|
||||
UsedInInstr.set(*AS);
|
||||
if (ThroughRegs.count(PhysRegState[*AS]))
|
||||
definePhysReg(MI, *AS, regFree);
|
||||
for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI) {
|
||||
UsedInInstr.set(*AI);
|
||||
if (ThroughRegs.count(PhysRegState[*AI]))
|
||||
definePhysReg(MI, *AI, regFree);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1036,9 +1033,8 @@ void RAFast::AllocateBasicBlock() {
|
||||
if (!Reg || !TargetRegisterInfo::isPhysicalRegister(Reg)) continue;
|
||||
// Look for physreg defs and tied uses.
|
||||
if (!MO.isDef() && !MI->isRegTiedToDefOperand(i)) continue;
|
||||
UsedInInstr.set(Reg);
|
||||
for (const uint16_t *AS = TRI->getAliasSet(Reg); *AS; ++AS)
|
||||
UsedInInstr.set(*AS);
|
||||
for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI)
|
||||
UsedInInstr.set(*AI);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,8 @@ void RegScavenger::setUsed(unsigned Reg) {
|
||||
}
|
||||
|
||||
bool RegScavenger::isAliasUsed(unsigned Reg) const {
|
||||
if (isUsed(Reg))
|
||||
return true;
|
||||
for (const uint16_t *R = TRI->getAliasSet(Reg); *R; ++R)
|
||||
if (isUsed(*R))
|
||||
for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI)
|
||||
if (isUsed(*AI))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@ -296,9 +294,8 @@ unsigned RegScavenger::findSurvivorReg(MachineBasicBlock::iterator StartMI,
|
||||
isVirtKillInsn = true;
|
||||
continue;
|
||||
}
|
||||
Candidates.reset(MO.getReg());
|
||||
for (const uint16_t *R = TRI->getAliasSet(MO.getReg()); *R; R++)
|
||||
Candidates.reset(*R);
|
||||
for (MCRegAliasIterator AI(MO.getReg(), TRI, true); AI.isValid(); ++AI)
|
||||
Candidates.reset(*AI);
|
||||
}
|
||||
// If we're not in a virtual reg's live range, this is a valid
|
||||
// restore point.
|
||||
|
@ -441,18 +441,13 @@ static bool CheckForLiveRegDef(SUnit *SU, unsigned Reg,
|
||||
SmallVector<unsigned, 4> &LRegs,
|
||||
const TargetRegisterInfo *TRI) {
|
||||
bool Added = false;
|
||||
if (LiveRegDefs[Reg] && LiveRegDefs[Reg] != SU) {
|
||||
if (RegAdded.insert(Reg)) {
|
||||
LRegs.push_back(Reg);
|
||||
for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI) {
|
||||
if (LiveRegDefs[*AI] && LiveRegDefs[*AI] != SU) {
|
||||
if (RegAdded.insert(*AI)) {
|
||||
LRegs.push_back(*AI);
|
||||
Added = true;
|
||||
}
|
||||
}
|
||||
for (const uint16_t *Alias = TRI->getAliasSet(Reg); *Alias; ++Alias)
|
||||
if (LiveRegDefs[*Alias] && LiveRegDefs[*Alias] != SU) {
|
||||
if (RegAdded.insert(*Alias)) {
|
||||
LRegs.push_back(*Alias);
|
||||
Added = true;
|
||||
}
|
||||
}
|
||||
return Added;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user