diff options
author | Dale Johannesen <dalej@apple.com> | 2008-09-09 22:29:13 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2008-09-09 22:29:13 +0000 |
commit | 60567624019d288f4fc733d44e7205c463a9bd75 (patch) | |
tree | 829af1ac09fe4d71385f4e3370c0854d79bbb7e8 /lib/CodeGen/AsmPrinter | |
parent | 25893a3884b7d16d5e8a4eb1e50a7a28a805e019 (diff) | |
download | external_llvm-60567624019d288f4fc733d44e7205c463a9bd75.zip external_llvm-60567624019d288f4fc733d44e7205c463a9bd75.tar.gz external_llvm-60567624019d288f4fc733d44e7205c463a9bd75.tar.bz2 |
Move the uglier parts of deciding not to emit a
UsedDirective for some symbols in llvm.used into
Darwin-specific code. I've decided LessPrivateGlobal
is potentially a useful abstraction and left it in
the target-independent area, with improved comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56024 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index f041f3b..98f4b7d 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -451,10 +451,9 @@ const GlobalValue * AsmPrinter::findGlobalValue(const Constant *CV) { } /// EmitLLVMUsedList - For targets that define a TAI::UsedDirective, mark each -/// global in the specified llvm.used list as being used with this directive. -/// Internally linked data beginning with the PrivateGlobalPrefix or the -/// LessPrivateGlobalPrefix does not have the directive emitted (this -/// occurs in ObjC metadata). +/// global in the specified llvm.used list for which emitUsedDirectiveFor +/// is true, as being used with this directive. + void AsmPrinter::EmitLLVMUsedList(Constant *List) { const char *Directive = TAI->getUsedDirective(); @@ -464,17 +463,7 @@ void AsmPrinter::EmitLLVMUsedList(Constant *List) { for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) { const GlobalValue *GV = findGlobalValue(InitList->getOperand(i)); - if (GV) { - if (GV->hasInternalLinkage() && !isa<Function>(GV) && - ((strlen(TAI->getPrivateGlobalPrefix()) != 0 && - Mang->getValueName(GV) - .substr(0,strlen(TAI->getPrivateGlobalPrefix())) == - TAI->getPrivateGlobalPrefix()) || - (strlen(TAI->getLessPrivateGlobalPrefix()) != 0 && - Mang->getValueName(GV) - .substr(0,strlen(TAI->getLessPrivateGlobalPrefix())) == - TAI->getLessPrivateGlobalPrefix()))) - continue; + if (TAI->emitUsedDirectiveFor(GV, Mang)) { O << Directive; EmitConstantValueOnly(InitList->getOperand(i)); O << '\n'; |