[llvm] r203174 - Remove shouldEmitUsedDirectiveFor.

Rafael Espindola rafael.espindola at gmail.com
Thu Mar 6 14:47:09 PST 2014


Author: rafael
Date: Thu Mar  6 16:47:08 2014
New Revision: 203174

URL: http://llvm.org/viewvc/llvm-project?rev=203174&view=rev
Log:
Remove shouldEmitUsedDirectiveFor.

Clang now uses llvm.compiler.used for these cases.

Modified:
    llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
    llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    llvm/trunk/test/CodeGen/X86/darwin-no-dead-strip.ll

Modified: llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h?rev=203174&r1=203173&r2=203174&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h (original)
+++ llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h Thu Mar  6 16:47:08 2014
@@ -102,12 +102,6 @@ public:
 
   const MCSection *getSectionForConstant(SectionKind Kind) const override;
 
-  /// This hook allows targets to selectively decide not to emit the
-  /// UsedDirective for some symbols in llvm.used.
-  /// FIXME: REMOVE this (rdar://7071300)
-  bool shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang,
-                                  TargetMachine &TM) const override;
-
   /// The mach-o version of this method defaults to returning a stub reference.
   const MCExpr *
   getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,

Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=203174&r1=203173&r2=203174&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Thu Mar  6 16:47:08 2014
@@ -68,14 +68,6 @@ public:
                                ArrayRef<Module::ModuleFlagEntry> Flags,
                                Mangler &Mang, const TargetMachine &TM) const {}
 
-  /// This hook allows targets to selectively decide not to emit the
-  /// UsedDirective for some symbols in llvm.used.
-  /// FIXME: REMOVE this (rdar://7071300)
-  virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang,
-                                          TargetMachine &TM) const {
-    return GV != 0;
-  }
-
   /// Given a constant with the SectionKind, return a section that it should be
   /// placed in.
   virtual const MCSection *getSectionForConstant(SectionKind Kind) const;

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=203174&r1=203173&r2=203174&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Thu Mar  6 16:47:08 2014
@@ -1453,7 +1453,7 @@ void AsmPrinter::EmitLLVMUsedList(const
   for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
     const GlobalValue *GV =
       dyn_cast<GlobalValue>(InitList->getOperand(i)->stripPointerCasts());
-    if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, *Mang, TM))
+    if (GV)
       OutStreamer.EmitSymbolAttribute(getSymbol(GV), MCSA_NoDeadStrip);
   }
 }

Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=203174&r1=203173&r2=203174&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Thu Mar  6 16:47:08 2014
@@ -641,24 +641,6 @@ TargetLoweringObjectFileMachO::getSectio
   return ReadOnlySection;  // .const
 }
 
-/// This hook allows targets to selectively decide not to emit the UsedDirective
-/// for some symbols in llvm.used.
-// FIXME: REMOVE this (rdar://7071300)
-bool TargetLoweringObjectFileMachO::shouldEmitUsedDirectiveFor(
-    const GlobalValue *GV, Mangler &Mang, TargetMachine &TM) const {
-  // Check whether the mangled name has the "Private" or "LinkerPrivate" prefix.
-  if (GV->hasLocalLinkage() && !isa<Function>(GV)) {
-    // FIXME: ObjC metadata is currently emitted as internal symbols that have
-    // \1L and \0l prefixes on them.  Fix them to be Private/LinkerPrivate and
-    // this horrible hack can go away.
-    MCSymbol *Sym = TM.getSymbol(GV, Mang);
-    if (Sym->getName()[0] == 'L' || Sym->getName()[0] == 'l')
-      return false;
-  }
-
-  return true;
-}
-
 const MCExpr *TargetLoweringObjectFileMachO::getTTypeGlobalReference(
     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
     const TargetMachine &TM, MachineModuleInfo *MMI,

Modified: llvm/trunk/test/CodeGen/X86/darwin-no-dead-strip.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/darwin-no-dead-strip.ll?rev=203174&r1=203173&r2=203174&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/darwin-no-dead-strip.ll (original)
+++ llvm/trunk/test/CodeGen/X86/darwin-no-dead-strip.ll Thu Mar  6 16:47:08 2014
@@ -6,4 +6,8 @@ target triple = "i686-apple-darwin8.7.2"
 @x = weak global i32 0
 ; CHECK: .no_dead_strip	_x
 
- at llvm.used = appending global [1 x i8*] [ i8* bitcast (i32* @x to i8*) ]
+@"\01Ly" = private global i8 0
+; CHECK: no_dead_strip Ly
+
+ at llvm.used = appending global [2 x i8*] [ i8* bitcast (i32* @x to i8*),
+            i8* @"\01Ly" ]





More information about the llvm-commits mailing list