[llvm-commits] [llvm] r79097 - in /llvm/trunk/lib/Target/PIC16: PIC16DebugInfo.cpp PIC16DebugInfo.h

Sanjiv Gupta sanjiv.gupta at microchip.com
Sat Aug 15 07:36:48 PDT 2009


Author: sgupta
Date: Sat Aug 15 09:36:48 2009
New Revision: 79097

URL: http://llvm.org/viewvc/llvm-project?rev=79097&view=rev
Log:
Revert a few changes that were done in 78603.
PIC16DebugInfo currently rely on NameStr of composite type descriptors to uniquely
identify debug info for two aggregate type decls with same name.
This implementation will change when we have MDNodes based debug info implemenatation in place


Modified:
    llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp
    llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h

Modified: llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp?rev=79097&r1=79096&r2=79097&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp Sat Aug 15 09:36:48 2009
@@ -119,7 +119,9 @@
   // UniqueSuffix is .number where number is obtained from
   // llvm.dbg.composite<number>.
   // FIXME: This will break when composite type is not represented by
-  // llvm.dbg.composite* global variable. This is not supported.
+  // llvm.dbg.composite* global variable. Since we need to revisit 
+  // PIC16DebugInfo implementation anyways after the MDNodes based 
+  // framework is done, let us continue with the way it is.
   std::string UniqueSuffix = "." + Ty.getGV()->getNameStr().substr(18);
   TagName += UniqueSuffix;
   unsigned short size = CTy.getSizeInBits()/8;
@@ -293,7 +295,7 @@
 /// composite type.
 /// 
 void PIC16DbgInfo::EmitCompositeTypeElements (DICompositeType CTy,
-                                              unsigned SuffixNo) {
+                                              std::string SuffixNo) {
   unsigned long Value = 0;
   DIArray Elements = CTy.getTypeArray();
   for (unsigned i = 0, N = Elements.getNumElements(); i < N; i++) {
@@ -308,8 +310,7 @@
     DITy.getName(ElementName);
     unsigned short ElementSize = DITy.getSizeInBits()/8;
     // Get mangleddd name for this structure/union  element.
-    SmallString<128> MangMemName(ElementName.begin(), ElementName.end());
-    MangMemName.append_uint_32(SuffixNo);
+    std::string MangMemName = ElementName + SuffixNo;
     PopulateDebugInfo(DITy, TypeNo, HasAux, ElementAux, TagName);
     short Class = 0;
     if( CTy.getTag() == dwarf::DW_TAG_union_type)
@@ -330,9 +331,8 @@
 void PIC16DbgInfo::EmitCompositeTypeDecls(Module &M) {
   DebugInfoFinder DbgFinder;
   DbgFinder.processModule(M);
-  unsigned SuffixNo = 0;
-  for (DebugInfoFinder::iterator I = DbgFinder.global_variable_begin(),
-         E = DbgFinder.global_variable_end(); I != E; ++I) {
+  for (DebugInfoFinder::iterator I = DbgFinder.type_begin(),
+         E = DbgFinder.type_end(); I != E; ++I) {
     DICompositeType CTy(*I);
     if (CTy.isNull())
       continue;
@@ -340,8 +340,11 @@
         CTy.getTag() == dwarf::DW_TAG_structure_type ) {
       std::string Name;
       CTy.getName(Name);
-      SmallString<128> MangledCTyName(Name.begin(), Name.end());
-      MangledCTyName.append_uint_32(++SuffixNo);
+      // Get the number after llvm.dbg.composite and make UniqueSuffix from 
+      // it.
+      std::string DIVar = CTy.getGV()->getNameStr();
+      std::string UniqueSuffix = "." + DIVar.substr(18);
+      std::string MangledCTyName = Name + UniqueSuffix;
       unsigned short size = CTy.getSizeInBits()/8;
       int Aux[PIC16Dbg::AuxSize] = {0};
       // 7th and 8th byte represent size of structure/union.
@@ -357,12 +360,10 @@
       EmitAuxEntry(MangledCTyName.c_str(), Aux, PIC16Dbg::AuxSize);
       
       // Emit members.
-      EmitCompositeTypeElements (CTy, SuffixNo);
+      EmitCompositeTypeElements (CTy, UniqueSuffix);
       
       // Emit mangled Symbol for end of structure/union.
-      SmallString<128> EOSSymbol(Name.begin(), Name.end());
-      EOSSymbol += ".eos";
-      EOSSymbol.append_uint_32(SuffixNo);
+      std::string EOSSymbol = ".eos" + UniqueSuffix;
       EmitSymbol(EOSSymbol.c_str(), PIC16Dbg::C_EOS);
       EmitAuxEntry(EOSSymbol.c_str(), Aux, PIC16Dbg::AuxSize, 
                    MangledCTyName.c_str());

Modified: llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h?rev=79097&r1=79096&r2=79097&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h Sat Aug 15 09:36:48 2009
@@ -145,7 +145,7 @@
     short getStorageClass(DIGlobalVariable DIGV);
     void EmitFunctBeginDI(const Function *F);
     void EmitCompositeTypeDecls(Module &M);
-    void EmitCompositeTypeElements (DICompositeType CTy, unsigned Suffix);
+    void EmitCompositeTypeElements (DICompositeType CTy, std::string Suffix);
     void EmitFunctEndDI(const Function *F, unsigned Line);
     void EmitAuxEntry(const std::string VarName, int Aux[], 
                       int num = PIC16Dbg::AuxSize, std::string TagName = "");





More information about the llvm-commits mailing list