Use isWeakForLinker() hook
authorAnton Korobeynikov <asl@math.spbu.ru>
Wed, 9 Jul 2008 13:27:59 +0000 (13:27 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Wed, 9 Jul 2008 13:27:59 +0000 (13:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53318 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/TargetAsmInfo.cpp
lib/Target/X86/X86ATTAsmPrinter.cpp
lib/Target/X86/X86TargetAsmInfo.cpp

index 483af129013f0601503e7392b693fbe9bbd0ea43..0c74d5ad606a999df2bd26c92fd4d1ec674c3ddd 100644 (file)
@@ -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)
index 0394b6c6cd8b6dadfcf4243d2d74208c32179384..0236e49288823a30a25274d2f08325c96e9f9a6b 100644 (file)
@@ -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<Function>(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) {
index 0fdc0eefbae3bf86286661814c7478f9f5487f77..dd1bdb884ad2062c05a4b22f46d6f5630db1a94b 100644 (file)
@@ -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<GlobalVariable>(GV)) {
-    if (GVar->hasCommonLinkage() ||
-        GVar->hasLinkOnceLinkage() ||
-        GVar->hasWeakLinkage())
+    if (GVar->isWeakForLinker()
       return UniqueSectionForGlobal(GVar, kind);
     else {
       switch (kind) {