From 6773e15fa5ac64bf67b19088e149f4d3cda2cf9a Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Wed, 30 Jun 2004 11:18:01 -0700 Subject: [PATCH] Conditionally compile support for --enable-mapped_location. * cfgexpand.c: Handle USE_MAPPED_LOCATION case for function_end_locus. * cfglayout.c (insn_locators_initialize): Const cleanup. New macros. * cfgrtl.c (delete_insn): Use new NOTE_DELETED_LABEL_NAME macro. * print-rtl.c (print_rtx): Likewise. * emit-rtl.c: Don't clear NOTE_SOURCE_FILE if USE_MAPPED_LOCATION. * combine.c: Use new SET_INSN_DELETED macro. * flow.c: Likewise. * haifa-sched.c: Likewise. * ifcvt.c: Likewise. * recog.c: Likewise. * reload1.c: Likewise. * diagnostic.c: Use expand_location macro. * pretty-print.c (pp_base_format_text): Likewise. * profile.c: Likewise. * dwarf2out.c: Likewise. Also use expand_location, DECL_IS_BUILTIN. * dwarf2out.c (dwarf2out_decl: Use BUILTINS_LOCATION. * emit-rtl.c (emit_line_note): Simplify if USE_MAPPED_LOCATION. (force_next_line_note, insn_emit): Handle USE_MAPPED_LOCATION case. * final.c (final): Likewise. * haifa-sched.c: Likewise. * integrate.c: Likewise. * jump.c: Likewise. * rtl-error.c: Likewise. * stmt.c (check_seenlabel): Likewise. * tree-pretty-print.c: Likewise. From-SVN: r83921 --- gcc/ChangeLog | 25 +++++++++++++++++++++++++ gcc/cfgexpand.c | 4 ++++ gcc/cfglayout.c | 10 ++++++---- gcc/cfgrtl.c | 2 +- gcc/combine.c | 19 ++++--------------- gcc/diagnostic.c | 29 +++++++++++++++++------------ gcc/dwarf2out.c | 32 ++++++++++++++++++-------------- gcc/emit-rtl.c | 20 ++++++++++++++++++-- gcc/final.c | 7 ++++++- gcc/flow.c | 3 +-- gcc/haifa-sched.c | 22 ++++++++++++++++------ gcc/ifcvt.c | 4 +--- gcc/integrate.c | 5 +++++ gcc/jump.c | 7 ++++++- gcc/pretty-print.c | 7 ++++--- gcc/print-rtl.c | 11 +++++++---- gcc/profile.c | 11 +++++++---- gcc/recog.c | 4 +--- gcc/reload1.c | 10 ++-------- gcc/rtl-error.c | 4 ++++ gcc/stmt.c | 8 ++++++-- gcc/tree-pretty-print.c | 29 +++++++++++++++++++++-------- 22 files changed, 180 insertions(+), 93 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b0eb970d161..b217e27ee79 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -54,6 +54,31 @@ * c-ppoutput.c: Use new source_location typedef instead of fileline. * c-semantics.c: Use new macros. * c-typeck.c: Likewise. + * cfgexpand.c: Handle USE_MAPPED_LOCATION case for function_end_locus. + * cfglayout.c (insn_locators_initialize): Const cleanup. New macros. + * cfgrtl.c (delete_insn): Use new NOTE_DELETED_LABEL_NAME macro. + * print-rtl.c (print_rtx): Likewise. + * emit-rtl.c: Don't clear NOTE_SOURCE_FILE if USE_MAPPED_LOCATION. + * combine.c: Use new SET_INSN_DELETED macro. + * flow.c: Likewise. + * haifa-sched.c: Likewise. + * ifcvt.c: Likewise. + * recog.c: Likewise. + * reload1.c: Likewise. + * diagnostic.c: Use expand_location macro. + * pretty-print.c (pp_base_format_text): Likewise. + * profile.c: Likewise. + * dwarf2out.c: Likewise. Also use expand_location, DECL_IS_BUILTIN. + * dwarf2out.c (dwarf2out_decl: Use BUILTINS_LOCATION. + * emit-rtl.c (emit_line_note): Simplify if USE_MAPPED_LOCATION. + (force_next_line_note, insn_emit): Handle USE_MAPPED_LOCATION case. + * final.c (final): Likewise. + * haifa-sched.c: Likewise. + * integrate.c: Likewise. + * jump.c: Likewise. + * rtl-error.c: Likewise. + * stmt.c (check_seenlabel): Likewise. + * tree-pretty-print.c: Likewise. 2004-06-30 Richard Sandiford Eric Christopher diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 1576566dc92..58592751d6e 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -319,7 +319,11 @@ construct_exit_block (void) /* Make sure the locus is set to the end of the function, so that epilogue line numbers and warnings are set properly. */ +#ifdef USE_MAPPED_LOCATION + if (cfun->function_end_locus != UNKNOWN_LOCATION) +#else if (cfun->function_end_locus.file) +#endif input_location = cfun->function_end_locus; /* The following insns belong to the top scope. */ diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c index e887015ac7f..be890d9b399 100644 --- a/gcc/cfglayout.c +++ b/gcc/cfglayout.c @@ -254,7 +254,7 @@ insn_locators_initialize (void) rtx insn, next; int loc = 0; int line_number = 0, last_line_number = 0; - char *file_name = NULL, *last_file_name = NULL; + const char *file_name = NULL, *last_file_name = NULL; prologue_locator = epilogue_locator = 0; @@ -293,7 +293,7 @@ insn_locators_initialize (void) { loc++; VARRAY_PUSH_INT (file_locators_locs, loc); - VARRAY_PUSH_CHAR_PTR (file_locators_files, file_name); + VARRAY_PUSH_CHAR_PTR (file_locators_files, (char *) file_name); last_file_name = file_name; } } @@ -324,8 +324,10 @@ insn_locators_initialize (void) default: if (NOTE_LINE_NUMBER (insn) > 0) { - line_number = NOTE_LINE_NUMBER (insn); - file_name = (char *)NOTE_SOURCE_FILE (insn); + expanded_location xloc; + NOTE_EXPANDED_LOCATION (xloc, insn); + line_number = xloc.line; + file_name = xloc.file; } break; } diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 8ef48d092a1..ae073c4fc39 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -130,7 +130,7 @@ delete_insn (rtx insn) really_delete = false; PUT_CODE (insn, NOTE); NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED_LABEL; - NOTE_SOURCE_FILE (insn) = name; + NOTE_DELETED_LABEL_NAME (insn) = name; } remove_node_from_expr_list (insn, &nonlocal_goto_handler_labels); diff --git a/gcc/combine.c b/gcc/combine.c index 52c500ae7f1..0762eda455b 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2770,19 +2770,13 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) PATTERN (i2) = newi2pat; } else - { - PUT_CODE (i2, NOTE); - NOTE_LINE_NUMBER (i2) = NOTE_INSN_DELETED; - NOTE_SOURCE_FILE (i2) = 0; - } + SET_INSN_DELETED (i2); if (i1) { LOG_LINKS (i1) = 0; REG_NOTES (i1) = 0; - PUT_CODE (i1, NOTE); - NOTE_LINE_NUMBER (i1) = NOTE_INSN_DELETED; - NOTE_SOURCE_FILE (i1) = 0; + SET_INSN_DELETED (i1); } /* Get death notes for everything that is now used in either I3 or @@ -12045,9 +12039,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2) distribute_notes (old_notes, tem, tem, NULL_RTX); distribute_links (LOG_LINKS (tem)); - PUT_CODE (tem, NOTE); - NOTE_LINE_NUMBER (tem) = NOTE_INSN_DELETED; - NOTE_SOURCE_FILE (tem) = 0; + SET_INSN_DELETED (tem); #ifdef HAVE_cc0 /* Delete the setter too. */ @@ -12061,10 +12053,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2) cc0_setter, NULL_RTX); distribute_links (LOG_LINKS (cc0_setter)); - PUT_CODE (cc0_setter, NOTE); - NOTE_LINE_NUMBER (cc0_setter) - = NOTE_INSN_DELETED; - NOTE_SOURCE_FILE (cc0_setter) = 0; + SET_INSN_DELETED (cc0_setter); } #endif } diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index c7cfb11b504..db4c8fec4da 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -173,13 +173,13 @@ diagnostic_build_prefix (diagnostic_info *diagnostic) #undef DEFINE_DIAGNOSTIC_KIND "must-not-happen" }; - if (diagnostic->kind >= DK_LAST_DIAGNOSTIC_KIND) - abort(); + expanded_location s = expand_location (diagnostic->location); + if (diagnostic->kind >= DK_LAST_DIAGNOSTIC_KIND) + abort(); - return diagnostic->location.file + return s.file ? build_message_string ("%s:%d: %s", - diagnostic->location.file, - diagnostic->location.line, + s.file, s.line, _(diagnostic_kind_text[diagnostic->kind])) : build_message_string ("%s: %s", progname, _(diagnostic_kind_text[diagnostic->kind])); @@ -206,8 +206,9 @@ diagnostic_count_diagnostic (diagnostic_context *context, || diagnostic_kind_count (context, DK_SORRY) > 0) && !context->abort_on_error) { + expanded_location s = expand_location (diagnostic->location); fnotice (stderr, "%s:%d: confused by earlier errors, bailing out\n", - diagnostic->location.file, diagnostic->location.line); + s.file, s.line); exit (FATAL_EXIT_CODE); } #endif @@ -313,16 +314,20 @@ diagnostic_report_current_module (diagnostic_context *context) pp_needs_newline (context->printer) = false; } - if (input_file_stack && diagnostic_last_module_changed (context)) + p = input_file_stack; + if (p && diagnostic_last_module_changed (context)) { - p = input_file_stack; + expanded_location xloc = expand_location (p->location); pp_verbatim (context->printer, "In file included from %s:%d", - p->location.file, p->location.line); + xloc.file, xloc.line); while ((p = p->next) != NULL) - pp_verbatim (context->printer, - ",\n from %s:%d", - p->location.file, p->location.line); + { + xloc = expand_location (p->location); + pp_verbatim (context->printer, + ",\n from %s:%d", + xloc.file, xloc.line); + } pp_verbatim (context->printer, ":\n"); diagnostic_set_last_module (context); } diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 93afca759ed..17b4c2060c0 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -10501,10 +10501,11 @@ add_pure_or_virtual_attribute (dw_die_ref die, tree func_decl) static void add_src_coords_attributes (dw_die_ref die, tree decl) { - unsigned file_index = lookup_filename (DECL_SOURCE_FILE (decl)); + expanded_location s = expand_location (DECL_SOURCE_LOCATION (decl)); + unsigned file_index = lookup_filename (s.file); add_AT_unsigned (die, DW_AT_decl_file, file_index); - add_AT_unsigned (die, DW_AT_decl_line, DECL_SOURCE_LINE (decl)); + add_AT_unsigned (die, DW_AT_decl_line, s.line); } /* Add a DW_AT_name attribute and source coordinate attribute for the @@ -11199,7 +11200,8 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) } else if (old_die) { - unsigned file_index = lookup_filename (DECL_SOURCE_FILE (decl)); + expanded_location s = expand_location (DECL_SOURCE_LOCATION (decl)); + unsigned file_index = lookup_filename (s.file); if (!get_AT_flag (old_die, DW_AT_declaration) /* We can have a normal definition following an inline one in the @@ -11228,7 +11230,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) && (DECL_ARTIFICIAL (decl) || (get_AT_unsigned (old_die, DW_AT_decl_file) == file_index && (get_AT_unsigned (old_die, DW_AT_decl_line) - == (unsigned) DECL_SOURCE_LINE (decl))))) + == (unsigned) s.line)))) { subr_die = old_die; @@ -11247,9 +11249,9 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) if (get_AT_unsigned (old_die, DW_AT_decl_file) != file_index) add_AT_unsigned (subr_die, DW_AT_decl_file, file_index); if (get_AT_unsigned (old_die, DW_AT_decl_line) - != (unsigned) DECL_SOURCE_LINE (decl)) + != (unsigned) s.line) add_AT_unsigned - (subr_die, DW_AT_decl_line, DECL_SOURCE_LINE (decl)); + (subr_die, DW_AT_decl_line, s.line); } } else @@ -11476,16 +11478,16 @@ gen_variable_die (tree decl, dw_die_ref context_die) add_AT_specification (var_die, old_die); if (DECL_NAME (decl)) { - unsigned file_index = lookup_filename (DECL_SOURCE_FILE (decl)); + expanded_location s = expand_location (DECL_SOURCE_LOCATION (decl)); + unsigned file_index = lookup_filename (s.file); if (get_AT_unsigned (old_die, DW_AT_decl_file) != file_index) add_AT_unsigned (var_die, DW_AT_decl_file, file_index); if (get_AT_unsigned (old_die, DW_AT_decl_line) - != (unsigned) DECL_SOURCE_LINE (decl)) + != (unsigned) s.line) - add_AT_unsigned (var_die, DW_AT_decl_line, - DECL_SOURCE_LINE (decl)); + add_AT_unsigned (var_die, DW_AT_decl_line, s.line); } } else @@ -12776,6 +12778,7 @@ dwarf2out_imported_module_or_decl (tree decl, tree context) dw_die_ref imported_die, at_import_die; dw_die_ref scope_die; unsigned file_index; + expanded_location xloc; if (debug_info_level <= DINFO_LEVEL_TERSE) return; @@ -12807,10 +12810,11 @@ dwarf2out_imported_module_or_decl (tree decl, tree context) imported_die = new_die (DW_TAG_imported_module, scope_die, context); else imported_die = new_die (DW_TAG_imported_declaration, scope_die, context); - - file_index = lookup_filename (input_filename); + + xloc = expand_location (input_location); + file_index = lookup_filename (xloc.file); add_AT_unsigned (imported_die, DW_AT_decl_file, file_index); - add_AT_unsigned (imported_die, DW_AT_decl_line, input_line); + add_AT_unsigned (imported_die, DW_AT_decl_line, xloc.line); add_AT_die_ref (imported_die, DW_AT_import, at_import_die); } @@ -12898,7 +12902,7 @@ dwarf2out_decl (tree decl) /* Don't bother trying to generate any DIEs to represent any of the normal built-in types for the language we are compiling. */ - if (DECL_SOURCE_LINE (decl) == 0) + if (DECL_IS_BUILTIN (decl)) { /* OK, we need to generate one for `bool' so GDB knows what type comparisons have. */ diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 91ef8e9fafd..c4235bf3fd1 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -4131,7 +4131,9 @@ emit_note_before (int subtype, rtx before) { rtx note = rtx_alloc (NOTE); INSN_UID (note) = cur_insn_uid++; +#ifndef USE_MAPPED_LOCATION NOTE_SOURCE_FILE (note) = 0; +#endif NOTE_LINE_NUMBER (note) = subtype; BLOCK_FOR_INSN (note) = NULL; @@ -4354,7 +4356,9 @@ emit_note_after (int subtype, rtx after) { rtx note = rtx_alloc (NOTE); INSN_UID (note) = cur_insn_uid++; +#ifndef USE_MAPPED_LOCATION NOTE_SOURCE_FILE (note) = 0; +#endif NOTE_LINE_NUMBER (note) = subtype; BLOCK_FOR_INSN (note) = NULL; add_insn_after (note, after); @@ -4629,10 +4633,15 @@ emit_line_note (location_t location) set_file_and_line_for_stmt (location); +#ifdef USE_MAPPED_LOCATION + if (location == last_location) + return NULL_RTX; +#else if (location.file && last_location.file && !strcmp (location.file, last_location.file) && location.line == last_location.line) return NULL_RTX; +#endif last_location = location; if (no_line_numbers) @@ -4641,8 +4650,12 @@ emit_line_note (location_t location) return NULL_RTX; } +#ifdef USE_MAPPED_LOCATION + note = emit_note ((int) location); +#else note = emit_note (location.line); NOTE_SOURCE_FILE (note) = location.file; +#endif return note; } @@ -4694,7 +4707,11 @@ emit_note (int note_no) void force_next_line_note (void) { +#ifdef USE_MAPPED_LOCATION + last_location = -1; +#else last_location.line = -1; +#endif } /* Place a note of KIND on insn INSN with DATUM as the datum. If a @@ -5154,8 +5171,7 @@ init_emit (void) seq_rtl_expr = NULL; cur_insn_uid = 1; reg_rtx_no = LAST_VIRTUAL_REGISTER + 1; - last_location.line = 0; - last_location.file = 0; + last_location = UNKNOWN_LOCATION; first_label_num = label_num; last_label_num = 0; seq_stack = NULL; diff --git a/gcc/final.c b/gcc/final.c index 65ebaa0bfcb..c7b4a5c4de4 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1520,8 +1520,13 @@ final (rtx first, FILE *file, int optimize, int prescan) if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0) { if (last != 0 +#ifdef USE_MAPPED_LOCATION + && NOTE_SOURCE_LOCATION (insn) == NOTE_SOURCE_LOCATION (last) +#else && NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last) - && NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last)) + && NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last) +#endif) + ) { delete_insn (insn); /* Use delete_note. */ continue; diff --git a/gcc/flow.c b/gcc/flow.c index 1a6546d9540..046d51b5564 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -3391,8 +3391,7 @@ attempt_auto_inc (struct propagate_block_info *pbi, rtx inc, rtx insn, } PUT_CODE (incr, NOTE); - NOTE_LINE_NUMBER (incr) = NOTE_INSN_DELETED; - NOTE_SOURCE_FILE (incr) = 0; + SET_INSN_DELETED (incr); } if (regno >= FIRST_PSEUDO_REGISTER) diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index e3c819c3ea5..122f9714813 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -1559,8 +1559,13 @@ restore_line_notes (rtx head, rtx tail) && (note = LINE_NOTE (insn)) != 0 && note != line && (line == 0 +#ifdef USE_MAPPED_LOCATION + || NOTE_SOURCE_LOCATION (note) != NOTE_SOURCE_LOCATION (line) +#else || NOTE_LINE_NUMBER (note) != NOTE_LINE_NUMBER (line) - || NOTE_SOURCE_FILE (note) != NOTE_SOURCE_FILE (line))) + || NOTE_SOURCE_FILE (note) != NOTE_SOURCE_FILE (line) +#endif + )) { line = note; prev = PREV_INSN (insn); @@ -1577,7 +1582,9 @@ restore_line_notes (rtx head, rtx tail) { added_notes++; new = emit_note_after (NOTE_LINE_NUMBER (note), prev); +#ifndef USE_MAPPED_LOCATION NOTE_SOURCE_FILE (new) = NOTE_SOURCE_FILE (note); +#endif } } if (sched_verbose && added_notes) @@ -1605,17 +1612,20 @@ rm_redundant_line_notes (void) if (active_insn == 0) { notes++; - NOTE_SOURCE_FILE (insn) = 0; - NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED; + SET_INSN_DELETED (insn); } /* If the line number is unchanged, LINE is redundant. */ else if (line +#ifdef USE_MAPPED_LOCATION + && NOTE_SOURCE_LOCATION (line) == NOTE_SOURCE_LOCATION (insn) +#else && NOTE_LINE_NUMBER (line) == NOTE_LINE_NUMBER (insn) - && NOTE_SOURCE_FILE (line) == NOTE_SOURCE_FILE (insn)) + && NOTE_SOURCE_FILE (line) == NOTE_SOURCE_FILE (insn) +#endif +) { notes++; - NOTE_SOURCE_FILE (line) = 0; - NOTE_LINE_NUMBER (line) = NOTE_INSN_DELETED; + SET_INSN_DELETED (line); line = insn; } else diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 053424dc005..647c4e8b74d 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -260,9 +260,7 @@ cond_exec_process_insns (ce_if_block_t *ce_info ATTRIBUTE_UNUSED, { /* ??? Ug. Actually unlinking the thing is problematic, given what we'd have to coordinate with our callers. */ - PUT_CODE (insn, NOTE); - NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED; - NOTE_SOURCE_FILE (insn) = 0; + SET_INSN_DELETED (insn); goto insn_done; } diff --git a/gcc/integrate.c b/gcc/integrate.c index c5befd5cd2f..80eb84bba8c 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -505,8 +505,13 @@ copy_rtx_and_substitute (rtx orig, struct inline_remap *map, int for_lhs) ASM_OPERANDS_INPUT_VEC (copy) = map->copy_asm_operands_vector; ASM_OPERANDS_INPUT_CONSTRAINT_VEC (copy) = map->copy_asm_constraints_vector; +#ifdef USE_MAPPED_LOCATION + ASM_OPERANDS_SOURCE_LOCATION (copy) + = ASM_OPERANDS_SOURCE_LOCATION (orig); +#else ASM_OPERANDS_SOURCE_FILE (copy) = ASM_OPERANDS_SOURCE_FILE (orig); ASM_OPERANDS_SOURCE_LINE (copy) = ASM_OPERANDS_SOURCE_LINE (orig); +#endif return copy; } break; diff --git a/gcc/jump.c b/gcc/jump.c index c69a4894b63..0e45c79b69e 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -142,8 +142,13 @@ purge_line_number_notes (rtx f) { /* Delete this note if it is identical to previous note. */ if (last_note +#ifdef USE_MAPPED_LOCATION + && NOTE_SOURCE_LOCATION (insn) == NOTE_SOURCE_LOCATION (last_note) +#else && NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last_note) - && NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last_note)) + && NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last_note) +#endif +) { delete_related_insns (insn); continue; diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c index f5a1a77490b..d6098a74745 100644 --- a/gcc/pretty-print.c +++ b/gcc/pretty-print.c @@ -305,11 +305,12 @@ pp_base_format_text (pretty_printer *pp, text_info *text) case 'H': { - const location_t *locus = va_arg (*text->args_ptr, location_t *); + location_t *locus = va_arg (*text->args_ptr, location_t *); + expanded_location s = expand_location (*locus); pp_string (pp, "file '"); - pp_string (pp, locus->file); + pp_string (pp, s.file); pp_string (pp, "', line "); - pp_decimal_int (pp, locus->line); + pp_decimal_int (pp, s.line); } break; diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index 4f2223a2ef7..0143f096c29 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -272,10 +272,13 @@ print_rtx (rtx in_rtx) break; case NOTE_INSN_DELETED_LABEL: - if (NOTE_SOURCE_FILE (in_rtx)) - fprintf (outfile, " (\"%s\")", NOTE_SOURCE_FILE (in_rtx)); - else - fprintf (outfile, " \"\""); + { + const char *label = NOTE_DELETED_LABEL_NAME (in_rtx); + if (label) + fprintf (outfile, " (\"%s\")", label); + else + fprintf (outfile, " \"\""); + } break; case NOTE_INSN_PREDICTION: diff --git a/gcc/profile.c b/gcc/profile.c index 0468a0f8284..9a7b933199b 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -922,23 +922,26 @@ branch_prob (void) ignore_next_note = 0; else { + expanded_location s; + if (!offset) { offset = gcov_write_tag (GCOV_TAG_LINES); gcov_write_unsigned (BB_TO_GCOV_INDEX (bb)); } + NOTE_EXPANDED_LOCATION (s, insn); + /* If this is a new source file, then output the file's name to the .bb file. */ if (!prev_file_name - || strcmp (NOTE_SOURCE_FILE (insn), - prev_file_name)) + || strcmp (s.file, prev_file_name)) { - prev_file_name = NOTE_SOURCE_FILE (insn); + prev_file_name = s.file; gcov_write_unsigned (0); gcov_write_string (prev_file_name); } - gcov_write_unsigned (NOTE_LINE_NUMBER (insn)); + gcov_write_unsigned (s.line); } } insn = NEXT_INSN (insn); diff --git a/gcc/recog.c b/gcc/recog.c index 4fcb6eea428..ad2dd9a49cd 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -2677,9 +2677,7 @@ split_insn (rtx insn) return NULL_RTX; /* try_split returns the NOTE that INSN became. */ - PUT_CODE (insn, NOTE); - NOTE_SOURCE_FILE (insn) = 0; - NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED; + SET_INSN_DELETED (insn); /* ??? Coddle to md files that generate subregs in post-reload splitters instead of computing the proper hard register. */ diff --git a/gcc/reload1.c b/gcc/reload1.c index ea01b688506..9a5d40ba111 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -1059,11 +1059,7 @@ reload (rtx first, int global) else if (reg_set_p (regno_reg_rtx[i], PATTERN (equiv_insn))) delete_dead_insn (equiv_insn); else - { - PUT_CODE (equiv_insn, NOTE); - NOTE_SOURCE_FILE (equiv_insn) = 0; - NOTE_LINE_NUMBER (equiv_insn) = NOTE_INSN_DELETED; - } + SET_INSN_DELETED (equiv_insn); } } } @@ -1911,9 +1907,7 @@ delete_dead_insn (rtx insn) && ! side_effects_p (SET_SRC (PATTERN (prev)))) delete_dead_insn (prev); - PUT_CODE (insn, NOTE); - NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED; - NOTE_SOURCE_FILE (insn) = 0; + SET_INSN_DELETED (insn); } /* Modify the home of pseudo-reg I. diff --git a/gcc/rtl-error.c b/gcc/rtl-error.c index 72ef094b112..16d53506b48 100644 --- a/gcc/rtl-error.c +++ b/gcc/rtl-error.c @@ -59,10 +59,14 @@ location_for_asm (rtx insn) asmop = NULL; if (asmop) +#ifdef USE_MAPPED_LOCATION + loc = ASM_OPERANDS_SOURCE_LOCATION (asmop); +#else { loc.file = ASM_OPERANDS_SOURCE_FILE (asmop); loc.line = ASM_OPERANDS_SOURCE_LINE (asmop); } +#endif else loc = input_location; return loc; diff --git a/gcc/stmt.c b/gcc/stmt.c index 5ee55b9e699..0b282bb623e 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -1565,7 +1565,7 @@ expand_asm_operands (tree string, tree outputs, tree inputs, : GET_MODE (output_rtx[0])), TREE_STRING_POINTER (string), empty_string, 0, argvec, constraintvec, - locus.file, locus.line); + locus); MEM_VOLATILE_P (body) = vol; @@ -1715,7 +1715,7 @@ expand_asm_operands (tree string, tree outputs, tree inputs, (GET_MODE (output_rtx[i]), TREE_STRING_POINTER (string), constraints[i], i, argvec, constraintvec, - locus.file, locus.line)); + locus)); MEM_VOLATILE_P (SET_SRC (XVECEXP (body, 0, i))) = vol; } @@ -3871,8 +3871,12 @@ check_seenlabel (void) if (insn) { location_t locus; +#ifdef USE_MAPPED_LOCATION + locus = NOTE_SOURCE_LOCATION (insn); +#else locus.file = NOTE_SOURCE_FILE (insn); locus.line = NOTE_LINE_NUMBER (insn); +#endif warning ("%Hunreachable code at beginning of %s", &locus, case_stack->data.case_stmt.printname); } diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 9eb478caaac..9d415fa8873 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -231,13 +231,14 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, && (flags & TDF_LINENO) && EXPR_HAS_LOCATION (node)) { + expanded_location xloc = expand_location (EXPR_LOCATION (node)); pp_character (buffer, '['); - if (EXPR_FILENAME (node)) + if (xloc.file) { - pp_string (buffer, EXPR_FILENAME (node)); + pp_string (buffer, xloc.file); pp_string (buffer, " : "); } - pp_decimal_int (buffer, EXPR_LINENO (node)); + pp_decimal_int (buffer, xloc.line); pp_string (buffer, "] "); } @@ -556,7 +557,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, break; case TYPE_DECL: - if (strcmp (DECL_SOURCE_FILE (node), "") == 0) + if (DECL_IS_BUILTIN (node)) { /* Don't print the declaration of built-in types. */ break; @@ -2224,15 +2225,27 @@ dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent, { INDENT (indent); - if ((flags & TDF_LINENO) && e->goto_locus) + if ((flags & TDF_LINENO) +#ifdef USE_MAPPED_LOCATION + && e->goto_locus != UNKNOWN_LOCATION +#else + && e->goto_locus +#endif + ) { + expanded_location goto_xloc; +#ifdef USE_MAPPED_LOCATION + goto_xloc = expand_location (e->goto_locus); +#else + goto_xloc = *e->goto_locus; +#endif pp_character (buffer, '['); - if (e->goto_locus->file) + if (goto_xloc.file) { - pp_string (buffer, e->goto_locus->file); + pp_string (buffer, goto_xloc.file); pp_string (buffer, " : "); } - pp_decimal_int (buffer, e->goto_locus->line); + pp_decimal_int (buffer, goto_xloc.line); pp_string (buffer, "] "); } -- 2.30.2