we already know the sectionkind when invoking SelectSectionForGlobal,
authorChris Lattner <sabre@nondot.org>
Fri, 24 Jul 2009 18:42:53 +0000 (18:42 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 24 Jul 2009 18:42:53 +0000 (18:42 +0000)
pass it in instead of recomputing it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76990 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/DarwinTargetAsmInfo.h
include/llvm/Target/ELFTargetAsmInfo.h
include/llvm/Target/TargetAsmInfo.h
lib/Target/DarwinTargetAsmInfo.cpp
lib/Target/ELFTargetAsmInfo.cpp
lib/Target/PIC16/PIC16TargetAsmInfo.cpp
lib/Target/PIC16/PIC16TargetAsmInfo.h
lib/Target/TargetAsmInfo.cpp

index 082acbfe378202d7ecb157e4c3bb7111f8bebd69..e1662dd869009f83f0e09390ff590caacdb06e97 100644 (file)
@@ -34,7 +34,8 @@ namespace llvm {
     const Section* SixteenByteConstantSection;
 
     explicit DarwinTargetAsmInfo(const TargetMachine &TM);
-    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
+    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
+                                                  SectionKind::Kind Kind) const;
     virtual bool emitUsedDirectiveFor(const GlobalValue *GV,
                                       Mangler *Mang) const;
 
index 65a919af690a99a3e71c762f00594bb29df91e07..63e3acd50d780238f8b3bc024159fd3fbb3889ea 100644 (file)
@@ -38,7 +38,8 @@ namespace llvm {
     virtual unsigned getFlagsForNamedSection(const char *Section) const;
     
     SectionKind::Kind SectionKindForGlobal(const GlobalValue *GV) const;
-    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
+    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
+                                                  SectionKind::Kind Kind) const;
     virtual std::string printSectionFlags(unsigned flags) const;
 
     const Section* DataRelSection;
index 419f5fbe62908af339468a0297fe23d7501c7f1b..a34911691a8ec6583111cef5e696102e7a0f1cb9 100644 (file)
@@ -619,7 +619,8 @@ namespace llvm {
     virtual std::string printSectionFlags(unsigned flags) const { return ""; }
 
 // FIXME: Eliminate this.
-    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
+    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
+                                                  SectionKind::Kind Kind) const;
 
     /// getSLEB128Size - Compute the number of bytes required for a signed
     /// leb128 value.
index c25040ca6004e04d0651661bd2c8cc1c8a2c97ae..27714f21ea0009e628824ebabd85c52fcb5d4408 100644 (file)
@@ -125,8 +125,8 @@ bool DarwinTargetAsmInfo::emitUsedDirectiveFor(const GlobalValue* GV,
 }
 
 const Section*
-DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
-  SectionKind::Kind Kind = SectionKindForGlobal(GV);
+DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV,
+                                            SectionKind::Kind Kind) const {
   bool isWeak = GV->isWeakForLinker();
   bool isNonStatic = TM.getRelocationModel() != Reloc::Static;
 
index 6ab9efb4899d6491e5fac01f4529f7600d0e6f6d..40b766294f0c86113c9402b768502924118092a0 100644 (file)
@@ -74,9 +74,8 @@ ELFTargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
 }
 
 const Section*
-ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
-  SectionKind::Kind Kind = SectionKindForGlobal(GV);
-
+ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV,
+                                         SectionKind::Kind Kind) const {
   if (const Function *F = dyn_cast<Function>(GV)) {
     switch (F->getLinkage()) {
     default: llvm_unreachable("Unknown linkage type!");
index fedb0b82ca3a290e186d77d8dc9e9f5cf3a14182..6f4b0c5c8d859bd7a389059611bd46f703cf97dc 100644 (file)
@@ -186,14 +186,15 @@ PIC16TargetAsmInfo::getSectionForAuto(const GlobalVariable *GV) const {
 // Override default implementation to put the true globals into
 // multiple data sections if required.
 const Section*
-PIC16TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV1) const {
+PIC16TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV1,
+                                           SectionKind::Kind Kind) const {
   // We select the section based on the initializer here, so it really
   // has to be a GlobalVariable.
   const GlobalVariable *GV = dyn_cast<GlobalVariable>(GV1); 
   if (!GV)
-    return TargetAsmInfo::SelectSectionForGlobal(GV1);
+    return TargetAsmInfo::SelectSectionForGlobal(GV1, Kind);
 
-  // Record Exteranl Var Decls.
+  // Record External Var Decls.
   if (GV->isDeclaration()) {
     ExternalVarDecls->Items.push_back(GV);
     return ExternalVarDecls->S_;
@@ -225,7 +226,7 @@ PIC16TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV1) const {
     return getROSectionForGlobal(GV);
 
   // Else let the default implementation take care of it.
-  return TargetAsmInfo::SelectSectionForGlobal(GV);
+  return TargetAsmInfo::SelectSectionForGlobal(GV, Kind);
 }
 
 PIC16TargetAsmInfo::~PIC16TargetAsmInfo() {
index 9b934b039d9598c628f0e3d9843511b97d393792..d9259aa6d452c45b2a41b9d431144aa6c9bc04c9 100644 (file)
@@ -74,7 +74,8 @@ namespace llvm {
     const Section *getROSectionForGlobal(const GlobalVariable *GV) const;
     const Section *CreateROSectionForGlobal(const GlobalVariable *GV,
                                             std::string Addr = "") const;
-    virtual const Section *SelectSectionForGlobal(const GlobalValue *GV) const;
+    virtual const Section *SelectSectionForGlobal(const GlobalValue *GV,
+                                                  SectionKind::Kind Kind) const;
     const Section *CreateSectionForGlobal(const GlobalVariable *GV,
                                           const std::string &Addr = "") const;
   public:
index 1ed9a716b4dcf3eebc5da836cc82b889f10debc2..9893bf9b7aa618f994d7b0cb83c1ac2b2c2e5753 100644 (file)
@@ -300,14 +300,13 @@ const Section *TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
   }
   
   // Use default section depending on the 'type' of global
-  return SelectSectionForGlobal(GV);
+  return SelectSectionForGlobal(GV, Kind);
 }
 
 // Lame default implementation. Calculate the section name for global.
 const Section*
-TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
-  SectionKind::Kind Kind = SectionKindForGlobal(GV);
-
+TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV,
+                                      SectionKind::Kind Kind) const {
   if (Kind == SectionKind::Text)
     return getTextSection();