From c33a744f0e8fc43deab7f4ce6aa3664cf911f589 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Wed, 9 Jul 2008 13:27:59 +0000 Subject: [PATCH] Use isWeakForLinker() hook git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53318 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/TargetAsmInfo.cpp | 8 ++------ lib/Target/X86/X86ATTAsmPrinter.cpp | 8 ++------ lib/Target/X86/X86TargetAsmInfo.cpp | 8 ++------ 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp index 483af129013..0c74d5ad606 100644 --- a/lib/Target/TargetAsmInfo.cpp +++ b/lib/Target/TargetAsmInfo.cpp @@ -228,9 +228,7 @@ TargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV, assert(0 && "Unexpected section kind!"); } - if (GV->hasLinkOnceLinkage() || - GV->hasWeakLinkage() || - GV->hasCommonLinkage()) + if (GV->isWeakForLinker()) Flags |= SectionFlags::Linkonce; } @@ -289,9 +287,7 @@ std::string TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { SectionKind::Kind Kind = SectionKindForGlobal(GV); - if (GV->hasLinkOnceLinkage() || - GV->hasWeakLinkage() || - GV->hasCommonLinkage()) + if (GV->isWeakForLinker()) return UniqueSectionForGlobal(GV, Kind); else { if (Kind == SectionKind::Text) diff --git a/lib/Target/X86/X86ATTAsmPrinter.cpp b/lib/Target/X86/X86ATTAsmPrinter.cpp index 0394b6c6cd8..0236e492888 100644 --- a/lib/Target/X86/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/X86ATTAsmPrinter.cpp @@ -399,10 +399,7 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo, if (shouldPrintStub(TM, Subtarget)) { // Link-once, declaration, or Weakly-linked global variables need // non-lazily-resolved stubs - if (GV->isDeclaration() || - GV->hasWeakLinkage() || - GV->hasLinkOnceLinkage() || - GV->hasCommonLinkage()) { + if (GV->isDeclaration() || GV->isWeakForLinker()) { // Dynamically-resolved functions need a stub for the function. if (isCallOp && isa(GV)) { FnStubs.insert(Name); @@ -802,8 +799,7 @@ void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { } if (!GVar->isThreadLocal() && - (GVar->hasInternalLinkage() || GVar->hasWeakLinkage() || - GVar->hasLinkOnceLinkage() || GVar->hasCommonLinkage())) { + (GVar->hasInternalLinkage() || GVar->isWeakForLinker())) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (TAI->getLCOMMDirective() != NULL) { diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp index 0fdc0eefbae..dd1bdb884ad 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -224,9 +224,7 @@ X86DarwinTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, std::string X86DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { SectionKind::Kind Kind = SectionKindForGlobal(GV); - bool isWeak = GV->hasWeakLinkage() || - GV->hasCommonLinkage() || - GV->hasLinkOnceLinkage(); + bool isWeak = GV->isWeakForLinker(); switch (Kind) { case SectionKind::Text: @@ -435,9 +433,7 @@ X86ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { return UniqueSectionForGlobal(F, kind); } } else if (const GlobalVariable *GVar = dyn_cast(GV)) { - if (GVar->hasCommonLinkage() || - GVar->hasLinkOnceLinkage() || - GVar->hasWeakLinkage()) + if (GVar->isWeakForLinker() return UniqueSectionForGlobal(GVar, kind); else { switch (kind) {