diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-31 20:52:39 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-31 20:52:39 +0000 |
commit | 84362ace0889c4f1f71e8e5604fd620ba7ebb664 (patch) | |
tree | 29c36c86ec272ac013e35f333ae760fc558b941e /lib | |
parent | 45482f71891c8afe53f4798e20be2f58c0e1a6dc (diff) | |
download | external_llvm-84362ace0889c4f1f71e8e5604fd620ba7ebb664.zip external_llvm-84362ace0889c4f1f71e8e5604fd620ba7ebb664.tar.gz external_llvm-84362ace0889c4f1f71e8e5604fd620ba7ebb664.tar.bz2 |
move emitUsedDirectiveFor to TargetLoweringObjectFile and rename it to
indicate that it is a predicate, not an emitter. This eliminates TAI
dependencies on Mangler and GlobalValue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77726 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 2 | ||||
-rw-r--r-- | lib/Target/DarwinTargetAsmInfo.cpp | 20 | ||||
-rw-r--r-- | lib/Target/TargetLoweringObjectFile.cpp | 23 |
3 files changed, 24 insertions, 21 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 178bbaa..077d72e 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -564,7 +564,7 @@ void AsmPrinter::EmitLLVMUsedList(Constant *List) { for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) { const GlobalValue *GV = dyn_cast<GlobalValue>(InitList->getOperand(i)->stripPointerCasts()); - if (GV && TAI->emitUsedDirectiveFor(GV, Mang)) { + if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, Mang)) { O << Directive; EmitConstantValueOnly(InitList->getOperand(i)); O << '\n'; diff --git a/lib/Target/DarwinTargetAsmInfo.cpp b/lib/Target/DarwinTargetAsmInfo.cpp index aa93c0d..306300e 100644 --- a/lib/Target/DarwinTargetAsmInfo.cpp +++ b/lib/Target/DarwinTargetAsmInfo.cpp @@ -79,23 +79,3 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM) DwarfMacroInfoSection = ".section __DWARF,__debug_macinfo,regular,debug"; } -/// emitUsedDirectiveFor - On Darwin, internally linked data beginning with -/// the PrivateGlobalPrefix or the LinkerPrivateGlobalPrefix does not have the -/// directive emitted (this occurs in ObjC metadata). -bool DarwinTargetAsmInfo::emitUsedDirectiveFor(const GlobalValue* GV, - Mangler *Mang) const { - if (!GV) return false; - - // 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. - const std::string &Name = Mang->getMangledName(GV); - if (Name[0] == 'L' || Name[0] == 'l') - return false; - } - - return true; -} - diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp index 36fda0b..9ba12bb 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -585,6 +585,29 @@ getSectionForMergeableConstant(SectionKind Kind) const { return ReadOnlySection; // .const } +/// shouldEmitUsedDirectiveFor - 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) const { + /// On Darwin, internally linked data beginning with "L" or "l" does not have + /// the directive emitted (this occurs in ObjC metadata). + if (!GV) return false; + + // 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. + const std::string &Name = Mang->getMangledName(GV); + if (Name[0] == 'L' || Name[0] == 'l') + return false; + } + + return true; +} + + //===----------------------------------------------------------------------===// // COFF //===----------------------------------------------------------------------===// |