diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-07-30 19:42:16 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-07-30 19:42:16 +0000 |
commit | f21434ccb0895e092ea2e219be8cd893f12a41f5 (patch) | |
tree | 4d93f213b45c1ababb662d31134ff0133a8fb696 /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
parent | d4779d5b2dcb50dd6d72ec9156d5a3aaa2106049 (diff) | |
download | bcm5719-llvm-f21434ccb0895e092ea2e219be8cd893f12a41f5.tar.gz bcm5719-llvm-f21434ccb0895e092ea2e219be8cd893f12a41f5.zip |
Refactor duplicated code.
llvm-svn: 214328
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 99179b6181b..7cbad1ec4a9 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -19,6 +19,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/JumpInstrTableInfo.h" +#include "llvm/CodeGen/Analysis.h" #include "llvm/CodeGen/GCMetadataPrinter.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineFrameInfo.h" @@ -49,7 +50,6 @@ #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetSubtargetInfo.h" -#include "llvm/Transforms/Utils/GlobalStatus.h" using namespace llvm; #define DEBUG_TYPE "asm-printer" @@ -253,32 +253,10 @@ bool AsmPrinter::doInitialization(Module &M) { } static bool canBeHidden(const GlobalValue *GV, const MCAsmInfo &MAI) { - if (!GV->hasLinkOnceODRLinkage()) - return false; - if (!MAI.hasWeakDefCanBeHiddenDirective()) return false; - if (GV->hasUnnamedAddr()) - return true; - - // This is only used for MachO, so right now it doesn't really matter how - // we handle alias. Revisit this once the MachO linker implements aliases. - if (isa<GlobalAlias>(GV)) - return false; - - // If it is a non constant variable, it needs to be uniqued across shared - // objects. - if (const GlobalVariable *Var = dyn_cast<GlobalVariable>(GV)) { - if (!Var->isConstant()) - return false; - } - - GlobalStatus GS; - if (!GlobalStatus::analyzeGlobal(GV, GS) && !GS.IsCompared) - return true; - - return false; + return canBeOmittedFromSymbolTable(GV); } void AsmPrinter::EmitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const { |