This patch is needed to make c++ exceptions work for mips16.
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfDebug.h
index 1125a94c4fc39c7d023d24ceafe340cad3a8bb12..738f117ad0b8d2e67499bb90cb1e38057cbc78a5 100644 (file)
@@ -188,6 +188,44 @@ public:
   DIType getType() const;
 };
 
+/// \brief Collects and handles information specific to a particular
+/// collection of units.
+class DwarfUnits {
+  // Target of Dwarf emission, used for sizing of abbreviations.
+  AsmPrinter *Asm;
+
+  // Used to uniquely define abbreviations.
+  FoldingSet<DIEAbbrev> *AbbreviationsSet;
+
+  // A list of all the unique abbreviations in use.
+  std::vector<DIEAbbrev *> *Abbreviations;
+
+  // A pointer to all units in the section.
+  SmallVector<CompileUnit *, 1> CUs;
+
+public:
+  DwarfUnits(AsmPrinter *AP, FoldingSet<DIEAbbrev> *AS,
+             std::vector<DIEAbbrev *> *A) :
+    Asm(AP), AbbreviationsSet(AS), Abbreviations(A) {}
+
+  /// \brief Compute the size and offset of a DIE given an incoming Offset.
+  unsigned computeSizeAndOffset(DIE *Die, unsigned Offset);
+
+  /// \brief Compute the size and offset of all the DIEs.
+  void computeSizeAndOffsets();
+
+  /// \brief Define a unique number for the abbreviation.
+  void assignAbbrevNumber(DIEAbbrev &Abbrev);
+
+  /// \brief Add a unit to the list of CUs.
+  void addUnit(CompileUnit *CU) { CUs.push_back(CU); }
+
+  /// \brief Emit all of the units to the section listed with the given
+  /// abbreviation section.
+  void emitUnits(DwarfDebug *, const MCSection *, const MCSection *,
+                 const MCSymbol *);
+};
+
 /// \brief Collects and handles dwarf debug information.
 class DwarfDebug {
   // Target of Dwarf emission.
@@ -309,30 +347,33 @@ class DwarfDebug {
   // table for the same directory as DW_at_comp_dir.
   StringRef CompilationDir;
 
+  // Counter for assigning globally unique IDs for CUs.
+  unsigned GlobalCUIndexCount;
+
+  // Holder for the file specific debug information.
+  DwarfUnits InfoHolder;
+
   // Holders for the various debug information flags that we might need to
   // have exposed. See accessor functions below for description.
-  bool IsDarwinGDBCompat;
 
-  // Counter for assigning globally unique IDs for CUs.
-  unsigned GlobalCUIndexCount;
+  // Whether or not we're emitting info for older versions of gdb on darwin.
+  bool IsDarwinGDBCompat;
 
   // DWARF5 Experimental Options
   bool HasDwarfAccelTables;
   bool HasSplitDwarf;
 
-  // Fission Variables
+  // Separated Dwarf Variables
   // In general these will all be for bits that are left in the
   // original object file, rather than things that are meant
   // to be in the .dwo sections.
 
-  // The CU left in the original object file for Fission debug info.
+  // The CU left in the original object file for separated debug info.
   CompileUnit *SkeletonCU;
+  DwarfUnits SkeletonHolder;
 
 private:
 
-  /// \brief Define a unique number for the abbreviation.
-  void assignAbbrevNumber(DIEAbbrev &Abbrev);
-
   void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
 
   /// \brief Find abstract variable associated with Var.
@@ -358,9 +399,6 @@ private:
   /// \brief Emit initial Dwarf sections with a label at the start of each one.
   void emitSectionLabels();
 
-  /// \brief Recursively Emits a debug information entry.
-  void emitDIE(DIE *Die);
-
   /// \brief Compute the size and offset of a DIE given an incoming Offset.
   unsigned computeSizeAndOffset(DIE *Die, unsigned Offset);
 
@@ -381,9 +419,6 @@ private:
   /// open.
   void endSections();
 
-  /// \brief Emit all of the compile units to the target section.
-  void emitCompileUnits(const MCSection *);
-
   /// \brief Emit the debug info section.
   void emitDebugInfo();
 
@@ -533,6 +568,9 @@ public:
   /// string text.
   MCSymbol *getStringPoolEntry(StringRef Str);
 
+  /// \brief Recursively Emits a debug information entry.
+  void emitDIE(DIE *Die);
+
   /// \brief Returns whether or not to limit some of our debug
   /// output to the limitations of darwin gdb.
   bool useDarwinGDBCompat() { return IsDarwinGDBCompat; }