Question about insn lengths

Pontus Lidman pontus@lysator.liu.se
Tue Nov 2 09:56:00 GMT 2004


Hello,

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.

Any advice is greatly appreciated.

Pontus

-- 
Pontus Lidman, pontus@lysator.liu.se, Software Engineer
No matter how cynical you get, it's impossible to keep up.
Scene: www.dc-s.com | MUD: tyme.envy.com 6969 | irc: irc.quakenet.eu.org



More information about the Gcc mailing list