]> granicus.if.org Git - llvm/commitdiff
Revert "Remove extra argument used once on
authorEric Christopher <echristo@gmail.com>
Tue, 20 Sep 2016 22:03:28 +0000 (22:03 +0000)
committerEric Christopher <echristo@gmail.com>
Tue, 20 Sep 2016 22:03:28 +0000 (22:03 +0000)
TargetMachine::getNameWithPrefix and inline the result into the singular
caller." and "Remove more guts of TargetMachine::getNameWithPrefix and
migrate one check to the TLOF mach-o version." temporarily until I can
get the whole call migrated out of the TargetMachine as we could hit
places where TLOF isn't valid.

This reverts commits r281981 and r281983.

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

include/llvm/Target/TargetMachine.h
lib/CodeGen/TargetLoweringObjectFileImpl.cpp
lib/Target/TargetMachine.cpp

index 667d54373cdb96c9ceff4cc9fd2f368eb9234731..a01f4dbbf5b438fb129d010e3aab360c8995ee3f 100644 (file)
@@ -265,7 +265,7 @@ public:
   virtual bool targetSchedulesPostRAScheduling() const { return false; };
 
   void getNameWithPrefix(SmallVectorImpl<char> &Name, const GlobalValue *GV,
-                         Mangler &Mang) const;
+                         Mangler &Mang, bool MayAlwaysUsePrivate = false) const;
   MCSymbol *getSymbol(const GlobalValue *GV, Mangler &Mang) const;
 
   /// True if the target uses physical regs at Prolog/Epilog insertion
index b8339eefd9c3093e5b06ec6ad04036d92eee0f76..edaa778a6053139a9e56e58641827afe5bc48b3e 100644 (file)
@@ -301,7 +301,7 @@ selectELFSectionForGlobal(MCContext &Ctx, const GlobalValue *GV,
 
   if (EmitUniqueSection && UniqueSectionNames) {
     Name.push_back('.');
-    Mang.getNameWithPrefix(Name, GV, false);
+    TM.getNameWithPrefix(Name, GV, Mang, true);
   }
   unsigned UniqueID = MCContext::GenericSectionID;
   if (EmitUniqueSection && !UniqueSectionNames) {
@@ -817,13 +817,6 @@ static bool canUsePrivateLabel(const MCAsmInfo &AsmInfo,
 void TargetLoweringObjectFileMachO::getNameWithPrefix(
     SmallVectorImpl<char> &OutName, const GlobalValue *GV,
     const TargetMachine &TM) const {
-  if (!GV->hasPrivateLinkage()) {
-    // Simple case: If GV is not private, it is not important to find out if
-    // private labels are legal in this case or not.
-    getMangler().getNameWithPrefix(OutName, GV, false);
-    return;
-  }
-
   SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM);
   const MCSection *TheSection = SectionForGlobal(GV, GVKind, TM);
   bool CannotUsePrivateLabel =
index aa1916bb2eb476b9990d03cc617123f9d46e0ba3..17caed973910a2269bf8506d89310135ecacfbe8 100644 (file)
@@ -199,8 +199,16 @@ TargetIRAnalysis TargetMachine::getTargetIRAnalysis() {
 }
 
 void TargetMachine::getNameWithPrefix(SmallVectorImpl<char> &Name,
-                                      const GlobalValue *GV, Mangler &Mang) const {
-  getObjFileLowering()->getNameWithPrefix(Name, GV, *this);
+                                      const GlobalValue *GV, Mangler &Mang,
+                                      bool MayAlwaysUsePrivate) const {
+  if (MayAlwaysUsePrivate || !GV->hasPrivateLinkage()) {
+    // Simple case: If GV is not private, it is not important to find out if
+    // private labels are legal in this case or not.
+    Mang.getNameWithPrefix(Name, GV, false);
+    return;
+  }
+  const TargetLoweringObjectFile *TLOF = getObjFileLowering();
+  TLOF->getNameWithPrefix(Name, GV, *this);
 }
 
 MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang) const {