This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question about insn lengths
On Tue, 2004-11-02 at 19:06 -0500, DJ Delorie wrote:
> Personally, I've grown towards letting gas deal with anything that
> requires knowledge of the actual number bytes emitted, since gas
> happens to have the exactly correct number anyway, while gcc must try
> to guess accurately. Unless there's a compelling reason for gcc to
> know opcode lengths for other reasons.
Which is precisely how I think it ought to work as well, except for
targets which do linker relaxation.
I once embarked on a project to get 100% accurate insn lengths from
one of my ports. After a fair amount of hacking I realized it was
going to be damn near impossible -- peepholes, reorg and the like
really get in the way of 100% accurate lengths.
The exercise was still useful though -- the lengths for the port in
question (PA) got a lot more accurate, leading to fewer long jumps
particularly for conditionals.
Ever since that experience I've fallen into the "if you need 100%
exact lengths, do the work in the assembler or linker".
jeff