Match SelectionDAG logic for enabling movt.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Sat, 7 Jan 2012 20:49:15 +0000 (20:49 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Sat, 7 Jan 2012 20:49:15 +0000 (20:49 +0000)
Darwin doesn't do static, and ELF targets only support static.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147740 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMFastISel.cpp
lib/Target/ARM/ARMISelLowering.cpp

index 9b056d703c7159476a7a95263aa87dc207b7dd25..801c6639e2cb0ed1828b1ea81892c1b5b4f2a002 100644 (file)
@@ -620,7 +620,11 @@ unsigned ARMFastISel::ARMMaterializeGV(const GlobalValue *GV, EVT VT) {
   unsigned DestReg = createResultReg(TLI.getRegClassFor(VT));
 
   // Use movw+movt when possible, it avoids constant pool entries.
-  if (Subtarget->isTargetDarwin() && Subtarget->useMovt()) {
+  // Darwin targets don't support movt with Reloc::Static, see
+  // ARMTargetLowering::LowerGlobalAddressDarwin.  Other targets only support
+  // static movt relocations.
+  if (Subtarget->useMovt() &&
+      Subtarget->isTargetDarwin() == (RelocM != Reloc::Static)) {
     unsigned Opc;
     switch (RelocM) {
     case Reloc::PIC_:
index 9c7848397d2251c9962874871e778f17bed82ec7..95e535def4ae11d7f1332a8dcf8012debc60d5c0 100644 (file)
@@ -2166,7 +2166,8 @@ SDValue ARMTargetLowering::LowerGlobalAddressDarwin(SDValue Op,
   MachineFunction &MF = DAG.getMachineFunction();
   ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
 
-  // FIXME: Enable this for static codegen when tool issues are fixed.
+  // FIXME: Enable this for static codegen when tool issues are fixed.  Also
+  // update ARMFastISel::ARMMaterializeGV.
   if (Subtarget->useMovt() && RelocM != Reloc::Static) {
     ++NumMovwMovt;
     // FIXME: Once remat is capable of dealing with instructions with register