diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-20 06:14:25 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-20 06:14:25 +0000 |
commit | 401e10c4fbfcdcfade5065093e2ca97f69a1d144 (patch) | |
tree | 831284f8410262eda3bfac6d33dfd150ad771249 /lib/CodeGen | |
parent | ba8dc03935fadb05d4d68f9913543df22487f523 (diff) |
implement a new magic global "llvm.compiler.used" which is like llvm.used, but
doesn't cause ".no_dead_strip" to be emitted on darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76399 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfException.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/MachineModuleInfo.cpp | 3 |
3 files changed, 5 insertions, 4 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index a2d154f1ee..80bdf04e8e 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -466,13 +466,13 @@ void AsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI, /// special global used by LLVM. If so, emit it and return true, otherwise /// do nothing and return false. bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) { - if (GV->getName() == "llvm.used") { + if (GV->isName("llvm.used")) { if (TAI->getUsedDirective() != 0) // No need to emit this at all. EmitLLVMUsedList(GV->getInitializer()); return true; } - // Ignore debug and non-emitted data. + // Ignore debug and non-emitted data. This handles llvm.compiler.used. if (GV->getSection() == "llvm.metadata" || GV->hasAvailableExternallyLinkage()) return true; diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp index 1af3b11846..fdec97ac6a 100644 --- a/lib/CodeGen/AsmPrinter/DwarfException.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp @@ -229,7 +229,7 @@ void DwarfException::EmitEHFrame(const FunctionEHFrameInfo &EHFrameInfo) { // retains the function in this case, and there is code around that depends // on unused functions (calling undefined externals) being dead-stripped to // link correctly. Yes, there really is. - if (MMI->getUsedFunctions().count(EHFrameInfo.function)) + if (MMI->isUsedFunction(EHFrameInfo.function)) if (const char *UsedDirective = TAI->getUsedDirective()) O << UsedDirective << EHFrameInfo.FnName << "\n\n"; } diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp index 66dd8375eb..20b819e823 100644 --- a/lib/CodeGen/MachineModuleInfo.cpp +++ b/lib/CodeGen/MachineModuleInfo.cpp @@ -88,7 +88,8 @@ void MachineModuleInfo::EndFunction() { /// AnalyzeModule - Scan the module for global debug information. /// void MachineModuleInfo::AnalyzeModule(Module &M) { - // Insert functions in the llvm.used array into UsedFunctions. + // Insert functions in the llvm.used array (but not llvm.compiler.used) into + // UsedFunctions. GlobalVariable *GV = M.getGlobalVariable("llvm.used"); if (!GV || !GV->hasInitializer()) return; |