add a note
[oota-llvm.git] / lib / Target / PIC16 / PIC16TargetObjectFile.h
index b71a7050a71904a0549300a27fe2596243675f02..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,11 +47,15 @@ namespace llvm {
   };
   
   class PIC16TargetObjectFile : public TargetLoweringObjectFile {
+    /// SectionsByName - Bindings of names to allocated sections.
+    mutable StringMap<MCSectionPIC16*> SectionsByName;
+
     const TargetMachine *TM;
     
-    const MCSection *getOrCreateSection(const char *Name,
-                                        bool isDirective,
-                                        SectionKind K) const;
+    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;