diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-12-01 11:07:05 +0000 | 
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-12-01 11:07:05 +0000 | 
| commit | 06f9d4012fb8acea3e9861d5722b5965dbb724d9 (patch) | |
| tree | ffe0478472eaa0686f11cb02c6df7d257b8719b0 /lib/Target/ARM/ARMISelLowering.cpp | |
| parent | 76e2e0ebfdd3d91b07a75822865ea3e9121a99ce (diff) | |
Notes
Diffstat (limited to 'lib/Target/ARM/ARMISelLowering.cpp')
| -rw-r--r-- | lib/Target/ARM/ARMISelLowering.cpp | 20 | 
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index c3af8e695fc8..c839fc65606a 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -39,6 +39,7 @@  #include "llvm/CodeGen/SelectionDAG.h"  #include "llvm/Target/TargetOptions.h"  #include "llvm/ADT/VectorExtras.h" +#include "llvm/Support/CommandLine.h"  #include "llvm/Support/ErrorHandling.h"  #include "llvm/Support/MathExtras.h"  #include <sstream> @@ -355,10 +356,6 @@ ARMTargetLowering::ARMTargetLowering(TargetMachine &TM)    setOperationAction(ISD::SDIVREM, MVT::i32, Expand);    setOperationAction(ISD::UDIVREM, MVT::i32, Expand); -  // Support label based line numbers. -  setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); -  setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); -    setOperationAction(ISD::GlobalAddress, MVT::i32,   Custom);    setOperationAction(ISD::ConstantPool,  MVT::i32,   Custom);    setOperationAction(ISD::GLOBAL_OFFSET_TABLE, MVT::i32, Custom); @@ -1360,10 +1357,17 @@ SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op,                             PseudoSourceValue::getGOT(), 0);      return Result;    } else { -    SDValue CPAddr = DAG.getTargetConstantPool(GV, PtrVT, 4); -    CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); -    return DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), CPAddr, -                       PseudoSourceValue::getConstantPool(), 0); +    // If we have T2 ops, we can materialize the address directly via movt/movw +    // pair. This is always cheaper. +    if (Subtarget->useMovt()) { +      return DAG.getNode(ARMISD::Wrapper, dl, PtrVT, +                         DAG.getTargetGlobalAddress(GV, PtrVT)); +    } else { +      SDValue CPAddr = DAG.getTargetConstantPool(GV, PtrVT, 4); +      CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); +      return DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), CPAddr, +                         PseudoSourceValue::getConstantPool(), 0); +    }    }  }  | 
