* [MIPS] Fix thinko in insn length calculation
@ 2010-11-20 19:39 Eric Botcazou
2010-11-21 14:08 ` Richard Sandiford
0 siblings, 1 reply; 2+ messages in thread
From: Eric Botcazou @ 2010-11-20 19:39 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 713 bytes --]
Hi,
we're having "Branch out of range" messages from GAS on IRIX with our GCC 4.5
based compiler. It turns out that there is a thinko (aka Ariane V syndrome)
in the new insn length calculation code: some lengths are measured in insns
while others are measured in bytes.
Bootstrapped C/Ada and tested against our internal testsuite. OK for mainline
and 4.5 branch?
2010-11-20 Eric Botcazou <ebotcazou@adacore.com>
* config/mips/mips.c (machine_function): Rename load_label_length to
load_label_num_insns.
(mips_load_label_length): Rename to...
(mips_load_label_num_insns): ...this. Adjust to first renaming.
(mips_adjust_insn_length): Adjust to second renaming. Fix thinko.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 1542 bytes --]
Index: config/mips/mips.c
===================================================================
--- config/mips/mips.c (revision 166973)
+++ config/mips/mips.c (working copy)
@@ -346,7 +346,7 @@ struct GTY(()) machine_function {
/* How many instructions it takes to load a label into $AT, or 0 if
this property hasn't yet been calculated. */
- unsigned int load_label_length;
+ unsigned int load_label_num_insns;
/* True if mips_adjust_insn_length should ignore an instruction's
hazard attribute. */
@@ -11275,14 +11275,14 @@ mips_process_load_label (rtx target)
/* Return the number of instructions needed to load a label into $AT. */
static unsigned int
-mips_load_label_length (void)
+mips_load_label_num_insns (void)
{
- if (cfun->machine->load_label_length == 0)
+ if (cfun->machine->load_label_num_insns == 0)
{
mips_process_load_label (pc_rtx);
- cfun->machine->load_label_length = mips_multi_num_insns;
+ cfun->machine->load_label_num_insns = mips_multi_num_insns;
}
- return cfun->machine->load_label_length;
+ return cfun->machine->load_label_num_insns;
}
/* Emit an asm sequence to start a noat block and load the address
@@ -11324,7 +11324,7 @@ mips_adjust_insn_length (rtx insn, int l
/* Load the label into $AT and jump to it. Ignore the delay
slot of the jump. */
- length += mips_load_label_length () + 4;
+ length += 4 * mips_load_label_num_insns() + 4;
}
/* A unconditional jump has an unfilled delay slot if it is not part
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [MIPS] Fix thinko in insn length calculation
2010-11-20 19:39 [MIPS] Fix thinko in insn length calculation Eric Botcazou
@ 2010-11-21 14:08 ` Richard Sandiford
0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2010-11-21 14:08 UTC (permalink / raw)
To: Eric Botcazou; +Cc: gcc-patches
Eric Botcazou <ebotcazou@adacore.com> writes:
> 2010-11-20 Eric Botcazou <ebotcazou@adacore.com>
>
> * config/mips/mips.c (machine_function): Rename load_label_length to
> load_label_num_insns.
> (mips_load_label_length): Rename to...
> (mips_load_label_num_insns): ...this. Adjust to first renaming.
> (mips_adjust_insn_length): Adjust to second renaming. Fix thinko.
OK, thanks.
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-11-21 10:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-20 19:39 [MIPS] Fix thinko in insn length calculation Eric Botcazou
2010-11-21 14:08 ` Richard Sandiford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).