mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 04:29:21 +00:00
allow insertion of a conditional branch with fall-through
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31095 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
386e29065d
commit
34a84ac81c
@ -374,15 +374,21 @@ void X86InstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
||||
const std::vector<MachineOperand> &Cond) const {
|
||||
// Shouldn't be a fall through.
|
||||
assert(TBB && "InsertBranch must not be told to insert a fallthrough");
|
||||
|
||||
// Unconditional branch?
|
||||
if (FBB == 0) {
|
||||
BuildMI(&MBB, X86::JMP, 1).addMBB(TBB);
|
||||
assert((Cond.size() == 1 || Cond.size() == 0) &&
|
||||
"X86 branch conditions have one component!");
|
||||
|
||||
if (FBB == 0) { // One way branch.
|
||||
if (Cond.empty()) {
|
||||
// Unconditional branch?
|
||||
BuildMI(&MBB, X86::JMP, 1).addMBB(TBB);
|
||||
} else {
|
||||
// Conditional branch.
|
||||
unsigned Opc = GetCondBranchFromCond((X86::CondCode)Cond[0].getImm());
|
||||
BuildMI(&MBB, Opc, 1).addMBB(TBB);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
assert(Cond.size() == 1 && "X86 branch conditions have one component!");
|
||||
|
||||
// Conditional branch.
|
||||
unsigned Opc = GetCondBranchFromCond((X86::CondCode)Cond[0].getImm());
|
||||
BuildMI(&MBB, Opc, 1).addMBB(TBB);
|
||||
|
Loading…
Reference in New Issue
Block a user