simplify SectionFlagsForGlobal, even though I want to kill it.
authorChris Lattner <sabre@nondot.org>
Sun, 26 Jul 2009 07:17:39 +0000 (07:17 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 26 Jul 2009 07:17:39 +0000 (07:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77143 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/TargetAsmInfo.cpp

index bde119dedc74948ac2511d0cc02dbf7ad8a196a8..b0aeff6f84a8983ab74ff3773637c1ea56c00021 100644 (file)
@@ -199,11 +199,10 @@ static bool isConstantString(const Constant *C) {
   return false;
 }
 
-static unsigned SectionFlagsForGlobal(const GlobalValue *GV,
-                                      SectionKind Kind) {
+static unsigned SectionFlagsForGlobal(SectionKind Kind) {
   // Decode flags from global and section kind.
   unsigned Flags = SectionFlags::None;
-  if (GV->isWeakForLinker())
+  if (Kind.isWeak())
     Flags |= SectionFlags::Linkonce;
   if (Kind.isBSS() || Kind.isThreadBSS())
     Flags |= SectionFlags::BSS;
@@ -328,7 +327,7 @@ const Section *TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
       return TS;
     
     // Honour section already set, if any.
-    unsigned Flags = SectionFlagsForGlobal(GV, Kind);
+    unsigned Flags = SectionFlagsForGlobal(Kind);
 
     // This is an explicitly named section.
     Flags |= SectionFlags::Named;
@@ -343,9 +342,9 @@ const Section *TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
 
   // If this global is linkonce/weak and the target handles this by emitting it
   // into a 'uniqued' section name, create and return the section now.
-  if (GV->isWeakForLinker()) {
+  if (Kind.isWeak()) {
     if (const char *Prefix = getSectionPrefixForUniqueGlobal(Kind)) {
-      unsigned Flags = SectionFlagsForGlobal(GV, Kind);
+      unsigned Flags = SectionFlagsForGlobal(Kind);
 
       // FIXME: Use mangler interface (PR4584).
       std::string Name = Prefix+GV->getNameStr();