[llvm] r281983 - Remove more guts of TargetMachine::getNameWithPrefix and migrate one check to the TLOF mach-o version.

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 09:05:03 PDT 2016


Author: echristo
Date: Tue Sep 20 11:05:02 2016
New Revision: 281983

URL: http://llvm.org/viewvc/llvm-project?rev=281983&view=rev
Log:
Remove more guts of TargetMachine::getNameWithPrefix and migrate one check to the TLOF mach-o version.

NFC intended.

Modified:
    llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    llvm/trunk/lib/Target/TargetMachine.cpp

Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=281983&r1=281982&r2=281983&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Tue Sep 20 11:05:02 2016
@@ -812,6 +812,13 @@ static bool canUsePrivateLabel(const MCA
 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 =

Modified: llvm/trunk/lib/Target/TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=281983&r1=281982&r2=281983&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/TargetMachine.cpp Tue Sep 20 11:05:02 2016
@@ -200,14 +200,7 @@ TargetIRAnalysis TargetMachine::getTarge
 
 void TargetMachine::getNameWithPrefix(SmallVectorImpl<char> &Name,
                                       const GlobalValue *GV, Mangler &Mang) 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.
-    Mang.getNameWithPrefix(Name, GV, false);
-    return;
-  }
-  const TargetLoweringObjectFile *TLOF = getObjFileLowering();
-  TLOF->getNameWithPrefix(Name, GV, *this);
+  getObjFileLowering()->getNameWithPrefix(Name, GV, *this);
 }
 
 MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang) const {




More information about the llvm-commits mailing list