mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Simplify the logic for BRTWOWAY_CC handling. The isel code already
simplifies BRTWOWAY into BR if one of the results is a fall-through. Unless I'm missing something, there is no reason to duplicate this in the target-specific code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22952 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -707,10 +707,6 @@ void ISel::SelectBranchCC(SDOperand N)
|
|||||||
unsigned CCReg = SelectCC(N.getOperand(2), N.getOperand(3), CC);
|
unsigned CCReg = SelectCC(N.getOperand(2), N.getOperand(3), CC);
|
||||||
unsigned Opc = getBCCForSetCC(CC);
|
unsigned Opc = getBCCForSetCC(CC);
|
||||||
|
|
||||||
// Iterate to the next basic block
|
|
||||||
ilist<MachineBasicBlock>::iterator It = BB;
|
|
||||||
++It;
|
|
||||||
|
|
||||||
// If this is a two way branch, then grab the fallthrough basic block argument
|
// If this is a two way branch, then grab the fallthrough basic block argument
|
||||||
// and build a PowerPC branch pseudo-op, suitable for long branch conversion
|
// and build a PowerPC branch pseudo-op, suitable for long branch conversion
|
||||||
// if necessary by the branch selection pass. Otherwise, emit a standard
|
// if necessary by the branch selection pass. Otherwise, emit a standard
|
||||||
@@ -718,19 +714,14 @@ void ISel::SelectBranchCC(SDOperand N)
|
|||||||
if (N.getOpcode() == ISD::BRTWOWAY_CC) {
|
if (N.getOpcode() == ISD::BRTWOWAY_CC) {
|
||||||
MachineBasicBlock *Fallthrough =
|
MachineBasicBlock *Fallthrough =
|
||||||
cast<BasicBlockSDNode>(N.getOperand(5))->getBasicBlock();
|
cast<BasicBlockSDNode>(N.getOperand(5))->getBasicBlock();
|
||||||
if (Dest != It) {
|
BuildMI(BB, PPC::COND_BRANCH, 4).addReg(CCReg).addImm(Opc)
|
||||||
BuildMI(BB, PPC::COND_BRANCH, 4).addReg(CCReg).addImm(Opc)
|
.addMBB(Dest).addMBB(Fallthrough);
|
||||||
.addMBB(Dest).addMBB(Fallthrough);
|
BuildMI(BB, PPC::B, 1).addMBB(Fallthrough);
|
||||||
if (Fallthrough != It)
|
|
||||||
BuildMI(BB, PPC::B, 1).addMBB(Fallthrough);
|
|
||||||
} else {
|
|
||||||
if (Fallthrough != It) {
|
|
||||||
Opc = PPC32InstrInfo::invertPPCBranchOpcode(Opc);
|
|
||||||
BuildMI(BB, PPC::COND_BRANCH, 4).addReg(CCReg).addImm(Opc)
|
|
||||||
.addMBB(Fallthrough).addMBB(Dest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
|
// Iterate to the next basic block
|
||||||
|
ilist<MachineBasicBlock>::iterator It = BB;
|
||||||
|
++It;
|
||||||
|
|
||||||
// If the fallthrough path is off the end of the function, which would be
|
// If the fallthrough path is off the end of the function, which would be
|
||||||
// undefined behavior, set it to be the same as the current block because
|
// undefined behavior, set it to be the same as the current block because
|
||||||
// we have nothing better to set it to, and leaving it alone will cause the
|
// we have nothing better to set it to, and leaving it alone will cause the
|
||||||
|
Reference in New Issue
Block a user