diff options
author | Richard Osborne <richard@xmos.com> | 2010-02-23 13:25:07 +0000 |
---|---|---|
committer | Richard Osborne <richard@xmos.com> | 2010-02-23 13:25:07 +0000 |
commit | 78700b0c55ccc2d355ba9ee2ac666d669052b0cb (patch) | |
tree | d7699ce13e6e7d4181eb703f2bf9c7bdb8be2f7c /lib/Target/XCore/XCoreInstrInfo.cpp | |
parent | 3d4cea31d52c2bfddf0a8b9791fa12cada933200 (diff) |
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
Diffstat (limited to 'lib/Target/XCore/XCoreInstrInfo.cpp')
-rw-r--r-- | lib/Target/XCore/XCoreInstrInfo.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Target/XCore/XCoreInstrInfo.cpp b/lib/Target/XCore/XCoreInstrInfo.cpp index 5a548449d8..722e7470f0 100644 --- a/lib/Target/XCore/XCoreInstrInfo.cpp +++ b/lib/Target/XCore/XCoreInstrInfo.cpp @@ -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; } |