aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-02-23 16:58:18 +0000
committerJim Laskey <jlaskey@mac.com>2006-02-23 16:58:18 +0000
commitf4afdd9f413c472e5785355f0d69847eaf729192 (patch)
tree14c0603e75177e28318cb17d6b4a00765ec58956 /include
parent7718658064a67b23403a96e5c1d309a338966b41 (diff)
downloadexternal_llvm-f4afdd9f413c472e5785355f0d69847eaf729192.zip
external_llvm-f4afdd9f413c472e5785355f0d69847eaf729192.tar.gz
external_llvm-f4afdd9f413c472e5785355f0d69847eaf729192.tar.bz2
DwarfWriter reading basic type information from llvm-gcc4 code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26331 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/DwarfWriter.h13
-rw-r--r--include/llvm/CodeGen/MachineDebugInfo.h76
2 files changed, 82 insertions, 7 deletions
diff --git a/include/llvm/CodeGen/DwarfWriter.h b/include/llvm/CodeGen/DwarfWriter.h
index 5fbc8d9..b995300 100644
--- a/include/llvm/CodeGen/DwarfWriter.h
+++ b/include/llvm/CodeGen/DwarfWriter.h
@@ -43,6 +43,7 @@ namespace llvm {
class Module;
class SubprogramDesc;
class Type;
+ class TypeDesc;
//===--------------------------------------------------------------------===//
// DWLabel - Labels are used to track locations in the assembler file.
@@ -626,6 +627,14 @@ public:
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 @@ private:
///
DIE *NewSubprogram(SubprogramDesc *SPD);
- /// NewCompileUnit - Create new compile unit information.
- ///
- DIE *NewCompileUnit(CompileUnitDesc *CompileUnit);
-
/// EmitInitial - Emit initial Dwarf declarations.
///
void EmitInitial() const;
diff --git a/include/llvm/CodeGen/MachineDebugInfo.h b/include/llvm/CodeGen/MachineDebugInfo.h
index 60eebd9..c51b3ea 100644
--- a/include/llvm/CodeGen/MachineDebugInfo.h
+++ b/include/llvm/CodeGen/MachineDebugInfo.h
@@ -61,7 +61,8 @@ enum {
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 @@ public:
/// 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 @@ public:
};
//===----------------------------------------------------------------------===//
+/// 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 @@ public:
// 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; }