summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-02-07 23:56:08 +0000
committerChad Rosier <mcrosier@apple.com>2012-02-07 23:56:08 +0000
commitded4c99f2e0561fcebbdc7736472ba8c2b8ce463 (patch)
tree12d30cc4d91ae9707c557b277eaa14ff0cb7993c /llvm/lib
parentd925d1a8d7d9934b1bf3c9c0c5d88baffb1c4c1b (diff)
downloadbcm5719-llvm-ded4c99f2e0561fcebbdc7736472ba8c2b8ce463.tar.gz
bcm5719-llvm-ded4c99f2e0561fcebbdc7736472ba8c2b8ce463.zip
[fast-isel] Add support for indirect branches.
llvm-svn: 150014
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/ARM/ARMFastISel.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMFastISel.cpp b/llvm/lib/Target/ARM/ARMFastISel.cpp
index 904e9171c87..d2c8d15dbbb 100644
--- a/llvm/lib/Target/ARM/ARMFastISel.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud