mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 00:20:25 +00:00
Lower BR_JT on the XCore to a jump into a series of jump instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96942 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -145,6 +145,11 @@ static inline bool IsCondBranch(unsigned BrOpc) {
|
||||
return IsBRF(BrOpc) || IsBRT(BrOpc);
|
||||
}
|
||||
|
||||
static inline bool IsBR_JT(unsigned BrOpc) {
|
||||
return BrOpc == XCore::BR_JT
|
||||
|| BrOpc == XCore::BR_JT32;
|
||||
}
|
||||
|
||||
/// GetCondFromBranchOpc - Return the XCore CC that matches
|
||||
/// the correspondent Branch instruction opcode.
|
||||
static XCore::CondCode GetCondFromBranchOpc(unsigned BrOpc)
|
||||
@@ -271,6 +276,14 @@ XCoreInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
|
||||
return false;
|
||||
}
|
||||
|
||||
// Likewise if it ends with a branch table followed by an unconditional branch.
|
||||
if (IsBR_JT(SecondLastInst->getOpcode()) && IsBRU(LastInst->getOpcode())) {
|
||||
I = LastInst;
|
||||
if (AllowModify)
|
||||
I->eraseFromParent();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Otherwise, can't handle this.
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user