[llvm-commits] [llvm-gcc-4.2] r67055 - in /llvm-gcc-4.2/branches/Apple/Dib/gcc: llvm-convert.cpp llvm-debug.cpp llvm-debug.h

Bill Wendling isanbard at gmail.com
Mon Mar 16 15:45:55 PDT 2009


Author: void
Date: Mon Mar 16 17:45:54 2009
New Revision: 67055

URL: http://llvm.org/viewvc/llvm-project?rev=67055&view=rev
Log:
--- Reverse-merging (from foreign repository) r66919 into '.':
U    gcc/llvm-convert.cpp
U    gcc/llvm-debug.cpp
U    gcc/llvm-debug.h


Modified:
    llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp
    llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-debug.cpp
    llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-debug.h

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp?rev=67055&r1=67054&r2=67055&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp Mon Mar 16 17:45:54 2009
@@ -898,9 +898,6 @@
 }
 
 Function *TreeToLLVM::EmitFunction() {
-  if (TheDebugInfo)
-    TheDebugInfo->ClearVarCache();
-
   // Set up parameters and prepare for return, for the function.
   StartFunctionBody();
 
@@ -908,41 +905,12 @@
   basic_block bb;
   edge e;
   edge_iterator ei;
-  tree stmt_block = NULL_TREE;
   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.
-          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());
-            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 scop.e Emit llvm.dbg.region.end.
-              TheDebugInfo->EmitRegionEnd(Builder.GetInsertBlock());
-            
-            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.
@@ -1779,6 +1747,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());
+    }
+  }
 }
 
 //===----------------------------------------------------------------------===//
@@ -5892,7 +5871,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,
@@ -5970,14 +5948,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/branches/Apple/Dib/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-debug.cpp?rev=67055&r1=67054&r2=67055&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-debug.cpp Mon Mar 16 17:45:54 2009
@@ -293,11 +293,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.
@@ -306,8 +301,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);
 }
@@ -848,11 +841,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/branches/Apple/Dib/gcc/llvm-debug.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-debug.h?rev=67055&r1=67054&r2=67055&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-debug.h (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-debug.h Mon Mar 16 17:45:54 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