[llvm-commits] [llvm] r76990 - in /llvm/trunk: 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

Chris Lattner sabre at nondot.org
Fri Jul 24 11:42:54 PDT 2009


Author: lattner
Date: Fri Jul 24 13:42:53 2009
New Revision: 76990

URL: http://llvm.org/viewvc/llvm-project?rev=76990&view=rev
Log:
we already know the sectionkind when invoking SelectSectionForGlobal,
pass it in instead of recomputing it.

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

Modified: llvm/trunk/include/llvm/Target/DarwinTargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/DarwinTargetAsmInfo.h?rev=76990&r1=76989&r2=76990&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/DarwinTargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/DarwinTargetAsmInfo.h Fri Jul 24 13:42:53 2009
@@ -34,7 +34,8 @@
     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;
 

Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h?rev=76990&r1=76989&r2=76990&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h Fri Jul 24 13:42:53 2009
@@ -38,7 +38,8 @@
     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;

Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=76990&r1=76989&r2=76990&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Fri Jul 24 13:42:53 2009
@@ -619,7 +619,8 @@
     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.

Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=76990&r1=76989&r2=76990&view=diff

==============================================================================
--- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Fri Jul 24 13:42:53 2009
@@ -125,8 +125,8 @@
 }
 
 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;
 

Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=76990&r1=76989&r2=76990&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Fri Jul 24 13:42:53 2009
@@ -74,9 +74,8 @@
 }
 
 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!");

Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp?rev=76990&r1=76989&r2=76990&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp Fri Jul 24 13:42:53 2009
@@ -186,14 +186,15 @@
 // 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 @@
     return getROSectionForGlobal(GV);
 
   // Else let the default implementation take care of it.
-  return TargetAsmInfo::SelectSectionForGlobal(GV);
+  return TargetAsmInfo::SelectSectionForGlobal(GV, Kind);
 }
 
 PIC16TargetAsmInfo::~PIC16TargetAsmInfo() {

Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h?rev=76990&r1=76989&r2=76990&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h Fri Jul 24 13:42:53 2009
@@ -74,7 +74,8 @@
     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:

Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=76990&r1=76989&r2=76990&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Fri Jul 24 13:42:53 2009
@@ -300,14 +300,13 @@
   }
   
   // 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();
   





More information about the llvm-commits mailing list