summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-02-06 09:11:20 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-02-06 09:11:20 +0000
commita974031ebda9cf15f8a7943a92a2c356322bde8f (patch)
treeb08444fc514f49ceaf82f01471093bdb9022e069 /llvm/lib
parent5a165de53c42063ab40b08cb81c29675db40ea78 (diff)
downloadbcm5719-llvm-a974031ebda9cf15f8a7943a92a2c356322bde8f.tar.gz
bcm5719-llvm-a974031ebda9cf15f8a7943a92a2c356322bde8f.zip
Select add FI, c correctly.
llvm-svn: 33960
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp b/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
index a67ff4fa560..5af9c7368cf 100644
--- a/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud