mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-22 09:29:31 +00:00
Preserve subregs on PHI source operands. Patch by Krister Wombell!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111366 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ca9460f5a0
commit
9ac248848f
@ -181,6 +181,7 @@ void llvm::PHIElimination::LowerAtomicPHINode(
|
|||||||
|
|
||||||
unsigned NumSrcs = (MPhi->getNumOperands() - 1) / 2;
|
unsigned NumSrcs = (MPhi->getNumOperands() - 1) / 2;
|
||||||
unsigned DestReg = MPhi->getOperand(0).getReg();
|
unsigned DestReg = MPhi->getOperand(0).getReg();
|
||||||
|
assert(MPhi->getOperand(0).getSubReg() == 0 && "Can't handle sub-reg PHIs");
|
||||||
bool isDead = MPhi->getOperand(0).isDead();
|
bool isDead = MPhi->getOperand(0).isDead();
|
||||||
|
|
||||||
// Create a new register for the incoming PHI arguments.
|
// Create a new register for the incoming PHI arguments.
|
||||||
@ -267,6 +268,8 @@ void llvm::PHIElimination::LowerAtomicPHINode(
|
|||||||
SmallPtrSet<MachineBasicBlock*, 8> MBBsInsertedInto;
|
SmallPtrSet<MachineBasicBlock*, 8> MBBsInsertedInto;
|
||||||
for (int i = NumSrcs - 1; i >= 0; --i) {
|
for (int i = NumSrcs - 1; i >= 0; --i) {
|
||||||
unsigned SrcReg = MPhi->getOperand(i*2+1).getReg();
|
unsigned SrcReg = MPhi->getOperand(i*2+1).getReg();
|
||||||
|
unsigned SrcSubReg = MPhi->getOperand(i*2+1).getSubReg();
|
||||||
|
|
||||||
assert(TargetRegisterInfo::isVirtualRegister(SrcReg) &&
|
assert(TargetRegisterInfo::isVirtualRegister(SrcReg) &&
|
||||||
"Machine PHI Operands must all be virtual registers!");
|
"Machine PHI Operands must all be virtual registers!");
|
||||||
|
|
||||||
@ -296,7 +299,7 @@ void llvm::PHIElimination::LowerAtomicPHINode(
|
|||||||
// Insert the copy.
|
// Insert the copy.
|
||||||
if (!reusedIncoming && IncomingReg)
|
if (!reusedIncoming && IncomingReg)
|
||||||
BuildMI(opBlock, InsertPos, MPhi->getDebugLoc(),
|
BuildMI(opBlock, InsertPos, MPhi->getDebugLoc(),
|
||||||
TII->get(TargetOpcode::COPY), IncomingReg).addReg(SrcReg);
|
TII->get(TargetOpcode::COPY), IncomingReg).addReg(SrcReg, 0, SrcSubReg);
|
||||||
|
|
||||||
// Now update live variable information if we have it. Otherwise we're done
|
// Now update live variable information if we have it. Otherwise we're done
|
||||||
if (!LV) continue;
|
if (!LV) continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user