[llvm-commits] [llvm-gcc-4.2] r67141 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-debug.cpp llvm-debug.h

Evan Cheng evan.cheng at apple.com
Tue Mar 17 17:42:41 PDT 2009


Author: evancheng
Date: Tue Mar 17 19:42:41 2009
New Revision: 67141

URL: http://llvm.org/viewvc/llvm-project?rev=67141&view=rev
Log:
Backing out 67095, 66925, and 66861 for now. These break a bunch of stuff, including debug llvm-gcc build. Devang, please fix and re-commit the patches.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-debug.h

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=67141&r1=67140&r2=67141&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Mar 17 19:42:41 2009
@@ -714,9 +714,6 @@
 }
 
 Function *TreeToLLVM::EmitFunction() {
-  if (TheDebugInfo)
-    TheDebugInfo->ClearVarCache();
-
   // Set up parameters and prepare for return, for the function.
   StartFunctionBody();
 
@@ -724,52 +721,12 @@
   basic_block bb;
   edge e;
   edge_iterator ei;
-  tree stmt_block = NULL_TREE;
-  unsigned RegionCount = 0;
   FOR_EACH_BB (bb) {
     for (block_stmt_iterator bsi = bsi_start (bb); !bsi_end_p (bsi);
          bsi_next (&bsi)) {
       MemRef DestLoc;
       tree stmt = bsi_stmt (bsi);
-      // FIXME : Optimizer and code generator are not doing the right thing yet
-      // while dealing with variable's debug info locations.
-      tree new_stmt_block = TREE_BLOCK (stmt);
-      if (TheDebugInfo && new_stmt_block && !optimize) {
-        if (stmt_block == NULL_TREE) {
-          // This is beginning of function. llvm.dbg.func.start is emitted so
-          // no need to emit llvm.dbg.region.start here.
-          tree t = new_stmt_block;
-          while (TREE_CODE (BLOCK_SUPERCONTEXT (t)) != FUNCTION_DECL) {
-            TheDebugInfo->EmitRegionStart(Builder.GetInsertBlock());
-            t = BLOCK_SUPERCONTEXT (t);
-            RegionCount++;
-          } 
-          stmt_block = new_stmt_block;
-        }
-        else {
-          if (stmt_block != new_stmt_block) {
-            if (BLOCK_SUPERCONTEXT (new_stmt_block) == stmt_block) {
-              // Entering new scope. Emit llvm.dbg.func.start.
-              TheDebugInfo->EmitRegionStart(Builder.GetInsertBlock());
-              RegionCount++;
-            }
-            else if (BLOCK_SUPERCONTEXT (new_stmt_block) == 
-                     BLOCK_SUPERCONTEXT (stmt_block)) {
-              // Entering new scope at the same level. End previous current 
-              // region by emitting llvm.dbg.region.end. And emit 
-              // llvm.dbg.region.start to start new region.
-              TheDebugInfo->EmitRegionEnd(Builder.GetInsertBlock());
-              TheDebugInfo->EmitRegionStart(Builder.GetInsertBlock());
-            } else {
-              // Leaving current scope. Emit llvm.dbg.region.end.
-              TheDebugInfo->EmitRegionEnd(Builder.GetInsertBlock());
-              RegionCount--;
-            }
-            stmt_block = new_stmt_block;
-          }
-        }
-      }
-        
+
       // If this stmt returns an aggregate value (e.g. a call whose result is
       // ignored), create a temporary to receive the value.  Note that we don't
       // do this for MODIFY_EXPRs as an efficiency hack.
@@ -788,13 +745,7 @@
       EmitBlock(BasicBlock::Create(""));
     }
   }
-
-  // Pop out of dbg info regions.
-  while(RegionCount) {
-    TheDebugInfo->EmitRegionEnd(Builder.GetInsertBlock());
-    RegionCount--;
-  }
-
+ 
   // Wrap things up.
   return FinishFunctionBody();
 }
