mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
Fix bug: Jello/2003-08-23-RegisterAllocatePhysReg.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8095 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -400,19 +400,27 @@ unsigned RA::getReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &I,
|
|||||||
"Couldn't find a register of the appropriate class!");
|
"Couldn't find a register of the appropriate class!");
|
||||||
|
|
||||||
unsigned R = PhysRegsUseOrder[i];
|
unsigned R = PhysRegsUseOrder[i];
|
||||||
// If the current register is compatible, use it.
|
|
||||||
if (RegInfo->getRegClass(R) == RC) {
|
// We can only use this register if it holds a virtual register (ie, it
|
||||||
PhysReg = R;
|
// can be spilled). Do not use it if it is an explicitly allocated
|
||||||
break;
|
// physical register!
|
||||||
} else {
|
assert(PhysRegsUsed.count(R) &&
|
||||||
// If one of the registers aliased to the current register is
|
"PhysReg in PhysRegsUseOrder, but is not allocated?");
|
||||||
// compatible, use it.
|
if (PhysRegsUsed[R]) {
|
||||||
if (const unsigned *AliasSet = RegInfo->getAliasSet(R))
|
// If the current register is compatible, use it.
|
||||||
for (unsigned a = 0; AliasSet[a]; ++a)
|
if (RegInfo->getRegClass(R) == RC) {
|
||||||
if (RegInfo->getRegClass(AliasSet[a]) == RC) {
|
PhysReg = R;
|
||||||
PhysReg = AliasSet[a]; // Take an aliased register
|
break;
|
||||||
break;
|
} else {
|
||||||
}
|
// If one of the registers aliased to the current register is
|
||||||
|
// compatible, use it.
|
||||||
|
if (const unsigned *AliasSet = RegInfo->getAliasSet(R))
|
||||||
|
for (unsigned a = 0; AliasSet[a]; ++a)
|
||||||
|
if (RegInfo->getRegClass(AliasSet[a]) == RC) {
|
||||||
|
PhysReg = AliasSet[a]; // Take an aliased register
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user