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

Jim Laskey jlaskey at apple.com
Wed Jun 14 07:45:51 PDT 2006



Changes in directory llvm/include/llvm/CodeGen:

MachineDebugInfo.h updated: 1.33 -> 1.34
---
Log message:

Change versioning to per debug info descriptor (merged with tag.)



---
Diffs of the changes:  (+21 -26)

 MachineDebugInfo.h |   47 +++++++++++++++++++++--------------------------
 1 files changed, 21 insertions(+), 26 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h
diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.33 llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.34
--- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.33	Fri Apr  7 11:34:45 2006
+++ llvm/include/llvm/CodeGen/MachineDebugInfo.h	Wed Jun 14 09:45:39 2006
@@ -90,23 +90,35 @@
 ///
 class DebugInfoDesc {
 private:
+  enum {
+    tag_mask = 0x0000ffff,
+    version_shift = 16
+  };
+
+
   unsigned Tag;                         // Content indicator.  Dwarf values are
                                         // used but that does not limit use to
                                         // Dwarf writers.
   
 protected:
-  DebugInfoDesc(unsigned T) : Tag(T) {}
+  DebugInfoDesc(unsigned T) : Tag(T | (LLVMDebugVersion << version_shift)) {}
   
 public:
   virtual ~DebugInfoDesc() {}
 
   // Accessors
-  unsigned getTag()          const { return Tag; }
+  unsigned getTag()          const { return Tag & tag_mask; }
+  unsigned getVersion()      const { return Tag >> version_shift; }
   
-  /// TagFromGlobal - Returns the Tag number from a debug info descriptor
-  /// GlobalVariable.  Return DIIValid if operand is not an unsigned int.
+  /// TagFromGlobal - Returns the tag number from a debug info descriptor
+  /// GlobalVariable.   Return DIIValid if operand is not an unsigned int. 
   static unsigned TagFromGlobal(GlobalVariable *GV);
 
+  /// VersionFromGlobal - Returns the version number from a debug info
+  /// descriptor GlobalVariable.  Return DIIValid if operand is not an unsigned
+  /// int.
+  static unsigned VersionFromGlobal(GlobalVariable *GV);
+
   /// DescFactory - Create an instance of debug info descriptor based on Tag.
   /// Return NULL if not a recognized Tag.
   static DebugInfoDesc *DescFactory(unsigned Tag);
@@ -216,7 +228,6 @@
 /// source/header file.
 class CompileUnitDesc : public AnchoredDesc {
 private:  
-  unsigned DebugVersion;                // LLVM debug version when produced.
   unsigned Language;                    // Language number (ex. DW_LANG_C89.)
   std::string FileName;                 // Source file name.
   std::string Directory;                // Source file directory.
@@ -227,7 +238,6 @@
   
   
   // Accessors
-  unsigned getDebugVersion()              const { return DebugVersion; }
   unsigned getLanguage()                  const { return Language; }
   const std::string &getFileName()        const { return FileName; }
   const std::string &getDirectory()       const { return Directory; }
@@ -243,10 +253,6 @@
   static bool classof(const CompileUnitDesc *) { return true; }
   static bool classof(const DebugInfoDesc *D);
   
-  /// DebugVersionFromGlobal - Returns the version number from a compile unit
-  /// GlobalVariable.  Return DIIValid if operand is not an unsigned int.
-  static unsigned DebugVersionFromGlobal(GlobalVariable *GV);
-  
   /// ApplyToFields - Target the visitor to the fields of the CompileUnitDesc.
   ///
   virtual void ApplyToFields(DIVisitor *Visitor);
@@ -702,17 +708,13 @@
 /// into DebugInfoDesc objects.
 class DIDeserializer {
 private:
-  unsigned DebugVersion;                // Version of debug information in use.
   std::map<GlobalVariable *, DebugInfoDesc *> GlobalDescs;
                                         // Previously defined gloabls.
   
 public:
-  DIDeserializer() : DebugVersion(LLVMDebugVersion) {}
+  DIDeserializer() {}
   ~DIDeserializer() {}
   
-  // Accessors
-  unsigned getDebugVersion() const { return DebugVersion; }
-  
   /// Deserialize - Reconstitute a GlobalVariable into it's component
   /// DebugInfoDesc objects.
   DebugInfoDesc *Deserialize(Value *V);
@@ -780,14 +782,12 @@
     Invalid,
     Valid
   };
-  unsigned DebugVersion;                // Version of debug information in use.
   std::map<GlobalVariable *, unsigned> Validity;// Tracks prior results.
   std::map<unsigned, unsigned> Counts;  // Count of fields per Tag type.
   
 public:
   DIVerifier()
-  : DebugVersion(LLVMDebugVersion)
-  , Validity()
+  : Validity()
   , Counts()
   {}
   ~DIVerifier() {}
@@ -1039,15 +1039,10 @@
     std::vector<T *> AnchoredDescs;
     for (unsigned i = 0, N = Globals.size(); i < N; ++i) {
       GlobalVariable *GV = Globals[i];
-      unsigned Tag = DebugInfoDesc::TagFromGlobal(GV);
-      
-      if (isa<CompileUnitDesc>(&Desc)) {
-        unsigned DebugVersion = CompileUnitDesc::DebugVersionFromGlobal(GV);
-        // FIXME - In the short term, changes are too drastic to continue.
-        if (DebugVersion != LLVMDebugVersion) break;
-      }
       
-      if (Tag == Desc.getTag()) {
+      // FIXME - In the short term, changes are too drastic to continue.
+      if (DebugInfoDesc::TagFromGlobal(GV) == Desc.getTag() &&
+          DebugInfoDesc::VersionFromGlobal(GV) == LLVMDebugVersion) {
         AnchoredDescs.push_back(cast<T>(DR.Deserialize(GV)));
       }
     }






More information about the llvm-commits mailing list