aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/MachineDebugInfo.cpp
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-03-01 20:39:36 +0000
committerJim Laskey <jlaskey@mac.com>2006-03-01 20:39:36 +0000
commit9c4447aa2b47f133ac3eac095adb3c375d33031e (patch)
treed85c32828908e53907652043a9aa94725c57b2ae /lib/CodeGen/MachineDebugInfo.cpp
parentb2742f4a2693510aa77d69f6e91fd8983e07680f (diff)
downloadexternal_llvm-9c4447aa2b47f133ac3eac095adb3c375d33031e.zip
external_llvm-9c4447aa2b47f133ac3eac095adb3c375d33031e.tar.gz
external_llvm-9c4447aa2b47f133ac3eac095adb3c375d33031e.tar.bz2
Switch back to using actual dwarf tags. Simplifies code without loss to other
debug forms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26455 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineDebugInfo.cpp')
-rw-r--r--lib/CodeGen/MachineDebugInfo.cpp124
1 files changed, 97 insertions, 27 deletions
diff --git a/lib/CodeGen/MachineDebugInfo.cpp b/lib/CodeGen/MachineDebugInfo.cpp
index 98d07d3..46163a7 100644
--- a/lib/CodeGen/MachineDebugInfo.cpp
+++ b/lib/CodeGen/MachineDebugInfo.cpp
@@ -20,6 +20,7 @@
#include <iostream>
using namespace llvm;
+using namespace llvm::dwarf;
// Handle the Pass registration stuff necessary to use TargetData's.
namespace {
@@ -492,29 +493,29 @@ public:
/// GlobalVariable.
unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) {
ConstantUInt *C = getUIntOperand(GV, 0);
- return C ? (unsigned)C->getValue() : (unsigned)DIInvalid;
+ return C ? (unsigned)C->getValue() : (unsigned)DW_TAG_invalid;
}
/// DescFactory - Create an instance of debug info descriptor based on Tag.
/// Return NULL if not a recognized Tag.
DebugInfoDesc *DebugInfoDesc::DescFactory(unsigned Tag) {
switch (Tag) {
- case DI_TAG_anchor: return new AnchorDesc();
- case DI_TAG_compile_unit: return new CompileUnitDesc();
- case DI_TAG_global_variable: return new GlobalVariableDesc();
- case DI_TAG_subprogram: return new SubprogramDesc();
- case DI_TAG_basictype: return new BasicTypeDesc();
- case DI_TAG_typedef:
- case DI_TAG_pointer:
- case DI_TAG_reference:
- case DI_TAG_const:
- case DI_TAG_volatile:
- case DI_TAG_restrict: return new DerivedTypeDesc(Tag);
- case DI_TAG_array:
- case DI_TAG_struct:
- case DI_TAG_union:
- case DI_TAG_enum: return new CompositeTypeDesc(Tag);
- case DI_TAG_subrange: return new SubrangeDesc();
+ case DW_TAG_anchor: return new AnchorDesc();
+ case DW_TAG_compile_unit: return new CompileUnitDesc();
+ case DW_TAG_variable: return new GlobalVariableDesc();
+ case DW_TAG_subprogram: return new SubprogramDesc();
+ case DW_TAG_base_type: return new BasicTypeDesc();
+ case DW_TAG_typedef:
+ case DW_TAG_pointer_type:
+ case DW_TAG_reference_type:
+ case DW_TAG_const_type:
+ case DW_TAG_volatile_type:
+ case DW_TAG_restrict_type: return new DerivedTypeDesc(Tag);
+ case DW_TAG_array_type:
+ case DW_TAG_structure_type:
+ case DW_TAG_union_type:
+ case DW_TAG_enumeration_type: return new CompositeTypeDesc(Tag);
+ case DW_TAG_subrange_type: return new SubrangeDesc();
default: break;
}
return NULL;
@@ -534,6 +535,20 @@ void DebugInfoDesc::ApplyToFields(DIVisitor *Visitor) {
//===----------------------------------------------------------------------===//
+AnchorDesc::AnchorDesc()
+: DebugInfoDesc(DW_TAG_anchor)
+, Name("")
+{}
+AnchorDesc::AnchorDesc(const std::string &N)
+: DebugInfoDesc(DW_TAG_anchor)
+, Name(N)
+{}
+
+// Implement isa/cast/dyncast.
+bool AnchorDesc::classof(const DebugInfoDesc *D) {
+ return D->getTag() == DW_TAG_anchor;
+}
+
/// getLinkage - get linkage appropriate for this type of descriptor.
///
GlobalValue::LinkageTypes AnchorDesc::getLinkage() const {
@@ -586,7 +601,7 @@ void AnchoredDesc::ApplyToFields(DIVisitor *Visitor) {
//===----------------------------------------------------------------------===//
CompileUnitDesc::CompileUnitDesc()
-: AnchoredDesc(DI_TAG_compile_unit)
+: AnchoredDesc(DW_TAG_compile_unit)
, DebugVersion(LLVMDebugVersion)
, Language(0)
, FileName("")
@@ -594,11 +609,16 @@ CompileUnitDesc::CompileUnitDesc()
, Producer("")
{}
+// Implement isa/cast/dyncast.
+bool CompileUnitDesc::classof(const DebugInfoDesc *D) {
+ return D->getTag() == DW_TAG_compile_unit;
+}
+
/// DebugVersionFromGlobal - Returns the version number from a compile unit
/// GlobalVariable.
unsigned CompileUnitDesc::DebugVersionFromGlobal(GlobalVariable *GV) {
ConstantUInt *C = getUIntOperand(GV, 2);
- return C ? (unsigned)C->getValue() : (unsigned)DIInvalid;
+ return C ? (unsigned)C->getValue() : (unsigned)DW_TAG_invalid;
}
/// ApplyToFields - Target the visitor to the fields of the CompileUnitDesc.
@@ -693,10 +713,15 @@ void TypeDesc::dump() {
//===----------------------------------------------------------------------===//
BasicTypeDesc::BasicTypeDesc()
-: TypeDesc(DI_TAG_basictype)
+: TypeDesc(DW_TAG_base_type)
, Encoding(0)
{}
+// Implement isa/cast/dyncast.
+bool BasicTypeDesc::classof(const DebugInfoDesc *D) {
+ return D->getTag() == DW_TAG_base_type;
+}
+
/// ApplyToFields - Target the visitor to the fields of the BasicTypeDesc.
///
void BasicTypeDesc::ApplyToFields(DIVisitor *Visitor) {
@@ -735,6 +760,22 @@ DerivedTypeDesc::DerivedTypeDesc(unsigned T)
, FromType(NULL)
{}
+// Implement isa/cast/dyncast.
+bool DerivedTypeDesc::classof(const DebugInfoDesc *D) {
+ unsigned T = D->getTag();
+ switch (T) {
+ case DW_TAG_typedef:
+ case DW_TAG_pointer_type:
+ case DW_TAG_reference_type:
+ case DW_TAG_const_type:
+ case DW_TAG_volatile_type:
+ case DW_TAG_restrict_type:
+ return true;
+ default: break;
+ }
+ return false;
+}
+
/// ApplyToFields - Target the visitor to the fields of the DerivedTypeDesc.
///
void DerivedTypeDesc::ApplyToFields(DIVisitor *Visitor) {
@@ -775,6 +816,20 @@ CompositeTypeDesc::CompositeTypeDesc(unsigned T)
, Elements()
{}
+// Implement isa/cast/dyncast.
+bool CompositeTypeDesc::classof(const DebugInfoDesc *D) {
+ unsigned T = D->getTag();
+ switch (T) {
+ case DW_TAG_array_type:
+ case DW_TAG_structure_type:
+ case DW_TAG_union_type:
+ case DW_TAG_enumeration_type:
+ return true;
+ default: break;
+ }
+ return false;
+}
+
/// ApplyToFields - Target the visitor to the fields of the CompositeTypeDesc.
///
void CompositeTypeDesc::ApplyToFields(DIVisitor *Visitor) {
@@ -812,11 +867,16 @@ void CompositeTypeDesc::dump() {
//===----------------------------------------------------------------------===//
SubrangeDesc::SubrangeDesc()
-: DebugInfoDesc(DI_TAG_subrange)
+: DebugInfoDesc(DW_TAG_subrange_type)
, Lo(0)
, Hi(0)
{}
+// Implement isa/cast/dyncast.
+bool SubrangeDesc::classof(const DebugInfoDesc *D) {
+ return D->getTag() == DW_TAG_subrange_type;
+}
+
/// ApplyToFields - Target the visitor to the fields of the SubrangeDesc.
///
void SubrangeDesc::ApplyToFields(DIVisitor *Visitor) {
@@ -873,10 +933,15 @@ void GlobalDesc::ApplyToFields(DIVisitor *Visitor) {
//===----------------------------------------------------------------------===//
GlobalVariableDesc::GlobalVariableDesc()
-: GlobalDesc(DI_TAG_global_variable)
+: GlobalDesc(DW_TAG_variable)
, Global(NULL)
{}
+// Implement isa/cast/dyncast.
+bool GlobalVariableDesc::classof(const DebugInfoDesc *D) {
+ return D->getTag() == DW_TAG_variable;
+}
+
/// ApplyToFields - Target the visitor to the fields of the GlobalVariableDesc.
///
void GlobalVariableDesc::ApplyToFields(DIVisitor *Visitor) {
@@ -921,9 +986,14 @@ void GlobalVariableDesc::dump() {
//===----------------------------------------------------------------------===//
SubprogramDesc::SubprogramDesc()
-: GlobalDesc(DI_TAG_subprogram)
+: GlobalDesc(DW_TAG_subprogram)
{}
+// Implement isa/cast/dyncast.
+bool SubprogramDesc::classof(const DebugInfoDesc *D) {
+ return D->getTag() == DW_TAG_subprogram;
+}
+
/// ApplyToFields - Target the visitor to the fields of the
/// SubprogramDesc.
void SubprogramDesc::ApplyToFields(DIVisitor *Visitor) {
@@ -977,7 +1047,7 @@ DebugInfoDesc *DIDeserializer::Deserialize(GlobalVariable *GV) {
unsigned Tag = DebugInfoDesc::TagFromGlobal(GV);
// Get the debug version if a compile unit.
- if (Tag == DI_TAG_compile_unit) {
+ if (Tag == DW_TAG_compile_unit) {
DebugVersion = CompileUnitDesc::DebugVersionFromGlobal(GV);
}
@@ -1123,12 +1193,12 @@ bool DIVerifier::Verify(GlobalVariable *GV) {
// Get the Tag
unsigned Tag = DebugInfoDesc::TagFromGlobal(GV);
- if (Tag == DIInvalid) return false;
+ if (Tag == DW_TAG_invalid) return false;
// If a compile unit we need the debug version.
- if (Tag == DI_TAG_compile_unit) {
+ if (Tag == DW_TAG_compile_unit) {
DebugVersion = CompileUnitDesc::DebugVersionFromGlobal(GV);
- if (DebugVersion == DIInvalid) return false;
+ if (DebugVersion == DW_TAG_invalid) return false;
}
// Construct an empty DebugInfoDesc.