[llvm-commits] [llvm] r78496 - in /llvm/trunk/lib/Target/PIC16: PIC16TargetObjectFile.cpp PIC16TargetObjectFile.h

Chris Lattner sabre at nondot.org
Sat Aug 8 13:23:48 PDT 2009


Author: lattner
Date: Sat Aug  8 15:23:47 2009
New Revision: 78496

URL: http://llvm.org/viewvc/llvm-project?rev=78496&view=rev
Log:
give pic16 a target-specific section creation name too

Modified:
    llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp
    llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h

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

==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp Sat Aug  8 15:23:47 2009
@@ -21,7 +21,7 @@
 }
 
 const MCSection *PIC16TargetObjectFile::
-getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
+getPIC16Section(const char *Name, bool isDirective, SectionKind Kind) const {
   if (MCSection *S = getContext().GetSection(Name))
     return S;
   return MCSection::Create(Name, isDirective, Kind, getContext());
@@ -32,40 +32,39 @@
   TargetLoweringObjectFile::Initialize(Ctx, tm);
   TM = &tm;
   
-  BSSSection = getOrCreateSection("udata.# UDATA", false, 
-                                  SectionKind::getBSS());
-  ReadOnlySection = getOrCreateSection("romdata.# ROMDATA", false,
-                                       SectionKind::getReadOnly());
-  DataSection = getOrCreateSection("idata.# IDATA", false,
-                                   SectionKind::getDataRel());
+  BSSSection = getPIC16Section("udata.# UDATA", false, 
+                               SectionKind::getBSS());
+  ReadOnlySection = getPIC16Section("romdata.# ROMDATA", false,
+                                    SectionKind::getReadOnly());
+  DataSection = getPIC16Section("idata.# IDATA", false,
+                                SectionKind::getDataRel());
   
   // Need because otherwise a .text symbol is emitted by DwarfWriter
   // in BeginModule, and gpasm cribbs for that .text symbol.
-  TextSection = getOrCreateSection("", true,
-                                   SectionKind::getText());
+  TextSection = getPIC16Section("", true, SectionKind::getText());
 
   ROSections.push_back(new PIC16Section(ReadOnlySection));
   
   // FIXME: I don't know what the classification of these sections really is.
-  ExternalVarDecls = new PIC16Section(getOrCreateSection("ExternalVarDecls",
-                                                         false,
+  ExternalVarDecls = new PIC16Section(getPIC16Section("ExternalVarDecls",
+                                                      false,
                                       SectionKind::getMetadata()));
-  ExternalVarDefs = new PIC16Section(getOrCreateSection("ExternalVarDefs",
-                                                        false,
+  ExternalVarDefs = new PIC16Section(getPIC16Section("ExternalVarDefs",
+                                                     false,
                                       SectionKind::getMetadata()));
 }
 
 const MCSection *PIC16TargetObjectFile::
 getSectionForFunction(const std::string &FnName) const {
   std::string T = PAN::getCodeSectionName(FnName);
-  return getOrCreateSection(T.c_str(), false, SectionKind::getText());
+  return getPIC16Section(T.c_str(), false, SectionKind::getText());
 }
 
 
 const MCSection *PIC16TargetObjectFile::
 getSectionForFunctionFrame(const std::string &FnName) const {
   std::string T = PAN::getFrameSectionName(FnName);
-  return getOrCreateSection(T.c_str(), false, SectionKind::getDataRel());
+  return getPIC16Section(T.c_str(), false, SectionKind::getDataRel());
 }
 
 const MCSection *
@@ -92,9 +91,9 @@
   // No BSS section spacious enough was found. Crate a new one.
   if (!FoundBSS) {
     std::string name = PAN::getUdataSectionName(BSSSections.size());
-    const MCSection *NewSection = getOrCreateSection(name.c_str(), false,
-                                                     // FIXME.
-                                                    SectionKind::getMetadata());
+    const MCSection *NewSection = getPIC16Section(name.c_str(), false,
+                                                  // FIXME.
+                                                  SectionKind::getMetadata());
 
     FoundBSS = new PIC16Section(NewSection);
 
@@ -134,9 +133,9 @@
   // No IDATA section spacious enough was found. Crate a new one.
   if (!FoundIDATA) {
     std::string name = PAN::getIdataSectionName(IDATASections.size());
-    const MCSection *NewSection = getOrCreateSection(name.c_str(), false,
-                                                   // FIXME.
-                                                    SectionKind::getMetadata());
+    const MCSection *NewSection = getPIC16Section(name.c_str(), false,
+                                                  // FIXME.
+                                                  SectionKind::getMetadata());
 
     FoundIDATA = new PIC16Section(NewSection);
 
@@ -169,9 +168,9 @@
 
   // No Auto section was found. Crate a new one.
   if (!FoundAutoSec) {
-    const MCSection *NewSection = getOrCreateSection(name.c_str(),
-                                                     // FIXME.
-                                                     false,
+    const MCSection *NewSection = getPIC16Section(name.c_str(),
+                                                  // FIXME.
+                                                  false,
                                        SectionKind::getMetadata());
 
     FoundAutoSec = new PIC16Section(NewSection);
@@ -270,7 +269,7 @@
     return CreateSectionForGlobal(GVar, Mang);
   }
 
-  return getOrCreateSection(GV->getSection().c_str(), false, Kind);
+  return getPIC16Section(GV->getSection().c_str(), false, Kind);
 }
 
 // Create a new section for global variable. If Addr is given then create
@@ -322,8 +321,8 @@
   
   PIC16Section *NewBSS = FoundBSS;
   if (NewBSS == NULL) {
-    const MCSection *NewSection = getOrCreateSection(Name.c_str(), false,
-                                            SectionKind::getBSS());
+    const MCSection *NewSection = getPIC16Section(Name.c_str(), false,
+                                                  SectionKind::getBSS());
     NewBSS = new PIC16Section(NewSection);
     BSSSections.push_back(NewBSS);
   }
@@ -374,9 +373,9 @@
 
   PIC16Section *NewIDATASec = FoundIDATASec;
   if (NewIDATASec == NULL) {
-    const MCSection *NewSection = getOrCreateSection(Name.c_str(), false,
-                                                   // FIXME:
-                                       SectionKind::getMetadata());
+    const MCSection *NewSection = getPIC16Section(Name.c_str(), false,
+                                                  // FIXME:
+                                                  SectionKind::getMetadata());
     NewIDATASec = new PIC16Section(NewSection);
     IDATASections.push_back(NewIDATASec);
   }
@@ -414,8 +413,8 @@
 
   PIC16Section *NewRomSec = FoundROSec;
   if (NewRomSec == NULL) {
-    const MCSection *NewSection = getOrCreateSection(Name.c_str(), false,
-                                       SectionKind::getReadOnly());
+    const MCSection *NewSection = getPIC16Section(Name.c_str(), false,
+                                                  SectionKind::getReadOnly());
     NewRomSec = new PIC16Section(NewSection);
     ROSections.push_back(NewRomSec);
   }

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

==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h Sat Aug  8 15:23:47 2009
@@ -46,9 +46,8 @@
   class PIC16TargetObjectFile : public TargetLoweringObjectFile {
     const TargetMachine *TM;
     
-    const MCSection *getOrCreateSection(const char *Name,
-                                        bool isDirective,
-                                        SectionKind K) const;
+    const MCSection *getPIC16Section(const char *Name, bool isDirective,
+                                     SectionKind K) const;
   public:
     mutable std::vector<PIC16Section*> BSSSections;
     mutable std::vector<PIC16Section*> IDATASections;





More information about the llvm-commits mailing list