Patchwork [6/6] Dump NOTE_INSN_CFI notes.

login
register
mail settings
Submitter Richard Henderson
Date July 3, 2011, 8:01 p.m.
Message ID <1309723308-26667-7-git-send-email-rth@redhat.com>
Download mbox | patch
Permalink /patch/103029/
State New
Headers show

Comments

Richard Henderson - July 3, 2011, 8:01 p.m.
---
 gcc/dwarf2out.c |   14 +++++++-------
 gcc/dwarf2out.h |    2 ++
 gcc/print-rtl.c |    9 +++++++++
 3 files changed, 18 insertions(+), 7 deletions(-)

Patch

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 097e57f..2736477 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -822,8 +822,8 @@  output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh)
 
 /* Similar, but do it via assembler directives instead.  */
 
-static void
-output_cfi_directive (dw_cfi_ref cfi)
+void
+output_cfi_directive (FILE *asm_out_file, dw_cfi_ref cfi)
 {
   unsigned long r, r2;
 
@@ -925,7 +925,7 @@  void
 dwarf2out_emit_cfi (dw_cfi_ref cfi)
 {
   if (dwarf2out_do_cfi_asm ())
-    output_cfi_directive (cfi);
+    output_cfi_directive (asm_out_file, cfi);
 }
 
 /* Output CFIs from VEC, up to index UPTO, to bring current FDE to the
@@ -1032,7 +1032,7 @@  output_cfis (cfi_vec vec, int upto, bool do_cfi_asm,
 		  && cfi2->dw_cfi_opc != DW_CFA_restore_extended)
 		{
 		  if (do_cfi_asm)
-		    output_cfi_directive (cfi2);
+		    output_cfi_directive (asm_out_file, cfi2);
 		  else
 		    output_cfi (cfi2, fde, for_eh);
 		}
@@ -1066,7 +1066,7 @@  output_cfis (cfi_vec vec, int upto, bool do_cfi_asm,
 	  if (cfi_cfa)
 	    {
 	      if (do_cfi_asm)
-		output_cfi_directive (cfi_cfa);
+		output_cfi_directive (asm_out_file, cfi_cfa);
 	      else
 		output_cfi (cfi_cfa, fde, for_eh);
 	    }
@@ -1076,7 +1076,7 @@  output_cfis (cfi_vec vec, int upto, bool do_cfi_asm,
 	      && cfi_args_size->dw_cfi_oprnd1.dw_cfi_offset)
 	    {
 	      if (do_cfi_asm)
-		output_cfi_directive (cfi_args_size);
+		output_cfi_directive (asm_out_file, cfi_args_size);
 	      else
 		output_cfi (cfi_args_size, fde, for_eh);
 	    }
@@ -1087,7 +1087,7 @@  output_cfis (cfi_vec vec, int upto, bool do_cfi_asm,
 	      return;
 	    }
 	  else if (do_cfi_asm)
-	    output_cfi_directive (cfi);
+	    output_cfi_directive (asm_out_file, cfi);
 	  else
 	    output_cfi (cfi, fde, for_eh);
 	  break;
diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h
index 7122dee..19bae4a 100644
--- a/gcc/dwarf2out.h
+++ b/gcc/dwarf2out.h
@@ -241,6 +241,8 @@  extern enum dw_cfi_oprnd_type dw_cfi_oprnd1_desc
 extern enum dw_cfi_oprnd_type dw_cfi_oprnd2_desc
   (enum dwarf_call_frame_info cfi);
 
+extern void output_cfi_directive (FILE *f, struct dw_cfi_struct *cfi);
+
 extern void dwarf2out_decl (tree);
 extern void dwarf2out_emit_cfi (dw_cfi_ref cfi);
 
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index c20ff6c..d7fd73b 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -43,6 +43,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree-pretty-print.h"
 #include "cselib.h"
 #include "tree-pass.h"
+#include "dwarf2out.h"
 #endif
 
 static FILE *outfile;
@@ -309,6 +310,14 @@  print_rtx (const_rtx in_rtx)
 #endif
 		break;
 
+	      case NOTE_INSN_CFI:
+#ifndef GENERATOR_FILE
+		fputc ('\n', outfile);
+		output_cfi_directive (outfile, NOTE_CFI (in_rtx));
+		fputc ('\t', outfile);
+#endif
+		break;
+
 	      default:
 		break;
 	      }