From dea1bc44a9a50081c69ea62eddc92df4c13f74a7 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 7 Apr 2016 17:56:03 -0400 Subject: [PATCH 40/91] FIXME: fix the NOTE_BASIC_BLOCK of NOTE_INSN_BASIC_BLOCK --- gcc/read-md.h | 6 ++++++ gcc/read-rtl.c | 4 ++++ gcc/rtl/rtl-frontend.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/gcc/read-md.h b/gcc/read-md.h index 6a7a551..9946e54 100644 --- a/gcc/read-md.h +++ b/gcc/read-md.h @@ -104,6 +104,12 @@ class rtx_reader int /*operand_idx*/, int /*bb_idx*/) {} + virtual void add_fixup_note_insn_basic_block (file_location /*loc*/, + rtx /*insn*/, + int /*operand_idx*/, + int /*bb_idx*/) + {} + file_location get_current_location () const; void update_location (bool advancing); diff --git a/gcc/read-rtl.c b/gcc/read-rtl.c index 96a7ddc..b3ff47c 100644 --- a/gcc/read-rtl.c +++ b/gcc/read-rtl.c @@ -1364,6 +1364,10 @@ read_rtx_code (const char *code_name) file_location bb_idx_loc = read_name (&name); /* FIXME: do something with this. */ inform (bb_idx_loc, "got bb_idx_loc: %qs", name.string); + int bb_idx = atoi (name.string); + rtx_reader_ptr->add_fixup_note_insn_basic_block (bb_loc, + return_rtx, i, + bb_idx); c = read_skip_spaces (); if (c != ']') fatal_expected_char (']', c); diff --git a/gcc/rtl/rtl-frontend.c b/gcc/rtl/rtl-frontend.c index 4840426..3023b9c 100644 --- a/gcc/rtl/rtl-frontend.c +++ b/gcc/rtl/rtl-frontend.c @@ -209,6 +209,21 @@ class fixup_bb : public fixup int m_bb_idx; }; +class fixup_note_insn_basic_block : public fixup +{ + public: + fixup_note_insn_basic_block (file_location loc, rtx insn, int operand_idx, + int bb_idx) + : fixup (loc, insn, operand_idx), + m_bb_idx (bb_idx) + {} + + void apply (function_reader *reader) const; + + private: + int m_bb_idx; +}; + class function_reader : public rtx_reader { public: @@ -225,6 +240,9 @@ class function_reader : public rtx_reader void add_fixup_bb (file_location loc, rtx insn, int operand_idx, int bb_id); + void add_fixup_note_insn_basic_block (file_location loc, rtx insn, + int operand_idx, int bb_idx); + void create_function (); void apply_fixups (); @@ -288,6 +306,14 @@ fixup_bb::apply (function_reader */*reader*/) const BB_END (bb) = insn; } +void +fixup_note_insn_basic_block::apply (function_reader */*reader*/) const +{ + basic_block bb = BASIC_BLOCK_FOR_FN (cfun, m_bb_idx); + gcc_assert (bb); + NOTE_BASIC_BLOCK (m_insn) = bb; +} + function_reader::~function_reader () { int i; @@ -331,6 +357,15 @@ function_reader::add_fixup_bb (file_location loc, rtx insn, int operand_idx, } void +function_reader::add_fixup_note_insn_basic_block (file_location loc, rtx insn, + int operand_idx, int bb_idx) +{ + m_fixups.safe_push (new fixup_note_insn_basic_block (loc, insn, operand_idx, + bb_idx)); +} + + +void function_reader::create_function () { #if 1 -- 1.8.5.3