diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-02-06 09:11:20 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-02-06 09:11:20 +0000 |
commit | 8c1a73ad3ffbc121a251b93b0fb4e64187f90645 (patch) | |
tree | 8d3a0fa64b4ca804292a3a5ae4eb09ad69e67846 | |
parent | a17588c3c2850207c708fd808edac7ef954f3cd2 (diff) |
Select add FI, c correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33960 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/ARM/ARMISelDAGToDAG.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Target/ARM/ARMISelDAGToDAG.cpp b/lib/Target/ARM/ARMISelDAGToDAG.cpp index a67ff4fa56..5af9c7368c 100644 --- a/lib/Target/ARM/ARMISelDAGToDAG.cpp +++ b/lib/Target/ARM/ARMISelDAGToDAG.cpp @@ -454,7 +454,8 @@ bool ARMDAGToDAGISel::SelectThumbAddrModeSP(SDOperand Op, SDOperand N, return false; RegisterSDNode *LHSR = dyn_cast<RegisterSDNode>(N.getOperand(0)); - if (LHSR && LHSR->getReg() == ARM::SP) { + if (N.getOperand(0).getOpcode() == ISD::FrameIndex || + (LHSR && LHSR->getReg() == ARM::SP)) { // If the RHS is + imm8 * scale, fold into addr mode. if (ConstantSDNode *RHS = dyn_cast<ConstantSDNode>(N.getOperand(1))) { int RHSC = (int)RHS->getValue(); @@ -462,6 +463,10 @@ bool ARMDAGToDAGISel::SelectThumbAddrModeSP(SDOperand Op, SDOperand N, RHSC >>= 2; if (RHSC >= 0 && RHSC < 256) { Base = N.getOperand(0); + if (Base.getOpcode() == ISD::FrameIndex) { + int FI = cast<FrameIndexSDNode>(Base)->getIndex(); + Base = CurDAG->getTargetFrameIndex(FI, TLI.getPointerTy()); + } OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32); return true; } |