This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, this patch cleans up the interface to the emit_note family of functions. It is a preliminary move to change the emit_line_note functions to take a location rather than filename/lineno pair.
nathan -- Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC The voices in my head said this was stupid too nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2003-06-15 Nathan Sidwell <nathan@codesourcery.com> * function.h (struct emit_status): Remove x_last_linenum, x_last_filename. Add x_last_location. * rtl.h: #include "input.h". (NOTE_DATE): New. * cfglayout.c (duplicate_insn_chain): Use emit_line_note for line number notes. * emit-rtl.c (last_linenum, last_filename): Remove. (last_location): New. (emit_line_note_after): LINE must always be >= 0. (emit_line_note): Likewise. Check not duplicate here... (emit_note): ... rather than here. (emit_line_note_force, force_next_line_note, init_emit): Adjust. * integrate.c (expand_inline_function): Use emit_line_note for line number notes. (copy_insn_list): Likewise. * unroll.c (copy_loop_body): Likewise. * Makefile.in (RTL_H): Add input.h. Index: function.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/function.h,v retrieving revision 1.97 diff -c -3 -p -r1.97 function.h *** function.h 4 Jun 2003 16:44:50 -0000 1.97 --- function.h 15 Jun 2003 19:21:40 -0000 *************** struct emit_status GTY(()) *** 83,92 **** Reset to 1 for each function compiled. */ int x_cur_insn_uid; ! /* Line number and source file of the last line-number NOTE emitted. This is used to avoid generating duplicates. */ ! int x_last_linenum; ! const char *x_last_filename; /* The length of the regno_pointer_align, regno_decl, and x_regno_reg_rtx vectors. Since these vectors are needed during the expansion phase when --- 83,91 ---- Reset to 1 for each function compiled. */ int x_cur_insn_uid; ! /* Location the last line-number NOTE emitted. This is used to avoid generating duplicates. */ ! location_t x_last_location; /* The length of the regno_pointer_align, regno_decl, and x_regno_reg_rtx vectors. Since these vectors are needed during the expansion phase when Index: rtl.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/rtl.h,v retrieving revision 1.413 diff -c -3 -p -r1.413 rtl.h *** rtl.h 15 Jun 2003 13:43:31 -0000 1.413 --- rtl.h 15 Jun 2003 19:21:48 -0000 *************** Software Foundation, 59 Temple Place - S *** 25,30 **** --- 25,31 ---- struct function; #include "machmode.h" + #include "input.h" #undef FFS /* Some systems predefine this symbol; don't let it interfere. */ #undef FLOAT /* Likewise. */ *************** extern const char * const reg_note_name[ *** 782,787 **** --- 783,790 ---- between ints and pointers if we use a different macro for the block number.) */ + /* Opaque data. */ + #define NOTE_DATA(INSN) XCINT (INSN, 4, NOTE) #define NOTE_SOURCE_FILE(INSN) XCSTR (INSN, 4, NOTE) #define NOTE_BLOCK(INSN) XCTREE (INSN, 4, NOTE) #define NOTE_EH_HANDLER(INSN) XCINT (INSN, 4, NOTE) *************** extern rtx assign_stack_temp PARAMS ((e *** 1511,1516 **** --- 1514,1520 ---- extern rtx assign_stack_temp_for_type PARAMS ((enum machine_mode, HOST_WIDE_INT, int, tree)); extern rtx assign_temp PARAMS ((tree, int, int, int)); + /* In emit-rtl.c */ extern rtx emit_insn_before PARAMS ((rtx, rtx)); extern rtx emit_insn_before_setloc PARAMS ((rtx, rtx, int)); Index: cfglayout.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cfglayout.c,v retrieving revision 1.35 diff -c -3 -p -r1.35 cfglayout.c *** cfglayout.c 8 Jun 2003 19:35:51 -0000 1.35 --- cfglayout.c 15 Jun 2003 19:21:48 -0000 *************** duplicate_insn_chain (from, to) *** 1023,1029 **** abort (); break; case NOTE_INSN_REPEATED_LINE_NUMBER: ! emit_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn)); break; default: --- 1023,1030 ---- abort (); break; case NOTE_INSN_REPEATED_LINE_NUMBER: ! emit_line_note (NOTE_SOURCE_FILE (insn), ! NOTE_LINE_NUMBER (insn)); break; default: *************** duplicate_insn_chain (from, to) *** 1031,1037 **** abort (); /* It is possible that no_line_number is set and the note won't be emitted. */ ! emit_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn)); } break; default: --- 1032,1039 ---- abort (); /* It is possible that no_line_number is set and the note won't be emitted. */ ! emit_line_note (NOTE_SOURCE_FILE (insn), ! NOTE_LINE_NUMBER (insn)); } break; default: Index: emit-rtl.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v retrieving revision 1.332 diff -c -3 -p -r1.332 emit-rtl.c *** emit-rtl.c 13 Jun 2003 19:27:29 -0000 1.332 --- emit-rtl.c 15 Jun 2003 19:21:58 -0000 *************** static GTY ((if_marked ("ggc_marked_p"), *** 170,177 **** #define first_insn (cfun->emit->x_first_insn) #define last_insn (cfun->emit->x_last_insn) #define cur_insn_uid (cfun->emit->x_cur_insn_uid) ! #define last_linenum (cfun->emit->x_last_linenum) ! #define last_filename (cfun->emit->x_last_filename) #define first_label_num (cfun->emit->x_first_label_num) static rtx make_jump_insn_raw PARAMS ((rtx)); --- 170,176 ---- #define first_insn (cfun->emit->x_first_insn) #define last_insn (cfun->emit->x_last_insn) #define cur_insn_uid (cfun->emit->x_cur_insn_uid) ! #define last_location (cfun->emit->x_last_location) #define first_label_num (cfun->emit->x_first_label_num) static rtx make_jump_insn_raw PARAMS ((rtx)); *************** emit_line_note_after (file, line, after) *** 4636,4642 **** { rtx note; ! if (no_line_numbers && line > 0) { cur_insn_uid++; return 0; --- 4635,4643 ---- { rtx note; ! if (line < 0) ! abort (); ! if (no_line_numbers) { cur_insn_uid++; return 0; *************** emit_line_note (file, line) *** 4896,4907 **** const char *file; int line; { set_file_and_line_for_stmt (file, line); ! #if 0 if (no_line_numbers) ! return 0; ! #endif return emit_note (file, line); } --- 4897,4918 ---- const char *file; int line; { + if (line < 0) + abort (); + set_file_and_line_for_stmt (file, line); ! if (file && last_location.file && !strcmp (file, last_location.file) ! && line == last_location.line) ! return NULL_RTX; ! last_location.file = file; ! last_location.line = line; ! if (no_line_numbers) ! { ! cur_insn_uid++; ! return NULL_RTX; ! } return emit_note (file, line); } *************** emit_note (file, line) *** 4918,4938 **** { rtx note; - if (line > 0) - { - if (file && last_filename && !strcmp (file, last_filename) - && line == last_linenum) - return 0; - last_filename = file; - last_linenum = line; - } - - if (no_line_numbers && line > 0) - { - cur_insn_uid++; - return 0; - } - note = rtx_alloc (NOTE); INSN_UID (note) = cur_insn_uid++; NOTE_SOURCE_FILE (note) = file; --- 4929,4934 ---- *************** emit_line_note_force (file, line) *** 4949,4955 **** const char *file; int line; { ! last_linenum = -1; return emit_line_note (file, line); } --- 4945,4951 ---- const char *file; int line; { ! last_location.line = -1; return emit_line_note (file, line); } *************** emit_line_note_force (file, line) *** 4959,4965 **** void force_next_line_note () { ! last_linenum = -1; } /* Place a note of KIND on insn INSN with DATUM as the datum. If a --- 4955,4961 ---- void force_next_line_note () { ! last_location.line = -1; } /* Place a note of KIND on insn INSN with DATUM as the datum. If a *************** init_emit () *** 5438,5445 **** seq_rtl_expr = NULL; cur_insn_uid = 1; reg_rtx_no = LAST_VIRTUAL_REGISTER + 1; ! last_linenum = 0; ! last_filename = 0; first_label_num = label_num; last_label_num = 0; seq_stack = NULL; --- 5434,5441 ---- seq_rtl_expr = NULL; cur_insn_uid = 1; reg_rtx_no = LAST_VIRTUAL_REGISTER + 1; ! last_location.line = 0; ! last_location.file = 0; first_label_num = label_num; last_label_num = 0; seq_stack = NULL; Index: integrate.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/integrate.c,v retrieving revision 1.223 diff -c -3 -p -r1.223 integrate.c *** integrate.c 8 Jun 2003 19:35:52 -0000 1.223 --- integrate.c 15 Jun 2003 19:22:05 -0000 *************** expand_inline_function (fndecl, parms, t *** 925,932 **** if (GET_CODE (parm_insns) == NOTE && NOTE_LINE_NUMBER (parm_insns) > 0) { ! rtx note = emit_note (NOTE_SOURCE_FILE (parm_insns), ! NOTE_LINE_NUMBER (parm_insns)); if (note) RTX_INTEGRATED_P (note) = 1; } --- 925,932 ---- if (GET_CODE (parm_insns) == NOTE && NOTE_LINE_NUMBER (parm_insns) > 0) { ! rtx note = emit_line_note (NOTE_SOURCE_FILE (parm_insns), ! NOTE_LINE_NUMBER (parm_insns)); if (note) RTX_INTEGRATED_P (note) = 1; } *************** expand_inline_function (fndecl, parms, t *** 1017,1024 **** && ! (GET_CODE (XEXP (loc, 0)) == REG && REGNO (XEXP (loc, 0)) > LAST_VIRTUAL_REGISTER)) { ! rtx note = emit_note (DECL_SOURCE_FILE (formal), ! DECL_SOURCE_LINE (formal)); if (note) RTX_INTEGRATED_P (note) = 1; --- 1017,1024 ---- && ! (GET_CODE (XEXP (loc, 0)) == REG && REGNO (XEXP (loc, 0)) > LAST_VIRTUAL_REGISTER)) { ! rtx note = emit_line_note (DECL_SOURCE_FILE (formal), ! DECL_SOURCE_LINE (formal)); if (note) RTX_INTEGRATED_P (note) = 1; *************** expand_inline_function (fndecl, parms, t *** 1305,1311 **** This line number note is still needed for debugging though, so we can't delete it. */ if (flag_test_coverage) ! emit_note (0, NOTE_INSN_REPEATED_LINE_NUMBER); emit_line_note (input_filename, input_line); --- 1305,1311 ---- This line number note is still needed for debugging though, so we can't delete it. */ if (flag_test_coverage) ! emit_note (NULL, NOTE_INSN_REPEATED_LINE_NUMBER); emit_line_note (input_filename, input_line); *************** copy_insn_list (insns, map, static_chain *** 1683,1697 **** NOTE_INSN_DELETED notes aren't useful. */ ! if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_END && NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_BEG && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED) { ! copy = emit_note (NOTE_SOURCE_FILE (insn), ! NOTE_LINE_NUMBER (insn)); ! if (copy ! && (NOTE_LINE_NUMBER (copy) == NOTE_INSN_BLOCK_BEG ! || NOTE_LINE_NUMBER (copy) == NOTE_INSN_BLOCK_END) && NOTE_BLOCK (insn)) { tree *mapped_block_p; --- 1683,1699 ---- NOTE_INSN_DELETED notes aren't useful. */ ! if (NOTE_LINE_NUMBER (insn) > 0) ! copy = emit_line_note (NOTE_SOURCE_FILE (insn), ! NOTE_LINE_NUMBER (insn)); ! else if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_END && NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_BEG && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED) { ! copy = emit_note (NULL, NOTE_LINE_NUMBER (insn)); ! NOTE_DATA (copy) = NOTE_DATA (insn); ! if ((NOTE_LINE_NUMBER (copy) == NOTE_INSN_BLOCK_BEG ! || NOTE_LINE_NUMBER (copy) == NOTE_INSN_BLOCK_END) && NOTE_BLOCK (insn)) { tree *mapped_block_p; *************** copy_insn_list (insns, map, static_chain *** 1708,1715 **** else NOTE_BLOCK (copy) = *mapped_block_p; } ! else if (copy ! && NOTE_LINE_NUMBER (copy) == NOTE_INSN_EXPECTED_VALUE) NOTE_EXPECTED_VALUE (copy) = copy_rtx_and_substitute (NOTE_EXPECTED_VALUE (insn), map, 0); --- 1710,1716 ---- else NOTE_BLOCK (copy) = *mapped_block_p; } ! else if (NOTE_LINE_NUMBER (copy) == NOTE_INSN_EXPECTED_VALUE) NOTE_EXPECTED_VALUE (copy) = copy_rtx_and_substitute (NOTE_EXPECTED_VALUE (insn), map, 0); Index: unroll.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/unroll.c,v retrieving revision 1.193 diff -c -3 -p -r1.193 unroll.c *** unroll.c 13 Jun 2003 03:33:57 -0000 1.193 --- unroll.c 15 Jun 2003 19:22:15 -0000 *************** copy_loop_body (loop, copy_start, copy_e *** 2263,2276 **** the associated rtl. We do not want to share the structure in this new block. */ ! if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED ! && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED_LABEL ! && NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK ! && ((NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_VTOP ! && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_CONT) ! || (last_iteration && unroll_type != UNROLL_COMPLETELY))) ! copy = emit_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn)); else copy = 0; break; --- 2263,2282 ---- the associated rtl. We do not want to share the structure in this new block. */ ! if (NOTE_LINE_NUMBER (insn) > 0) ! copy = emit_line_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn)); + else if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED + && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED_LABEL + && NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK + && ((NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_VTOP + && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_CONT) + || (last_iteration + && unroll_type != UNROLL_COMPLETELY))) + { + copy = emit_note (NULL, NOTE_LINE_NUMBER (insn)); + NOTE_DATA (copy) = NOTE_DATA (insn); + } else copy = 0; break; *************** copy_loop_body (loop, copy_start, copy_e *** 2315,2326 **** instructions before the last insn in the loop, COPY_NOTES_FROM can be a NOTE_INSN_LOOP_CONT note if there is no VTOP note, as in a do .. while loop. */ ! if (GET_CODE (insn) == NOTE ! && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED ! && NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK ! && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_VTOP ! && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_CONT) ! emit_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn)); } } --- 2321,2338 ---- instructions before the last insn in the loop, COPY_NOTES_FROM can be a NOTE_INSN_LOOP_CONT note if there is no VTOP note, as in a do .. while loop. */ ! if (GET_CODE (insn) != NOTE) ! /*NOP*/; ! else if (NOTE_LINE_NUMBER (insn) > 0) ! emit_line_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn)); ! else if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED ! && NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK ! && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_VTOP ! && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_CONT) ! { ! rtx copy = emit_note (NULL, NOTE_LINE_NUMBER (insn)); ! NOTE_DATA (copy) = NOTE_DATA (insn); ! } } } Index: Makefile.in =================================================================== RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v retrieving revision 1.1079 diff -c -3 -p -r1.1079 Makefile.in *** Makefile.in 15 Jun 2003 13:12:58 -0000 1.1079 --- Makefile.in 15 Jun 2003 19:22:26 -0000 *************** LANGHOOKS_DEF_H = langhooks-def.h $(HOOK *** 631,637 **** TARGET_DEF_H = target-def.h $(HOOKS_H) MACHMODE_H = machmode.h machmode.def @extra_modes_file@ RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) ! RTL_H = $(RTL_BASE_H) genrtl.h PARAMS_H = params.h params.def TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h version.h builtins.def \ input.h --- 631,637 ---- TARGET_DEF_H = target-def.h $(HOOKS_H) MACHMODE_H = machmode.h machmode.def @extra_modes_file@ RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) ! RTL_H = $(RTL_BASE_H) genrtl.h input.h PARAMS_H = params.h params.def TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h version.h builtins.def \ input.h
Attachment:
pgp00000.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |