[llvm-commits] [llvm] r121820 - /llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
Bill Wendling
isanbard at gmail.com
Tue Dec 14 17:03:19 PST 2010
Author: void
Date: Tue Dec 14 19:03:19 2010
New Revision: 121820
URL: http://llvm.org/viewvc/llvm-project?rev=121820&view=rev
Log:
Reapply r121808 now that the missing patterns have been supplied.
Modified:
llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=121820&r1=121819&r2=121820&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Tue Dec 14 19:03:19 2010
@@ -918,27 +918,15 @@
return false; // We want to select tLDRpci instead.
}
- if (N.getOpcode() != ISD::ADD) {
- if (N.getOpcode() == ARMISD::Wrapper &&
- (!Subtarget->useMovt() ||
- N.getOperand(0).getOpcode() != ISD::TargetGlobalAddress))
- Base = N.getOperand(0);
- else
- Base = N;
-
- Offset = CurDAG->getRegister(0, MVT::i32);
- return true;
- }
+ if (N.getOpcode() != ISD::ADD)
+ return false;
// Thumb does not have [sp, r] address mode.
RegisterSDNode *LHSR = dyn_cast<RegisterSDNode>(N.getOperand(0));
RegisterSDNode *RHSR = dyn_cast<RegisterSDNode>(N.getOperand(1));
if ((LHSR && LHSR->getReg() == ARM::SP) ||
- (RHSR && RHSR->getReg() == ARM::SP)) {
- Base = N;
- Offset = CurDAG->getRegister(0, MVT::i32);
- return true;
- }
+ (RHSR && RHSR->getReg() == ARM::SP))
+ return false;
if (ConstantSDNode *RHS = dyn_cast<ConstantSDNode>(N.getOperand(1))) {
int RHSC = (int)RHS->getZExtValue();
@@ -1003,6 +991,23 @@
return true;
}
+ RegisterSDNode *LHSR = dyn_cast<RegisterSDNode>(N.getOperand(0));
+ RegisterSDNode *RHSR = dyn_cast<RegisterSDNode>(N.getOperand(1));
+ if ((LHSR && LHSR->getReg() == ARM::SP) ||
+ (RHSR && RHSR->getReg() == ARM::SP)) {
+ ConstantSDNode *LHS = dyn_cast<ConstantSDNode>(N.getOperand(0));
+ ConstantSDNode *RHS = dyn_cast<ConstantSDNode>(N.getOperand(1));
+ unsigned LHSC = LHS ? LHS->getZExtValue() : 0;
+ unsigned RHSC = RHS ? RHS->getZExtValue() : 0;
+
+ // Thumb does not have [sp, #imm5] address mode for non-zero imm5.
+ if (LHSC != 0 || RHSC != 0) return false;
+
+ Base = N;
+ OffImm = CurDAG->getTargetConstant(0, MVT::i32);
+ return true;
+ }
+
// If the RHS is + imm5 * scale, fold into addr mode.
if (ConstantSDNode *RHS = dyn_cast<ConstantSDNode>(N.getOperand(1))) {
int RHSC = (int)RHS->getZExtValue();
More information about the llvm-commits
mailing list