[llvm-commits] [dragonegg] r97389 - in /dragonegg/trunk: llvm-convert.cpp llvm-internal.h

Duncan Sands baldrick at free.fr
Sun Feb 28 05:13:04 PST 2010


Author: baldrick
Date: Sun Feb 28 07:13:04 2010
New Revision: 97389

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

Modified:
    dragonegg/trunk/llvm-convert.cpp
    dragonegg/trunk/llvm-internal.h

Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=97389&r1=97388&r2=97389&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Sun Feb 28 07:13:04 2010
@@ -227,6 +227,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;
@@ -234,7 +242,7 @@
   ReturnBB = UnwindBB = 0;
   ReturnOffset = 0;
 
-  if (TheDebugInfo) {
+  if (EmitDebugInfo()) {
     expanded_location Location = expand_location(DECL_SOURCE_LOCATION (fndecl));
 
     if (Location.file) {
@@ -420,7 +428,7 @@
       Builder.CreateStore(AI, Tmp);
 
       TheTreeToLLVM->set_decl_local(ResultDecl, Tmp);
-      if (TheDebugInfo) {
+      if (TheDebugInfo && !DECL_IGNORED_P(FunctionDecl)) {
         TheDebugInfo->EmitDeclare(ResultDecl,
                                   dwarf::DW_TAG_return_variable,
                                   "agg.result", RetTy, Tmp,
@@ -688,7 +696,7 @@
   BasicBlocks[ENTRY_BLOCK_PTR] = EntryBlock;
   Builder.SetInsertPoint(EntryBlock);
 
-  if (TheDebugInfo)
+  if (EmitDebugInfo())
     TheDebugInfo->EmitFunctionStart(FnDecl, Fn, Builder.GetInsertBlock());
 
   // Loop over all of the arguments to the function, setting Argument names and
@@ -727,7 +735,7 @@
       // the l-value for the argument IS the argument itself.
       AI->setName(Name);
       SET_DECL_LOCAL(Args, AI);
-      if (!isInvRef && TheDebugInfo)
+      if (!isInvRef && EmitDebugInfo())
         TheDebugInfo->EmitDeclare(Args, dwarf::DW_TAG_arg_variable,
                                   Name, TREE_TYPE(Args),
                                   AI, Builder);
@@ -739,7 +747,7 @@
       Value *Tmp = CreateTemporary(ArgTy);
       Tmp->setName(std::string(Name)+"_addr");
       SET_DECL_LOCAL(Args, Tmp);
-      if (TheDebugInfo) {
+      if (EmitDebugInfo()) {
         TheDebugInfo->EmitDeclare(Args, dwarf::DW_TAG_arg_variable,
                                   Name, TREE_TYPE(Args), Tmp,
                                   Builder);
@@ -776,7 +784,7 @@
     // Not supported yet.
   }
 
-  if (TheDebugInfo)
+  if (EmitDebugInfo())
     TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock(), Builder);
 
   // Create a new block for the return node, but don't insert it yet.
@@ -961,7 +969,7 @@
       }
     }
   }
-  if (TheDebugInfo) {
+  if (EmitDebugInfo()) {
     TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock(), Builder);
     TheDebugInfo->EmitFunctionEnd(Builder.GetInsertBlock(), true);
   }
@@ -1101,7 +1109,7 @@
     gimple stmt = gsi_stmt(gsi);
     ++NumStatements;
 
-    if (TheDebugInfo) {
+    if (EmitDebugInfo()) {
       if (gimple_has_location(stmt)) {
         TheDebugInfo->setLocationFile(gimple_filename(stmt));
         TheDebugInfo->setLocationLine(gimple_lineno(stmt));
@@ -1164,7 +1172,7 @@
     }
   }
 
-  if (TheDebugInfo) {
+  if (EmitDebugInfo()) {
     TheDebugInfo->setLocationFile("");
     TheDebugInfo->setLocationLine(0);
     TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock(), Builder);
@@ -1813,7 +1821,7 @@
       Builder.CreateStore(Constant::getNullValue(T), AI);
     }
 
-  if (TheDebugInfo) {
+  if (EmitDebugInfo()) {
     if (DECL_NAME(decl)) {
       TheDebugInfo->EmitDeclare(decl, dwarf::DW_TAG_auto_variable,
                                 AI->getNameStr().c_str(), TREE_TYPE(decl), AI,

Modified: dragonegg/trunk/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-internal.h?rev=97389&r1=97388&r2=97389&view=diff
==============================================================================
--- dragonegg/trunk/llvm-internal.h (original)
+++ dragonegg/trunk/llvm-internal.h Sun Feb 28 07:13:04 2010
@@ -562,6 +562,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