[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp MachineDebugInfo.cpp

Jim Laskey jlaskey at apple.com
Fri Jun 16 06:14:28 PDT 2006



Changes in directory llvm/lib/CodeGen:

DwarfWriter.cpp updated: 1.62 -> 1.63
MachineDebugInfo.cpp updated: 1.41 -> 1.42
---
Log message:

1. Revise vector debug support.

2. Update docs for vector debug support and new version control.

3. Simplify serialization of DebugDescInfo subclasses.


---
Diffs of the changes:  (+24 -35)

 DwarfWriter.cpp      |   16 +++++++++-------
 MachineDebugInfo.cpp |   43 +++++++++++++++----------------------------
 2 files changed, 24 insertions(+), 35 deletions(-)


Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.62 llvm/lib/CodeGen/DwarfWriter.cpp:1.63
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.62	Thu Jun 15 15:51:43 2006
+++ llvm/lib/CodeGen/DwarfWriter.cpp	Fri Jun 16 08:14:03 2006
@@ -1276,11 +1276,18 @@
                      NewType(Context, FromTy, Unit));
     }
   } else if (CompositeTypeDesc *CompTy = dyn_cast<CompositeTypeDesc>(TyDesc)) {
+    // Fetch tag
+    unsigned Tag = CompTy->getTag();
+    
     // Create specific DIE.
-    Slot = Ty = new DIE(CompTy->getTag());
+    Slot = Ty = Tag == DW_TAG_vector_type ? new DIE(DW_TAG_array_type) :
+                                            new DIE(Tag);
+    
     std::vector<DebugInfoDesc *> &Elements = CompTy->getElements();
     
-    switch (CompTy->getTag()) {
+    switch (Tag) {
+    case DW_TAG_vector_type: Ty->AddUInt(DW_AT_GNU_vector, DW_FORM_flag, 1);
+      // Fall thru
     case DW_TAG_array_type: {
       // Add element type.
       if (TypeDesc *FromTy = CompTy->getFromType()) {
@@ -1288,11 +1295,6 @@
                        NewType(Context, FromTy, Unit));
       }
       
-      // check for vector type
-      if (CompTy->isVector()) {
-        Ty->AddUInt(DW_AT_GNU_vector, DW_FORM_flag, 1);
-      }
-      
       // Don't emit size attribute.
       Size = 0;
       


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.41 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.42
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.41	Thu Jun 15 15:51:43 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp	Fri Jun 16 08:14:03 2006
@@ -459,7 +459,8 @@
 /// GlobalVariable.   Return DIIValid if operand is not an unsigned int. 
 unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) {
   ConstantUInt *C = getUIntOperand(GV, 0);
-  return C ? ((unsigned)C->getValue() & tag_mask) : (unsigned)DW_TAG_invalid;
+  return C ? ((unsigned)C->getValue() & ~LLVMDebugVersionMask) :
+             (unsigned)DW_TAG_invalid;
 }
 
 /// VersionFromGlobal - Returns the version number from a debug info
@@ -467,7 +468,7 @@
 /// int.
 unsigned  DebugInfoDesc::VersionFromGlobal(GlobalVariable *GV) {
   ConstantUInt *C = getUIntOperand(GV, 0);
-  return C ? ((unsigned)C->getValue() >> version_shift) :
+  return C ? ((unsigned)C->getValue() & LLVMDebugVersionMask) :
              (unsigned)DW_TAG_invalid;
 }
 
@@ -491,7 +492,8 @@
   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_enumeration_type:
+  case DW_TAG_vector_type:      return new CompositeTypeDesc(Tag);
   case DW_TAG_subrange_type:    return new SubrangeDesc();
   case DW_TAG_enumerator:       return new EnumeratorDesc();
   case DW_TAG_return_variable:
@@ -590,9 +592,7 @@
 void AnchoredDesc::ApplyToFields(DIVisitor *Visitor) {
   DebugInfoDesc::ApplyToFields(Visitor);
 
-  DebugInfoDesc *Tmp = Anchor;
-  Visitor->Apply(Tmp);
-  Anchor = (AnchorDesc*)Tmp;
+  Visitor->Apply(Anchor);
 }
 
 //===----------------------------------------------------------------------===//
@@ -673,9 +673,7 @@
   
   Visitor->Apply(Context);
   Visitor->Apply(Name);
-  DebugInfoDesc* Tmp = File;
-  Visitor->Apply(Tmp);
-  File = (CompileUnitDesc*)Tmp;
+  Visitor->Apply(File);
   Visitor->Apply(Line);
   Visitor->Apply(Size);
   Visitor->Apply(Align);
@@ -782,9 +780,7 @@
 void DerivedTypeDesc::ApplyToFields(DIVisitor *Visitor) {
   TypeDesc::ApplyToFields(Visitor);
   
-  DebugInfoDesc* Tmp = FromType;
-  Visitor->Apply(Tmp);
-  FromType = (TypeDesc*)Tmp;
+  Visitor->Apply(FromType);
 }
 
 /// getDescString - Return a string used to compose global names and labels.
@@ -817,7 +813,6 @@
 
 CompositeTypeDesc::CompositeTypeDesc(unsigned T)
 : DerivedTypeDesc(T)
-, IsVector(false)
 , Elements()
 {}
   
@@ -829,6 +824,7 @@
   case DW_TAG_structure_type:
   case DW_TAG_union_type:
   case DW_TAG_enumeration_type:
+  case DW_TAG_vector_type:
     return true;
   default: break;
   }
@@ -838,9 +834,8 @@
 /// ApplyToFields - Target the visitor to the fields of the CompositeTypeDesc.
 ///
 void CompositeTypeDesc::ApplyToFields(DIVisitor *Visitor) {
-  DerivedTypeDesc::ApplyToFields(Visitor);
-  
-  Visitor->Apply(IsVector);
+  DerivedTypeDesc::ApplyToFields(Visitor);  
+
   Visitor->Apply(Elements);
 }
 
@@ -990,13 +985,9 @@
   
   Visitor->Apply(Context);
   Visitor->Apply(Name);
-  DebugInfoDesc* Tmp1 = File;
-  Visitor->Apply(Tmp1);
-  File = (CompileUnitDesc*)Tmp1;
+  Visitor->Apply(File);
   Visitor->Apply(Line);
-  DebugInfoDesc* Tmp2 = TyDesc;
-  Visitor->Apply(Tmp2);
-  TyDesc = (TypeDesc*)Tmp2;
+  Visitor->Apply(TyDesc);
 }
 
 /// getDescString - Return a string used to compose global names and labels.
@@ -1044,13 +1035,9 @@
 
   Visitor->Apply(Context);
   Visitor->Apply(Name);
-  DebugInfoDesc* Tmp1 = File;
-  Visitor->Apply(Tmp1);
-  File = (CompileUnitDesc*)Tmp1;
+  Visitor->Apply(File);
   Visitor->Apply(Line);
-  DebugInfoDesc* Tmp2 = TyDesc;
-  Visitor->Apply(Tmp2);
-  TyDesc = (TypeDesc*)Tmp2;
+  Visitor->Apply(TyDesc);
   Visitor->Apply(IsStatic);
   Visitor->Apply(IsDefinition);
 }






More information about the llvm-commits mailing list