This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Question about insn lengths
- From: Andrew Haley <aph at redhat dot com>
- To: Pontus Lidman <pontus at lysator dot liu dot se>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 2 Nov 2004 10:08:41 +0000
- Subject: Question about insn lengths
- References: <n6654ofuip.fsf@nazgul.lysator.liu.se>
Pontus Lidman writes:
>
> I'm wondering: how, when and where can I find out the exact length of
> an insn?
>
> I'm working on support for the Toshiba MIPS R5900. It has an errata
> related to short loops ; loops must not be less than 6 instructions in
> length. One solution is to insert nops until the loop is long
> enough. To determine the amount of nops, I need to know the exact
> number of instruction words that will be generated from a given RTL
> insn.
>
> I have a loop lengthening pass based on patches for earlier gcc
> versions. I adapted it and inserted it after branch shortening, and I
> re-run branch shortening afterwards. This works for most, but not all
> cases. The problem seems to be that the instruction lengths returned
> by get_attr_length() can sometimes overestimate the length of an insn.
>
> For example, I noticed that the 'mfhilo_si' insn has length attribute
> 12 (because of possible future nops due to hazards I gather), but
> generates only one instruction word (mflo, for example), so the value
> I need for this insn is 4.
Where do the hazard nops get inserted? The assembler?
Andrew.