From a0c3e29c0cd84bb0864691252551259ba61e8ecb Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 7 Apr 2016 05:20:29 -0400 Subject: [PATCH 22/91] FIXME: error_at rather than error when insn UID not found --- gcc/read-md.c | 2 +- gcc/read-md.h | 3 +++ gcc/read-rtl.c | 13 ++++++++----- gcc/rtl.h | 2 +- gcc/rtl/rtl-frontend.c | 4 ++-- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gcc/read-md.c b/gcc/read-md.c index 0975758..8cbc8db 100644 --- a/gcc/read-md.c +++ b/gcc/read-md.c @@ -90,7 +90,7 @@ static size_t max_include_len; /* FIXME. */ -static rtx_reader *rtx_reader_ptr; +rtx_reader *rtx_reader_ptr; /* A table of md_constant structures, hashed by name. Null if no constant expansion should occur. */ diff --git a/gcc/read-md.h b/gcc/read-md.h index c0ace66..716a5a1 100644 --- a/gcc/read-md.h +++ b/gcc/read-md.h @@ -107,6 +107,9 @@ class rtx_reader const line_map_ordinary *m_current_linemap; }; +/* Global singleton. */ +extern rtx_reader *rtx_reader_ptr; + class noop_reader : public rtx_reader { public: diff --git a/gcc/read-rtl.c b/gcc/read-rtl.c index 57adf42..e56bf42 100644 --- a/gcc/read-rtl.c +++ b/gcc/read-rtl.c @@ -1142,22 +1142,24 @@ parse_note_insn_name (const char *string) class fixup { public: - fixup (rtx insn, int operand_idx, int insn_uid) - : m_insn (insn), m_operand_idx (operand_idx), m_insn_uid (insn_uid) + fixup (file_location loc, rtx insn, int operand_idx, int insn_uid) + : m_loc (loc), m_insn (insn), m_operand_idx (operand_idx), + m_insn_uid (insn_uid) {} + file_location m_loc; rtx m_insn; int m_operand_idx; int m_insn_uid; }; static vec fixups; -void fixup_insn_refs (void (*cb) (rtx, int, int)) +void fixup_insn_refs (void (*cb) (file_location, rtx, int, int)) { int i; fixup *f; FOR_EACH_VEC_ELT (fixups, i, f) - (*cb) (f->m_insn, f->m_operand_idx, f->m_insn_uid); + (*cb) (f->m_loc, f->m_insn, f->m_operand_idx, f->m_insn_uid); } /* Subroutine of read_rtx and read_nested_rtx. CODE_NAME is the name of @@ -1324,7 +1326,8 @@ read_rtx_code (const char *code_name) fprintf (stderr, "FIXME: would store insn %i into field %i of %s %p\n", insn_id, i, code_name, (void *)return_rtx); - fixup f (return_rtx, i, insn_id); + file_location loc = rtx_reader_ptr->get_current_location (); + fixup f (loc, return_rtx, i, insn_id); fixups.safe_push (f); } #endif diff --git a/gcc/rtl.h b/gcc/rtl.h index d285e66..c6c1f3a 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -3643,7 +3643,7 @@ extern rtx make_debug_expr_from_rtl (const_rtx); extern bool read_rtx (const char *, vec *); #endif extern rtx read_rtx_code (const char *code_name); -extern void fixup_insn_refs (void (*cb) (rtx, int, int)); +extern void fixup_insn_refs (void (*cb) (location_t, rtx, int, int)); /* In alias.c */ extern rtx canon_rtx (rtx); diff --git a/gcc/rtl/rtl-frontend.c b/gcc/rtl/rtl-frontend.c index ea2abf6..6b92ea9 100644 --- a/gcc/rtl/rtl-frontend.c +++ b/gcc/rtl/rtl-frontend.c @@ -177,13 +177,13 @@ function_reader::handle_unknown_directive (file_location loc, const char *name) } static void -fixup_cb (rtx insn, int operand_idx, int insn_uid) +fixup_cb (file_location loc, rtx insn, int operand_idx, int insn_uid) { rtx *insn_from_uid = insns_by_uid.get (insn_uid); if (insn_from_uid) XEXP (insn, operand_idx) = *insn_from_uid; else - error ("insn UID %i not found", insn_uid); + error_at (loc, "insn UID %i not found", insn_uid); } static void -- 1.8.5.3