[llvm-commits] CVS: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp ARMISelDAGToDAG.cpp ARMInstrThumb.td
Evan Cheng
evan.cheng at apple.com
Wed Jan 24 00:53:59 PST 2007
Changes in directory llvm/lib/Target/ARM:
ARMConstantIslandPass.cpp updated: 1.1 -> 1.2
ARMISelDAGToDAG.cpp updated: 1.102 -> 1.103
ARMInstrThumb.td updated: 1.2 -> 1.3
---
Log message:
Use PC relative ldr to load from a constantpool in Thumb mode.
---
Diffs of the changes: (+25 -9)
ARMConstantIslandPass.cpp | 3 +++
ARMISelDAGToDAG.cpp | 25 +++++++++++++++++--------
ARMInstrThumb.td | 6 +++++-
3 files changed, 25 insertions(+), 9 deletions(-)
Index: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
diff -u llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.1 llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.2
--- llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.1 Fri Jan 19 01:51:42 2007
+++ llvm/lib/Target/ARM/ARMConstantIslandPass.cpp Wed Jan 24 02:53:17 2007
@@ -245,6 +245,9 @@
case ARMII::AddrModeT4:
MaxOffs = 1 << (5+2);
break;
+ case ARMII::AddrModeTs:
+ MaxOffs = 1 << (8+2);
+ break;
}
// Remember that this is a user of a CP entry.
Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.102 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.103
--- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.102 Tue Jan 23 20:45:25 2007
+++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Wed Jan 24 02:53:17 2007
@@ -380,6 +380,9 @@
SDOperand TmpBase, TmpOffImm;
if (SelectThumbAddrModeSP(Op, N, TmpBase, TmpOffImm))
return false; // We want to select tLDRspi / tSTRspi instead.
+ if (N.getOpcode() == ARMISD::Wrapper &&
+ N.getOperand(0).getOpcode() == ISD::TargetConstantPool)
+ return false; // We want to select tLDRpci instead.
}
if (N.getOpcode() != ISD::ADD) {
@@ -505,14 +508,20 @@
SDOperand CPIdx =
CurDAG->getTargetConstantPool(ConstantInt::get(Type::Int32Ty, Val),
TLI.getPointerTy());
- SDOperand Ops[] = {
- CPIdx,
- CurDAG->getRegister(0, MVT::i32),
- CurDAG->getTargetConstant(0, MVT::i32),
- CurDAG->getEntryNode()
- };
- SDNode *ResNode =
- CurDAG->getTargetNode(ARM::LDR, MVT::i32, MVT::Other, Ops, 4);
+
+ SDNode *ResNode;
+ if (Subtarget->isThumb())
+ ResNode = CurDAG->getTargetNode(ARM::tLDRpci, MVT::i32, MVT::Other,
+ CPIdx, CurDAG->getEntryNode());
+ else {
+ SDOperand Ops[] = {
+ CPIdx,
+ CurDAG->getRegister(0, MVT::i32),
+ CurDAG->getTargetConstant(0, MVT::i32),
+ CurDAG->getEntryNode()
+ };
+ ResNode = CurDAG->getTargetNode(ARM::LDR, MVT::i32, MVT::Other, Ops, 4);
+ }
ReplaceUses(Op, SDOperand(ResNode, 0));
return NULL;
}
Index: llvm/lib/Target/ARM/ARMInstrThumb.td
diff -u llvm/lib/Target/ARM/ARMInstrThumb.td:1.2 llvm/lib/Target/ARM/ARMInstrThumb.td:1.3
--- llvm/lib/Target/ARM/ARMInstrThumb.td:1.2 Tue Jan 23 16:59:13 2007
+++ llvm/lib/Target/ARM/ARMInstrThumb.td Wed Jan 24 02:53:17 2007
@@ -220,10 +220,14 @@
"ldrsh $dst, $addr",
[(set GPR:$dst, (sextloadi16 t_addrmode_rr:$addr))]>;
-// def tLDRpci
def tLDRspi : TIs<(ops GPR:$dst, t_addrmode_sp:$addr),
"ldr $dst, $addr",
[(set GPR:$dst, (load t_addrmode_sp:$addr))]>;
+
+// Load tconstpool
+def tLDRpci : TIs<(ops GPR:$dst, i32imm:$addr),
+ "ldr $dst, $addr",
+ [(set GPR:$dst, (load (ARMWrapper tconstpool:$addr)))]>;
} // isLoad
let isStore = 1 in {
More information about the llvm-commits
mailing list