[llvm-commits] [llvm-gcc-4.2] r95325 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h

Devang Patel dpatel at apple.com
Thu Feb 4 12:53:10 PST 2010


Author: dpatel
Date: Thu Feb  4 14:53:10 2010
New Revision: 95325

URL: http://llvm.org/viewvc/llvm-project?rev=95325&view=rev
Log:
Do not emit debug info for a function, if DECL_IGNORED_P(FnDecl) is set.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-internal.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=95325&r1=95324&r2=95325&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Feb  4 14:53:10 2010
@@ -154,6 +154,14 @@
   return *TheTarget->getTargetData();
 }
 
+/// EmitDebugInfo - Return true if debug info is to be emitted for current 
+/// function.
+bool TreeToLLVM::EmitDebugInfo() {
+  if (TheDebugInfo && !DECL_IGNORED_P(getFUNCTION_DECL()))
+    return true;
+  return false;
+}
+
 TreeToLLVM::TreeToLLVM(tree fndecl) :
     TD(getTargetData()), Builder(Context, *TheFolder) {
   FnDecl = fndecl;
@@ -161,7 +169,7 @@
   ReturnBB = UnwindBB = 0;
   ReturnOffset = 0;
 
-  if (TheDebugInfo) {
+  if (EmitDebugInfo()) {
     expanded_location Location = expand_location(DECL_SOURCE_LOCATION (fndecl));
 
     if (Location.file) {
@@ -300,7 +308,7 @@
       Builder.CreateStore(AI, Tmp);
 
       SET_DECL_LLVM(ResultDecl, Tmp);
-      if (TheDebugInfo) {
+      if (TheDebugInfo && !DECL_IGNORED_P(FunctionDecl)) {
         TheDebugInfo->EmitDeclare(ResultDecl,
                                   dwarf::DW_TAG_return_variable,
                                   "agg.result", RetTy, Tmp,
@@ -597,7 +605,7 @@
 
   SeenBlocks.clear();
 
-  if (TheDebugInfo)
+  if (EmitDebugInfo())
     TheDebugInfo->EmitFunctionStart(FnDecl, Fn, Builder.GetInsertBlock());
 
   // Loop over all of the arguments to the function, setting Argument names and
@@ -636,7 +644,7 @@
       // the l-value for the argument IS the argument itself.
       AI->setName(Name);
       SET_DECL_LLVM(Args, AI);
-      if (!isInvRef && TheDebugInfo)
+      if (!isInvRef && EmitDebugInfo())
         TheDebugInfo->EmitDeclare(Args, dwarf::DW_TAG_arg_variable,
                                   Name, TREE_TYPE(Args),
                                   AI, Builder);
@@ -648,11 +656,10 @@
       Value *Tmp = CreateTemporary(ArgTy);
       Tmp->setName(std::string(Name)+"_addr");
       SET_DECL_LLVM(Args, Tmp);
-      if (TheDebugInfo) {
+      if (EmitDebugInfo())
         TheDebugInfo->EmitDeclare(Args, dwarf::DW_TAG_arg_variable,
                                   Name, TREE_TYPE(Args), Tmp,
                                   Builder);
-      }
 
       // Emit annotate intrinsic if arg has annotate attr
       if (DECL_ATTRIBUTES(Args))
@@ -683,7 +690,7 @@
     // Not supported yet.
   }
 
-  if (TheDebugInfo)
+  if (EmitDebugInfo())
     TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock(), Builder);
 
   // As it turns out, not all temporaries are associated with blocks.  For those
@@ -752,7 +759,7 @@
       }
     }
   }
-  if (TheDebugInfo) {
+  if (EmitDebugInfo()) {
     TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock(), Builder);
     TheDebugInfo->EmitFunctionEnd(Builder.GetInsertBlock(), true);
   }
@@ -832,7 +839,7 @@
 void TreeToLLVM::switchLexicalBlock(tree exp) {
   if (exp == NULL_TREE || TREE_CODE(exp) == FUNCTION_DECL) {
     // assert(RegionStack empty);
-    if (TheDebugInfo)
+    if (EmitDebugInfo())
       TheDebugInfo->setCurrentLexicalBlock(exp);
     return;
   }
@@ -855,7 +862,7 @@
   if (!previously_visited)
     switchLexicalBlock(BLOCK_SUPERCONTEXT(new_block));
 
-  if (TheDebugInfo) {
+  if (EmitDebugInfo()) {
     tree current_block = TheDebugInfo->getCurrentLexicalBlock();
     if (new_block && current_block && new_block != current_block) {
       tree new_climber = new_block, current_climber = current_block;
@@ -922,7 +929,7 @@
   // declared in the new block.
   TreeToLLVM::switchLexicalBlock(exp);
 
-  if (TheDebugInfo) {
+  if (EmitDebugInfo()) {
     if (EXPR_HAS_LOCATION(exp)) {
       // Set new location on the way up the tree.
       TheDebugInfo->setLocationFile(EXPR_FILENAME(exp));
@@ -1101,7 +1108,7 @@
     break;
   }
 
-  if (TheDebugInfo && EXPR_HAS_LOCATION(exp)) {
+  if (EmitDebugInfo() && EXPR_HAS_LOCATION(exp)) {
     // Restore location back down the tree.
     TheDebugInfo->setLocationFile(EXPR_FILENAME(exp));
     TheDebugInfo->setLocationLine(EXPR_LINENO(exp));
@@ -1789,7 +1796,7 @@
       Builder.CreateStore(Constant::getNullValue(T), AI);
     }
 
-  if (TheDebugInfo) {
+  if (EmitDebugInfo()) {
     if (DECL_NAME(decl)) {
       TheDebugInfo->EmitDeclare(decl, dwarf::DW_TAG_auto_variable,
                                 Name, TREE_TYPE(decl), AI,

Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=95325&r1=95324&r2=95325&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Thu Feb  4 14:53:10 2010
@@ -441,6 +441,10 @@
   /// EmitUnwindBlock - Emit the lazily created EH unwind block.
   void EmitUnwindBlock();
 
+  /// EmitDebugInfo - Return true if debug info is to be emitted for current 
+  /// function.
+  bool EmitDebugInfo();
+
 private: // Helpers for exception handling.
 
   /// CreateExceptionValues - Create values used internally by exception





More information about the llvm-commits mailing list