Move shouldAssumeDSOLocal to Target.

Should fix the shared library build.

llvm-svn: 273958
diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp
index d3b3a9d..d690734 100644
--- a/llvm/lib/CodeGen/Analysis.cpp
+++ b/llvm/lib/CodeGen/Analysis.cpp
@@ -638,48 +638,6 @@
   return GV->hasAtLeastLocalUnnamedAddr();
 }
 
-// FIXME: make this a proper option
-static bool CanUseCopyRelocWithPIE = false;
-
-bool llvm::shouldAssumeDSOLocal(Reloc::Model RM, const Triple &TT,
-                                const Module &M, const GlobalValue *GV) {
-  // DLLImport explicitly marks the GV as external.
-  if (GV && GV->hasDLLImportStorageClass())
-    return false;
-
-  // Every other GV is local on COFF
-  if (TT.isOSBinFormatCOFF())
-    return true;
-
-  if (GV && (GV->hasLocalLinkage() || !GV->hasDefaultVisibility()))
-    return true;
-
-  if (TT.isOSBinFormatMachO()) {
-    if (RM == Reloc::Static)
-      return true;
-    return GV && GV->isStrongDefinitionForLinker();
-  }
-
-  assert(TT.isOSBinFormatELF());
-  assert(RM != Reloc::DynamicNoPIC);
-
-  bool IsExecutable =
-      RM == Reloc::Static || M.getPIELevel() != PIELevel::Default;
-  if (IsExecutable) {
-    // If the symbol is defined, it cannot be preempted.
-    if (GV && !GV->isDeclarationForLinker())
-      return true;
-
-    bool IsTLS = GV && GV->isThreadLocal();
-    // Check if we can use copy relocations.
-    if (!IsTLS && (RM == Reloc::Static || CanUseCopyRelocWithPIE))
-      return true;
-  }
-
-  // ELF supports preemption of other symbols.
-  return false;
-}
-
 static void collectFuncletMembers(
     DenseMap<const MachineBasicBlock *, int> &FuncletMembership, int Funclet,
     const MachineBasicBlock *MBB) {
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 87ce2de..10dcb0a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -316,13 +316,11 @@
 bool
 TargetLowering::isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const {
   const TargetMachine &TM = getTargetMachine();
-  Reloc::Model RM = TM.getRelocationModel();
   const GlobalValue *GV = GA->getGlobal();
-  const Triple &TargetTriple = TM.getTargetTriple();
 
   // If the address is not even local to this DSO we will have to load it from
   // a got and then add the offset.
-  if (!shouldAssumeDSOLocal(RM, TargetTriple, *GV->getParent(), GV))
+  if (!TM.shouldAssumeDSOLocal(*GV->getParent(), GV))
     return false;
 
   // If the code is position independent we will have to add a base register.