Commit 2867fa7c by Richard Henderson Committed by Richard Henderson

Dump NOTE_INSN_CFI notes.

        * dwarf2out.c (output_cfi_directive): Export.  Add FILE parameter.
        Handle some opcodes specially for debugging.
        * print-rtl.c: Include dwarf2out.h
        (print_rtx): Handle NOTE_INSN_CFI.
        * Makefile.in (print-rtl.o): Update.

From-SVN: r176020
parent 7644b3c7
2011-07-07 Richard Henderson <rth@redhat.com> 2011-07-07 Richard Henderson <rth@redhat.com>
* dwarf2out.c (output_cfi_directive): Export. Add FILE parameter.
Handle some opcodes specially for debugging.
* print-rtl.c: Include dwarf2out.h
(print_rtx): Handle NOTE_INSN_CFI.
* Makefile.in (print-rtl.o): Update.
2011-07-07 Richard Henderson <rth@redhat.com>
* tree-pass.h (pass_dwarf2_frame): Declare. * tree-pass.h (pass_dwarf2_frame): Declare.
* passes.c (init_optimization_passes): Add it. * passes.c (init_optimization_passes): Add it.
* dwarf2cfi.c (dwarf2out_frame_debug): Make static. * dwarf2cfi.c (dwarf2out_frame_debug): Make static.
......
...@@ -2923,7 +2923,8 @@ rtl.o : rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ ...@@ -2923,7 +2923,8 @@ rtl.o : rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
print-rtl.o : print-rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ print-rtl.o : print-rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(TREE_H) hard-reg-set.h $(BASIC_BLOCK_H) $(FLAGS_H) \ $(RTL_H) $(TREE_H) hard-reg-set.h $(BASIC_BLOCK_H) $(FLAGS_H) \
$(BCONFIG_H) $(DIAGNOSTIC_H) cselib.h $(TREE_PASS_H) tree-pretty-print.h $(BCONFIG_H) $(DIAGNOSTIC_H) cselib.h $(TREE_PASS_H) tree-pretty-print.h \
dwarf2out.h
rtlanal.o : rtlanal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(DIAGNOSTIC_CORE_H) \ rtlanal.o : rtlanal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(DIAGNOSTIC_CORE_H) \
$(RTL_H) hard-reg-set.h $(TM_P_H) insn-config.h $(RECOG_H) \ $(RTL_H) hard-reg-set.h $(TM_P_H) insn-config.h $(RECOG_H) \
$(FLAGS_H) $(REGS_H) output.h $(TARGET_H) $(FUNCTION_H) $(TREE_H) \ $(FLAGS_H) $(REGS_H) output.h $(TARGET_H) $(FUNCTION_H) $(TREE_H) \
......
...@@ -822,8 +822,8 @@ output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh) ...@@ -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. */ /* Similar, but do it via assembler directives instead. */
static void void
output_cfi_directive (dw_cfi_ref cfi) output_cfi_directive (FILE *f, dw_cfi_ref cfi)
{ {
unsigned long r, r2; unsigned long r, r2;
...@@ -837,83 +837,105 @@ output_cfi_directive (dw_cfi_ref cfi) ...@@ -837,83 +837,105 @@ output_cfi_directive (dw_cfi_ref cfi)
case DW_CFA_set_loc: case DW_CFA_set_loc:
/* Should only be created by add_fde_cfi in a code path not /* Should only be created by add_fde_cfi in a code path not
followed when emitting via directives. The assembler is followed when emitting via directives. The assembler is
going to take care of this for us. */ going to take care of this for us. But this routines is
gcc_unreachable (); also used for debugging dumps, so print something. */
gcc_assert (f != asm_out_file);
fprintf (f, "\t.cfi_advance_loc\n");
break;
case DW_CFA_offset: case DW_CFA_offset:
case DW_CFA_offset_extended: case DW_CFA_offset_extended:
case DW_CFA_offset_extended_sf: case DW_CFA_offset_extended_sf:
r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1); r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
fprintf (asm_out_file, "\t.cfi_offset %lu, "HOST_WIDE_INT_PRINT_DEC"\n", fprintf (f, "\t.cfi_offset %lu, "HOST_WIDE_INT_PRINT_DEC"\n",
r, cfi->dw_cfi_oprnd2.dw_cfi_offset); r, cfi->dw_cfi_oprnd2.dw_cfi_offset);
break; break;
case DW_CFA_restore: case DW_CFA_restore:
case DW_CFA_restore_extended: case DW_CFA_restore_extended:
r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1); r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
fprintf (asm_out_file, "\t.cfi_restore %lu\n", r); fprintf (f, "\t.cfi_restore %lu\n", r);
break; break;
case DW_CFA_undefined: case DW_CFA_undefined:
r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1); r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
fprintf (asm_out_file, "\t.cfi_undefined %lu\n", r); fprintf (f, "\t.cfi_undefined %lu\n", r);
break; break;
case DW_CFA_same_value: case DW_CFA_same_value:
r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1); r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
fprintf (asm_out_file, "\t.cfi_same_value %lu\n", r); fprintf (f, "\t.cfi_same_value %lu\n", r);
break; break;
case DW_CFA_def_cfa: case DW_CFA_def_cfa:
case DW_CFA_def_cfa_sf: case DW_CFA_def_cfa_sf:
r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1); r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
fprintf (asm_out_file, "\t.cfi_def_cfa %lu, "HOST_WIDE_INT_PRINT_DEC"\n", fprintf (f, "\t.cfi_def_cfa %lu, "HOST_WIDE_INT_PRINT_DEC"\n",
r, cfi->dw_cfi_oprnd2.dw_cfi_offset); r, cfi->dw_cfi_oprnd2.dw_cfi_offset);
break; break;
case DW_CFA_def_cfa_register: case DW_CFA_def_cfa_register:
r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1); r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
fprintf (asm_out_file, "\t.cfi_def_cfa_register %lu\n", r); fprintf (f, "\t.cfi_def_cfa_register %lu\n", r);
break; break;
case DW_CFA_register: case DW_CFA_register:
r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1); r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
r2 = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd2.dw_cfi_reg_num, 1); r2 = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd2.dw_cfi_reg_num, 1);
fprintf (asm_out_file, "\t.cfi_register %lu, %lu\n", r, r2); fprintf (f, "\t.cfi_register %lu, %lu\n", r, r2);
break; break;
case DW_CFA_def_cfa_offset: case DW_CFA_def_cfa_offset:
case DW_CFA_def_cfa_offset_sf: case DW_CFA_def_cfa_offset_sf:
fprintf (asm_out_file, "\t.cfi_def_cfa_offset " fprintf (f, "\t.cfi_def_cfa_offset "
HOST_WIDE_INT_PRINT_DEC"\n", HOST_WIDE_INT_PRINT_DEC"\n",
cfi->dw_cfi_oprnd1.dw_cfi_offset); cfi->dw_cfi_oprnd1.dw_cfi_offset);
break; break;
case DW_CFA_remember_state: case DW_CFA_remember_state:
fprintf (asm_out_file, "\t.cfi_remember_state\n"); fprintf (f, "\t.cfi_remember_state\n");
break; break;
case DW_CFA_restore_state: case DW_CFA_restore_state:
fprintf (asm_out_file, "\t.cfi_restore_state\n"); fprintf (f, "\t.cfi_restore_state\n");
break; break;
case DW_CFA_GNU_args_size: case DW_CFA_GNU_args_size:
fprintf (asm_out_file, "\t.cfi_escape %#x,", DW_CFA_GNU_args_size); if (f == asm_out_file)
dw2_asm_output_data_uleb128_raw (cfi->dw_cfi_oprnd1.dw_cfi_offset); {
if (flag_debug_asm) fprintf (f, "\t.cfi_escape %#x,", DW_CFA_GNU_args_size);
fprintf (asm_out_file, "\t%s args_size "HOST_WIDE_INT_PRINT_DEC, dw2_asm_output_data_uleb128_raw (cfi->dw_cfi_oprnd1.dw_cfi_offset);
ASM_COMMENT_START, cfi->dw_cfi_oprnd1.dw_cfi_offset); if (flag_debug_asm)
fputc ('\n', asm_out_file); fprintf (f, "\t%s args_size "HOST_WIDE_INT_PRINT_DEC,
ASM_COMMENT_START, cfi->dw_cfi_oprnd1.dw_cfi_offset);
fputc ('\n', f);
}
else
{
fprintf (f, "\t.cfi_GNU_args_size "HOST_WIDE_INT_PRINT_DEC "\n",
cfi->dw_cfi_oprnd1.dw_cfi_offset);
}
break; break;
case DW_CFA_GNU_window_save: case DW_CFA_GNU_window_save:
fprintf (asm_out_file, "\t.cfi_window_save\n"); fprintf (f, "\t.cfi_window_save\n");
break; break;
case DW_CFA_def_cfa_expression: case DW_CFA_def_cfa_expression:
if (f != asm_out_file)
{
fprintf (f, "\t.cfi_def_cfa_expression ...\n");
break;
}
/* FALLTHRU */
case DW_CFA_expression: case DW_CFA_expression:
fprintf (asm_out_file, "\t.cfi_escape %#x,", cfi->dw_cfi_opc); if (f != asm_out_file)
{
fprintf (f, "\t.cfi_cfa_expression ...\n");
break;
}
fprintf (f, "\t.cfi_escape %#x,", cfi->dw_cfi_opc);
output_cfa_loc_raw (cfi); output_cfa_loc_raw (cfi);
fputc ('\n', asm_out_file); fputc ('\n', f);
break; break;
default: default:
...@@ -925,7 +947,7 @@ void ...@@ -925,7 +947,7 @@ void
dwarf2out_emit_cfi (dw_cfi_ref cfi) dwarf2out_emit_cfi (dw_cfi_ref cfi)
{ {
if (dwarf2out_do_cfi_asm ()) 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 /* Output CFIs from VEC, up to index UPTO, to bring current FDE to the
...@@ -1032,7 +1054,7 @@ output_cfis (cfi_vec vec, int upto, bool do_cfi_asm, ...@@ -1032,7 +1054,7 @@ output_cfis (cfi_vec vec, int upto, bool do_cfi_asm,
&& cfi2->dw_cfi_opc != DW_CFA_restore_extended) && cfi2->dw_cfi_opc != DW_CFA_restore_extended)
{ {
if (do_cfi_asm) if (do_cfi_asm)
output_cfi_directive (cfi2); output_cfi_directive (asm_out_file, cfi2);
else else
output_cfi (cfi2, fde, for_eh); output_cfi (cfi2, fde, for_eh);
} }
...@@ -1066,7 +1088,7 @@ output_cfis (cfi_vec vec, int upto, bool do_cfi_asm, ...@@ -1066,7 +1088,7 @@ output_cfis (cfi_vec vec, int upto, bool do_cfi_asm,
if (cfi_cfa) if (cfi_cfa)
{ {
if (do_cfi_asm) if (do_cfi_asm)
output_cfi_directive (cfi_cfa); output_cfi_directive (asm_out_file, cfi_cfa);
else else
output_cfi (cfi_cfa, fde, for_eh); output_cfi (cfi_cfa, fde, for_eh);
} }
...@@ -1076,7 +1098,7 @@ output_cfis (cfi_vec vec, int upto, bool do_cfi_asm, ...@@ -1076,7 +1098,7 @@ output_cfis (cfi_vec vec, int upto, bool do_cfi_asm,
&& cfi_args_size->dw_cfi_oprnd1.dw_cfi_offset) && cfi_args_size->dw_cfi_oprnd1.dw_cfi_offset)
{ {
if (do_cfi_asm) if (do_cfi_asm)
output_cfi_directive (cfi_args_size); output_cfi_directive (asm_out_file, cfi_args_size);
else else
output_cfi (cfi_args_size, fde, for_eh); output_cfi (cfi_args_size, fde, for_eh);
} }
...@@ -1087,7 +1109,7 @@ output_cfis (cfi_vec vec, int upto, bool do_cfi_asm, ...@@ -1087,7 +1109,7 @@ output_cfis (cfi_vec vec, int upto, bool do_cfi_asm,
return; return;
} }
else if (do_cfi_asm) else if (do_cfi_asm)
output_cfi_directive (cfi); output_cfi_directive (asm_out_file, cfi);
else else
output_cfi (cfi, fde, for_eh); output_cfi (cfi, fde, for_eh);
break; break;
......
...@@ -241,6 +241,8 @@ extern enum dw_cfi_oprnd_type dw_cfi_oprnd1_desc ...@@ -241,6 +241,8 @@ extern enum dw_cfi_oprnd_type dw_cfi_oprnd1_desc
extern enum dw_cfi_oprnd_type dw_cfi_oprnd2_desc extern enum dw_cfi_oprnd_type dw_cfi_oprnd2_desc
(enum dwarf_call_frame_info cfi); (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_decl (tree);
extern void dwarf2out_emit_cfi (dw_cfi_ref cfi); extern void dwarf2out_emit_cfi (dw_cfi_ref cfi);
......
...@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pretty-print.h" #include "tree-pretty-print.h"
#include "cselib.h" #include "cselib.h"
#include "tree-pass.h" #include "tree-pass.h"
#include "dwarf2out.h"
#endif #endif
static FILE *outfile; static FILE *outfile;
...@@ -309,6 +310,14 @@ print_rtx (const_rtx in_rtx) ...@@ -309,6 +310,14 @@ print_rtx (const_rtx in_rtx)
#endif #endif
break; 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: default:
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment