[llvm-commits] CVS: llvm/include/llvm/CodeGen/DwarfWriter.h MachineDebugInfo.h

Jim Laskey jlaskey at apple.com
Thu Feb 23 08:58:31 PST 2006



Changes in directory llvm/include/llvm/CodeGen:

DwarfWriter.h updated: 1.24 -> 1.25
MachineDebugInfo.h updated: 1.17 -> 1.18
---
Log message:

DwarfWriter reading basic type information from llvm-gcc4 code.


---
Diffs of the changes:  (+82 -7)

 DwarfWriter.h      |   13 ++++++---
 MachineDebugInfo.h |   76 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 82 insertions(+), 7 deletions(-)


Index: llvm/include/llvm/CodeGen/DwarfWriter.h
diff -u llvm/include/llvm/CodeGen/DwarfWriter.h:1.24 llvm/include/llvm/CodeGen/DwarfWriter.h:1.25
--- llvm/include/llvm/CodeGen/DwarfWriter.h:1.24	Wed Feb 22 13:02:11 2006
+++ llvm/include/llvm/CodeGen/DwarfWriter.h	Thu Feb 23 10:58:18 2006
@@ -43,6 +43,7 @@
   class Module;
   class SubprogramDesc;
   class Type;
+  class TypeDesc;
   
   //===--------------------------------------------------------------------===//
   // DWLabel - Labels are used to track locations in the assembler file.
@@ -626,6 +627,14 @@
     void NewGlobalEntity(const std::string &Name, DIE *Entity);
 
 private:
+
+    /// NewType - Create a new type DIE.
+    ///
+    DIE *NewType(DIE *Unit, TypeDesc *TyDesc);
+    
+    /// NewCompileUnit - Create new compile unit DIE.
+    ///
+    DIE *NewCompileUnit(CompileUnitDesc *CompileUnit);
     
     /// NewGlobalVariable - Make a new global variable DIE.
     ///
@@ -635,10 +644,6 @@
     ///
     DIE *NewSubprogram(SubprogramDesc *SPD);
 
-    /// NewCompileUnit - Create new compile unit information.
-    ///
-    DIE *NewCompileUnit(CompileUnitDesc *CompileUnit);
-
     /// EmitInitial - Emit initial Dwarf declarations.
     ///
     void EmitInitial() const;


Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h
diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.17 llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.18
--- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.17	Wed Feb 22 13:02:11 2006
+++ llvm/include/llvm/CodeGen/MachineDebugInfo.h	Thu Feb 23 10:58:18 2006
@@ -61,7 +61,8 @@
   DI_TAG_anchor = 0,
   DI_TAG_compile_unit,
   DI_TAG_global_variable,
-  DI_TAG_subprogram
+  DI_TAG_subprogram,
+  DI_TAG_basictype
 };
 
 //===----------------------------------------------------------------------===//
@@ -80,6 +81,7 @@
   /// appropriate action for the type of field.
   virtual void Apply(int &Field) = 0;
   virtual void Apply(unsigned &Field) = 0;
+  virtual void Apply(uint64_t &Field) = 0;
   virtual void Apply(bool &Field) = 0;
   virtual void Apply(std::string &Field) = 0;
   virtual void Apply(DebugInfoDesc *&Field) = 0;
@@ -274,14 +276,80 @@
 };
 
 //===----------------------------------------------------------------------===//
+/// TypeDesc - This class packages debug information associated with a type.
+///
+class TypeDesc : public DebugInfoDesc {
+private:
+  DebugInfoDesc *Context;               // Context debug descriptor.
+  std::string Name;                     // Type name.
+  uint64_t Size;                        // Type size.
+
+protected:
+  TypeDesc(unsigned T);
+
+public:
+  // Accessors
+  DebugInfoDesc *getContext()                const { return Context; }
+  const std::string &getName()               const { return Name; }
+  uint64_t getSize()                         const { return Size; }
+  void setContext(DebugInfoDesc *C)                { Context = C; }
+  void setName(const std::string &N)               { Name = N; }
+  void setSize(uint64_t S)                         { Size = S; }
+  
+  /// ApplyToFields - Target the visitor to the fields of the  TypeDesc.
+  ///
+  virtual void ApplyToFields(DIVisitor *Visitor);
+
+  /// getDescString - Return a string used to compose global names and labels.
+  ///
+  virtual const char *getDescString() const;
+
+  /// getTypeString - Return a string used to label this descriptor's type.
+  ///
+  virtual const char *getTypeString() const;
+  
+#ifndef NDEBUG
+  virtual void dump();
+#endif
+};
+
+//===----------------------------------------------------------------------===//
+/// BasicTypeDesc - This class packages debug information associated with a
+/// basic type (eg. int, bool, double.)
+class BasicTypeDesc : public TypeDesc {
+private:
+  unsigned Encoding;                    // Type encoding.
+  
+public:
+  BasicTypeDesc();
+  
+  // Accessors
+  unsigned getEncoding()                     const { return Encoding; }
+  void setEncoding(unsigned E)                     { Encoding = E; }
+
+  // Implement isa/cast/dyncast.
+  static bool classof(const BasicTypeDesc *)  { return true; }
+  static bool classof(const DebugInfoDesc *D) {
+    return D->getTag() == DI_TAG_basictype;
+  }
+  
+  /// ApplyToFields - Target the visitor to the fields of the  BasicTypeDesc.
+  ///
+  virtual void ApplyToFields(DIVisitor *Visitor);
+
+#ifndef NDEBUG
+  virtual void dump();
+#endif
+};
+
+//===----------------------------------------------------------------------===//
 /// GlobalDesc - This class is the base descriptor for global functions and
 /// variables.
 class GlobalDesc : public AnchoredDesc {
 private:
   DebugInfoDesc *Context;               // Context debug descriptor.
   std::string Name;                     // Global name.
-  // FIXME - Use a descriptor.
-  GlobalVariable *TyDesc;               // Type debug descriptor.
+  TypeDesc *TyDesc;                     // Type debug descriptor.
   bool IsStatic;                        // Is the global a static.
   bool IsDefinition;                    // Is the global defined in context.
   
@@ -292,10 +360,12 @@
   // Accessors
   DebugInfoDesc *getContext()                const { return Context; }
   const std::string &getName()               const { return Name; }
+  TypeDesc *getTypeDesc()                    const { return TyDesc; }
   bool isStatic()                            const { return IsStatic; }
   bool isDefinition()                        const { return IsDefinition; }
   void setContext(DebugInfoDesc *C)                { Context = C; }
   void setName(const std::string &N)               { Name = N; }
+  void setTypeDesc(TypeDesc *T)                    { TyDesc = T; }
   void setIsStatic(bool IS)                        { IsStatic = IS; }
   void setIsDefinition(bool ID)                    { IsDefinition = ID; }
 






More information about the llvm-commits mailing list