From 3208c33e82cba29f83c979a5a149836bc2747031 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 8 Apr 2016 17:41:34 -0400 Subject: [PATCH 52/91] FIXME: populate x_crtl; more typesafety --- gcc/rtl/rtl-frontend.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/gcc/rtl/rtl-frontend.c b/gcc/rtl/rtl-frontend.c index 3b3114d..c2d1316 100644 --- a/gcc/rtl/rtl-frontend.c +++ b/gcc/rtl/rtl-frontend.c @@ -315,13 +315,13 @@ class function_reader : public rtx_reader void create_function (); void apply_fixups (); - rtx *get_insn_by_uid (int uid); + rtx_insn **get_insn_by_uid (int uid); rtx_insn *get_first_insn () const { return m_first_insn; } private: struct uid_hash : int_hash {}; - hash_map m_insns_by_uid; + hash_map m_insns_by_uid; auto_vec m_fixups; int m_max_bb_idx; rtx_insn *m_first_insn; @@ -346,7 +346,7 @@ get_operand_name (rtx insn, int operand_idx) void fixup_insn_uid::apply (function_reader *reader) const { - rtx *insn_from_uid = reader->get_insn_by_uid (m_insn_uid); + rtx_insn **insn_from_uid = reader->get_insn_by_uid (m_insn_uid); if (insn_from_uid) XEXP (m_insn, m_operand_idx) = *insn_from_uid; else @@ -403,7 +403,7 @@ fixup_jump_label::apply (function_reader *reader) const #endif { int label_uid = atoi (m_label); - rtx *insn_from_uid = reader->get_insn_by_uid (label_uid); + rtx_insn **insn_from_uid = reader->get_insn_by_uid (label_uid); if (insn_from_uid) JUMP_LABEL (m_insn) = *insn_from_uid; else @@ -449,15 +449,20 @@ function_reader::handle_unknown_directive (file_location start_loc, rtx x = read_rtx_code (name); if (!x) return; + rtx_insn *insn = as_a (x); + set_last_insn (insn); if (!m_first_insn) - m_first_insn = as_a (x); + { + m_first_insn = insn; + set_first_insn (insn); + } int c = read_char (); location_t end_loc = get_current_location (); unread_char (c); location_t insn_loc = make_location (start_loc, start_loc, end_loc); inform (insn_loc, "input insn"); - debug (x); - m_insns_by_uid.put (INSN_UID(x), x); + debug (insn); + m_insns_by_uid.put (INSN_UID (insn), insn); } void @@ -596,7 +601,7 @@ function_reader::apply_fixups () f->apply (this); } -rtx * +rtx_insn ** function_reader::get_insn_by_uid (int uid) { return m_insns_by_uid.get (uid); -- 1.8.5.3