]> granicus.if.org Git - llvm/commitdiff
Move llvm::emitLinkerFlagsForGlobalCOFF() to Mangler.
authorPeter Collingbourne <peter@pcc.me.uk>
Fri, 31 Mar 2017 04:46:50 +0000 (04:46 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Fri, 31 Mar 2017 04:46:50 +0000 (04:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299183 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
include/llvm/IR/Mangler.h
lib/CodeGen/TargetLoweringObjectFileImpl.cpp
lib/IR/Mangler.cpp
lib/LTO/LTO.cpp
lib/LTO/LTOModule.cpp

index eccedb1434c38ee3cb3743e636be918285540d9e..adf2b3ea1c9b3f79883330bf30f1725cda33da8d 100644 (file)
@@ -187,9 +187,6 @@ public:
                                        const TargetMachine &TM) const override;
 };
 
-void emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV,
-                                  const Triple &TT, Mangler &Mangler);
-
 } // end namespace llvm
 
 #endif // LLVM_CODEGEN_TARGETLOWERINGOBJECTFILEIMPL_H
index 0eb91a3b0600e9aeb89834a6303995c8da27080a..56ee21392ccd6c2cf1124fce8fd9e3d4456cf6bb 100644 (file)
@@ -21,6 +21,7 @@ namespace llvm {
 
 class DataLayout;
 template <typename T> class SmallVectorImpl;
+class Triple;
 class Twine;
 class raw_ostream;
 
@@ -46,6 +47,9 @@ public:
                                 const Twine &GVName, const DataLayout &DL);
 };
 
+void emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV,
+                                  const Triple &TT, Mangler &Mangler);
+
 } // End llvm namespace
 
 #endif
index 1439ff2ad1af56dc5f40f7e8021364ae5f5766df..78afeda67dbf2dcd4e7e39b7b19254c26fa48373 100644 (file)
@@ -970,37 +970,6 @@ static int getSelectionForCOFF(const GlobalValue *GV) {
   return 0;
 }
 
-void llvm::emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV,
-                                        const Triple &TT, Mangler &Mangler) {
-  if (!GV->hasDLLExportStorageClass() || GV->isDeclaration())
-    return;
-
-  if (TT.isKnownWindowsMSVCEnvironment())
-    OS << " /EXPORT:";
-  else
-    OS << " -export:";
-
-  if (TT.isWindowsGNUEnvironment() || TT.isWindowsCygwinEnvironment()) {
-    std::string Flag;
-    raw_string_ostream FlagOS(Flag);
-    Mangler.getNameWithPrefix(FlagOS, GV, false);
-    FlagOS.flush();
-    if (Flag[0] == GV->getParent()->getDataLayout().getGlobalPrefix())
-      OS << Flag.substr(1);
-    else
-      OS << Flag;
-  } else {
-    Mangler.getNameWithPrefix(OS, GV, false);
-  }
-
-  if (!GV->getValueType()->isFunctionTy()) {
-    if (TT.isKnownWindowsMSVCEnvironment())
-      OS << ",DATA";
-    else
-      OS << ",data";
-  }
-}
-
 MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
     const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
   int Selection = 0;
index 41e11b3945e40b5c573657dcf294251513e622ac..03723bfd2ddb7b8d27e418fd315951fc7f7fd926 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "llvm/IR/Mangler.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/Triple.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/DerivedTypes.h"
@@ -172,3 +173,34 @@ void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
   raw_svector_ostream OS(OutName);
   getNameWithPrefix(OS, GV, CannotUsePrivateLabel);
 }
+
+void llvm::emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV,
+                                        const Triple &TT, Mangler &Mangler) {
+  if (!GV->hasDLLExportStorageClass() || GV->isDeclaration())
+    return;
+
+  if (TT.isKnownWindowsMSVCEnvironment())
+    OS << " /EXPORT:";
+  else
+    OS << " -export:";
+
+  if (TT.isWindowsGNUEnvironment() || TT.isWindowsCygwinEnvironment()) {
+    std::string Flag;
+    raw_string_ostream FlagOS(Flag);
+    Mangler.getNameWithPrefix(FlagOS, GV, false);
+    FlagOS.flush();
+    if (Flag[0] == GV->getParent()->getDataLayout().getGlobalPrefix())
+      OS << Flag.substr(1);
+    else
+      OS << Flag;
+  } else {
+    Mangler.getNameWithPrefix(OS, GV, false);
+  }
+
+  if (!GV->getValueType()->isFunctionTy()) {
+    if (TT.isKnownWindowsMSVCEnvironment())
+      OS << ",DATA";
+    else
+      OS << ",data";
+  }
+}
index f3d258e6c259bd16710a8bf06fd27af88c9fbb84..20e9e611aba4108545e6c3c27571f1320403563b 100644 (file)
@@ -17,7 +17,6 @@
 #include "llvm/Bitcode/BitcodeReader.h"
 #include "llvm/Bitcode/BitcodeWriter.h"
 #include "llvm/CodeGen/Analysis.h"
-#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
 #include "llvm/IR/AutoUpgrade.h"
 #include "llvm/IR/DiagnosticPrinter.h"
 #include "llvm/IR/LegacyPassManager.h"
index 0d96b07847ae83db0c75699e26b5d2b4d6ae12ec..11f0982c6a6029fa45a5208f6df87b9d2cc7cd95 100644 (file)
 #include "llvm/ADT/Triple.h"
 #include "llvm/Analysis/ObjectUtils.h"
 #include "llvm/Bitcode/BitcodeReader.h"
-#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DiagnosticPrinter.h"
 #include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/Mangler.h"
 #include "llvm/IR/Metadata.h"
 #include "llvm/IR/Module.h"
 #include "llvm/MC/MCExpr.h"