add a note
[oota-llvm.git] / lib / Target / PIC16 / PIC16TargetObjectFile.h
index c296954dce3d6fdbc6d6a1f99e3aeb1efa0e0d4a..75f6cced0ab8221215fde9269fa7e4fa28eb600b 100644 (file)
 #define LLVM_TARGET_PIC16_TARGETOBJECTFILE_H
 
 #include "llvm/Target/TargetLoweringObjectFile.h"
+#include "llvm/ADT/StringMap.h"
 #include <vector>
+#include <string>
 
 namespace llvm {
   class GlobalVariable;
   class Module;
   class PIC16TargetMachine;
+  class MCSectionPIC16;
   
   enum { DataBankSize = 80 };
 
@@ -26,15 +29,15 @@ namespace llvm {
   /// again and printing only those that match the current section. 
   /// Keeping values inside the sections make printing a section much easier.
   ///
-  /// FIXME: Reimplement by inheriting from MCSection.
+  /// FIXME: MOVE ALL THIS STUFF TO MCSectionPIC16.
   ///
   struct PIC16Section {
-    const MCSection *S_; // Connection to actual Section.
+    const MCSectionPIC16 *S_; // Connection to actual Section.
     unsigned Size;  // Total size of the objects contained.
     bool SectionPrinted;
     std::vector<const GlobalVariable*> Items;
     
-    PIC16Section(const MCSection *s) {
+    PIC16Section(const MCSectionPIC16 *s) {
       S_ = s;
       Size = 0;
       SectionPrinted = false;
@@ -44,7 +47,15 @@ namespace llvm {
   };
   
   class PIC16TargetObjectFile : public TargetLoweringObjectFile {
+    /// SectionsByName - Bindings of names to allocated sections.
+    mutable StringMap<MCSectionPIC16*> SectionsByName;
+
     const TargetMachine *TM;
+    
+    const MCSectionPIC16 *getPIC16Section(const char *Name,
+                                          SectionKind K, 
+                                          int Address = -1, 
+                                          int Color = -1) const;
   public:
     mutable std::vector<PIC16Section*> BSSSections;
     mutable std::vector<PIC16Section*> IDATASections;
@@ -52,21 +63,26 @@ namespace llvm {
     mutable std::vector<PIC16Section*> ROSections;
     mutable PIC16Section *ExternalVarDecls;
     mutable PIC16Section *ExternalVarDefs;
-    
+
+    PIC16TargetObjectFile();
     ~PIC16TargetObjectFile();
     
     void Initialize(MCContext &Ctx, const TargetMachine &TM);
 
     
-    /// getSpecialCasedSectionGlobals - Allow the target to completely override
-    /// section assignment of a global.
     virtual const MCSection *
-    getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang,
-                                  SectionKind Kind) const;
+    getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, 
+                             Mangler *Mang, const TargetMachine &TM) const;
+    
     virtual const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
                                                     SectionKind Kind,
                                                     Mangler *Mang,
                                                     const TargetMachine&) const;
+
+    const MCSection *getSectionForFunction(const std::string &FnName) const;
+    const MCSection *getSectionForFunctionFrame(const std::string &FnName)const;
+    
+    
   private:
     std::string getSectionNameForSym(const std::string &Sym) const;