diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-02-07 23:56:08 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-02-07 23:56:08 +0000 |
commit | 60c8fa6bb9db791acf6846fe250c184e3f1df168 (patch) | |
tree | 0e928353bb866717deae0863d47196304f8531a3 /lib | |
parent | 30d409ca097e35c51964c9dac642804e5e495906 (diff) | |
download | external_llvm-60c8fa6bb9db791acf6846fe250c184e3f1df168.zip external_llvm-60c8fa6bb9db791acf6846fe250c184e3f1df168.tar.gz external_llvm-60c8fa6bb9db791acf6846fe250c184e3f1df168.tar.bz2 |
[fast-isel] Add support for indirect branches.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150014 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM/ARMFastISel.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMFastISel.cpp b/lib/Target/ARM/ARMFastISel.cpp index 904e917..d2c8d15 100644 --- a/lib/Target/ARM/ARMFastISel.cpp +++ b/lib/Target/ARM/ARMFastISel.cpp @@ -157,6 +157,7 @@ class ARMFastISel : public FastISel { bool SelectLoad(const Instruction *I); bool SelectStore(const Instruction *I); bool SelectBranch(const Instruction *I); + bool SelectIndirectBr(const Instruction *I); bool SelectCmp(const Instruction *I); bool SelectFPExt(const Instruction *I); bool SelectFPTrunc(const Instruction *I); @@ -1350,6 +1351,16 @@ bool ARMFastISel::SelectBranch(const Instruction *I) { return true; } +bool ARMFastISel::SelectIndirectBr(const Instruction *I) { + unsigned AddrReg = getRegForValue(I->getOperand(0)); + if (AddrReg == 0) return false; + + unsigned Opc = isThumb2 ? ARM::tBRIND : ARM::BX; + AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(Opc)) + .addReg(AddrReg)); + return true; +} + bool ARMFastISel::ARMEmitCmp(const Value *Src1Value, const Value *Src2Value, bool isZExt) { Type *Ty = Src1Value->getType(); @@ -2468,6 +2479,8 @@ bool ARMFastISel::TargetSelectInstruction(const Instruction *I) { return SelectStore(I); case Instruction::Br: return SelectBranch(I); + case Instruction::IndirectBr: + return SelectIndirectBr(I); case Instruction::ICmp: case Instruction::FCmp: return SelectCmp(I); |