This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix s390 --with-mode=esa bootstrap (PR bootstrap/51860)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 16 Jan 2012 14:38:32 +0100
- Subject: [PATCH] Fix s390 --with-mode=esa bootstrap (PR bootstrap/51860)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
We get a -fcompare-debug failure on s390 -mesa on c-common.c, the
problem is in s390_chunkify_start which behaves differently when
a call is followed by NOTE_INSN_CALL_ARG_LOCATION.
We skip the calls that are followed by that note in order to
avoid inserting jumps and literal pools in between the call and
following note, but while the call has the same INSN_ADDRESS
between -g and -g0, the following note has different INSN_ADDRESS,
which means that with -g0 we don't emit the jump + litpool after
the call, because the address hasn't reached the limit yet (and insert
it after the next insn), but with -g where we ignore the call, when
processing NOTE_INSN_CALL_ARG_LOCATION its INSN_ADDRESS reached the
limit already and thus we emit the jump + litpool after the note,
i.e. before the following real insn.
Fixed thusly, bootstrapped on s390-linux --with-mode=esa. Ok for trunk?
2012-01-16 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/51860
* config/s390/s390.c (s390_chunkify_start): Don't skip
call insns followed by NOTE_INSN_CALL_ARG_LOCATION note. Skip
NOTE_INSN_VAR_LOCATION and NOTE_INSN_CALL_ARG_LOCATION notes.
If insn is followed by NOTE_INSN_VAR_LOCATION or
NOTE_INSN_CALL_ARG_LOCATION notes, insert jump after all those notes.
Don't use location of note insns.
--- gcc/config/s390/s390.c.jj 2011-12-08 16:36:51.782961666 +0100
+++ gcc/config/s390/s390.c 2012-01-16 11:49:31.457594861 +0100
@@ -6608,15 +6608,6 @@ s390_chunkify_start (void)
pending_ltrel = pool_ref;
}
}
- /* Make sure we do not split between a call and its
- corresponding CALL_ARG_LOCATION note. */
- if (CALL_P (insn))
- {
- rtx next = NEXT_INSN (insn);
- if (next && NOTE_P (next)
- && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
- continue;
- }
}
if (GET_CODE (insn) == JUMP_INSN || GET_CODE (insn) == CODE_LABEL)
@@ -6627,8 +6618,18 @@ s390_chunkify_start (void)
gcc_assert (!pending_ltrel);
}
- if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_SWITCH_TEXT_SECTIONS)
- section_switch_p = true;
+ if (NOTE_P (insn))
+ switch (NOTE_KIND (insn))
+ {
+ case NOTE_INSN_SWITCH_TEXT_SECTIONS:
+ section_switch_p = true;
+ break;
+ case NOTE_INSN_VAR_LOCATION:
+ case NOTE_INSN_CALL_ARG_LOCATION:
+ continue;
+ default:
+ break;
+ }
if (!curr_pool
|| INSN_ADDRESSES_SIZE () <= (size_t) INSN_UID (insn)
@@ -6674,7 +6675,7 @@ s390_chunkify_start (void)
|| curr_pool->size > S390_POOL_CHUNK_MAX
|| section_switch_p)
{
- rtx label, jump, barrier;
+ rtx label, jump, barrier, next, prev;
if (!section_switch_p)
{
@@ -6684,9 +6685,19 @@ s390_chunkify_start (void)
if (get_attr_length (insn) == 0)
continue;
/* Don't separate LTREL_BASE from the corresponding
- LTREL_OFFSET load. */
+ LTREL_OFFSET load. */
if (pending_ltrel)
continue;
+ next = insn;
+ do
+ {
+ insn = next;
+ next = NEXT_INSN (insn);
+ }
+ while (next
+ && NOTE_P (next)
+ && (NOTE_KIND (next) == NOTE_INSN_VAR_LOCATION
+ || NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION));
}
else
{
@@ -6699,7 +6710,14 @@ s390_chunkify_start (void)
}
label = gen_label_rtx ();
- jump = emit_jump_insn_after (gen_jump (label), insn);
+ prev = insn;
+ if (prev && NOTE_P (prev))
+ prev = prev_nonnote_insn (prev);
+ if (prev)
+ jump = emit_jump_insn_after_setloc (gen_jump (label), insn,
+ INSN_LOCATOR (prev));
+ else
+ jump = emit_jump_insn_after_noloc (gen_jump (label), insn);
barrier = emit_barrier_after (jump);
insn = emit_label_after (label, barrier);
JUMP_LABEL (jump) = label;
Jakub