@@ -1589,6 +1540,17 @@
       Builder.CreateStore(Constant::getNullValue(T), AI);
     }
   
+  if (TheDebugInfo) {
+    if (DECL_NAME(decl)) {
+      TheDebugInfo->EmitDeclare(decl, dwarf::DW_TAG_auto_variable,
+                                Name, TREE_TYPE(decl), AI,
+                                Builder.GetInsertBlock());
+    } else if (TREE_CODE(decl) == RESULT_DECL) {
+      TheDebugInfo->EmitDeclare(decl, dwarf::DW_TAG_return_variable,
+                                Name, TREE_TYPE(decl), AI,
+                                Builder.GetInsertBlock());
+    }
+  }
 }
 
 //===----------------------------------------------------------------------===//
@@ -5747,7 +5709,6 @@
 //===----------------------------------------------------------------------===//
 
 LValue TreeToLLVM::EmitLV_DECL(tree exp) {
-
   if (TREE_CODE(exp) == PARM_DECL || TREE_CODE(exp) == VAR_DECL || 
       TREE_CODE(exp) == CONST_DECL) {
     // If a static var's type was incomplete when the decl was written,
@@ -5825,14 +5786,6 @@
       Alignment = DECL_ALIGN(exp) / 8;
   }
 
-  if (TheDebugInfo) {
-    if (DECL_NAME(exp))
-      TheDebugInfo->EmitDeclare(exp, dwarf::DW_TAG_auto_variable,
-                                IDENTIFIER_POINTER (DECL_NAME (exp)), 
-                                TREE_TYPE(exp), Decl,
-                                Builder.GetInsertBlock());
-  }
-
   return LValue(BitCastToType(Decl, PTy), Alignment);
 }
 

Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=67141&r1=67140&r2=67141&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Tue Mar 17 19:42:41 2009
@@ -294,11 +294,6 @@
 
   assert(!RegionStack.empty() && "Region stack mismatch, stack empty!");
 
-  // Check to see if the compile unit already has created this type.
-  llvm::DIVariable &Slot = VarCache[decl];
-  if (!Slot.isNull())
-    return;
-
   expanded_location Loc = GetNodeLocation(decl, false);
 
   // Construct variable.
@@ -307,8 +302,6 @@
                                 getOrCreateCompileUnit(Loc.file),
                                 Loc.line, getOrCreateType(type));
 
-  VarCache[decl] = D;
-
   // Insert an llvm.dbg.declare into the current block.
   DebugFactory.InsertDeclare(AI, D, CurBB);
 }
@@ -850,11 +843,6 @@
   getOrCreateCompileUnit(main_input_filename, true);
 }
 
-/// ClearDeclCache - Clear variable debug info cache.
-void DebugInfo::ClearVarCache() {
-  VarCache.clear();
-}
-
 /// getOrCreateCompileUnit - Get the compile unit from the cache or 
 /// create a new one if necessary.
 DICompileUnit DebugInfo::getOrCreateCompileUnit(const char *FullPath,

Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.h?rev=67141&r1=67140&r2=67141&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.h Tue Mar 17 19:42:41 2009
@@ -63,9 +63,6 @@
   std::map<tree_node *, DIType> TypeCache;
                                         // Cache of previously constructed 
                                         // Types.
-  std::map<tree_node *, DIVariable> VarCache;
-                                        // Cache of previously constructed 
-                                        // vars in this function.
   std::vector<DIDescriptor> RegionStack;
                                         // Stack to track declarative scopes.
   
@@ -78,9 +75,6 @@
   /// initialization is done.
   void Initialize();
 
-  /// ClearDeclCache - Clear variable debug info cache.
-  void ClearVarCache();
-
   // Accessors.
   void setLocationFile(const char *FullPath) { CurFullPath = FullPath; }
   void setLocationLine(int LineNo)           { CurLineNo = LineNo; }





More information about the llvm-commits mailing list