The iq2000-elf port will not currently build libgcc due to triggering
this assert in dwarf2out.c::dwarf2out_var_location
gcc_assert (prev
&& (CALL_P (prev)
|| (NONJUMP_INSN_P (prev)
&& GET_CODE (PATTERN (prev)) == SEQUENCE
&& CALL_P (XVECEXP (PATTERN (prev), 0, 0)))));
We've seen a NOTE_INSN_CALL_ARG_LOCATION and we expect the previous real
insn to be an actual CALL_INSN (or CALL_INSN with a delay slot wrapped
in a SEQUENCE).
The problem is the iq2000 defines its own final_prescan_insn which emits
a NOP insn between the CALL and the NOTE_INSN_CALL_ARG_LOCATION,
breaking the assumptions for NOTE_INSN_CALL_ARG_LOCATION.
This patch ensures that the iq2000 does not split up the CALL and note
by emitting the NOP after the note.
With this patch the iq2000 port will build libgcc as well as newlib
successfully.
Given the port is broken badly enough to not build libgcc, this is
almost certainly a regression relative to prior releases.
Installing on the trunk.
JEff
commit 5c5e23e8b258c9efb96b3574a4d52cf59b862b84
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri Apr 7 14:26:05 2017 +0000
* config/iq2000/iq2000.c (final_prescan_insn): Do not separate a
CALL and NOTE_INSN_CALL_ARG_LOCATION.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246761
138bc75d-0d04-0410-961f-82ee72b054a4
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 099805d..d68f161 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-07 Jeff Law <l...@redhat.com>
+
+ * config/iq2000/iq2000.c (final_prescan_insn): Do not separate a
+ CALL and NOTE_INSN_CALL_ARG_LOCATION.
+
2017-04-07 Martin Liska <mli...@suse.cz>
PR target/79889
diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c
index 7e1ba00..99abd76 100644
--- a/gcc/config/iq2000/iq2000.c
+++ b/gcc/config/iq2000/iq2000.c
@@ -1540,8 +1540,13 @@ final_prescan_insn (rtx_insn *insn, rtx opvec[]
ATTRIBUTE_UNUSED,
|| (GET_CODE (PATTERN (insn)) == RETURN))
&& NEXT_INSN (PREV_INSN (insn)) == insn)
{
- rtx_insn *nop_insn = emit_insn_after (gen_nop (), insn);
+ rtx_insn *tmp = insn;
+ while (NEXT_INSN (tmp)
+ && NOTE_P (NEXT_INSN (tmp))
+ && NOTE_KIND (NEXT_INSN (tmp)) == NOTE_INSN_CALL_ARG_LOCATION)
+ tmp = NEXT_INSN (tmp);
+ rtx_insn *nop_insn = emit_insn_after (gen_nop (), tmp);
INSN_ADDRESSES_NEW (nop_insn, -1);
}