* 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
* 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 <rsandifo@redhat.com>
Eric Christopher <echristo@redhat.com>
/* 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. */
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;
{
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;
}
}
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;
}
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);
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
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. */
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
}
#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]));
|| 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
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);
}
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
}
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
&& (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;
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
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
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;
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);
}
/* 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. */
{
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;
{
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);
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)
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;
}
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
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;
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;
}
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)
&& (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);
{
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)
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
{
/* ??? 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;
}
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;
{
/* 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;
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;
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:
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);
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. */
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);
}
}
}
&& ! 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.
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;
: GET_MODE (output_rtx[0])),
TREE_STRING_POINTER (string),
empty_string, 0, argvec, constraintvec,
- locus.file, locus.line);
+ locus);
MEM_VOLATILE_P (body) = vol;
(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;
}
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);
}
&& (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, "] ");
}
break;
case TYPE_DECL:
- if (strcmp (DECL_SOURCE_FILE (node), "<built-in>") == 0)
+ if (DECL_IS_BUILTIN (node))
{
/* Don't print the declaration of built-in types. */
break;
{
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, "] ");
}