This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [10/11] TI C6X binutils port: gas/
On Wed, 24 Mar 2010, DJ Delorie wrote:
> > I hope to add that support in future (definitely for objdump, hopefully
> > for gas as well). It's quite a complicated whole-function optimization
> > problem;
>
> It sounds like the optimization (or at least part of it) belongs in
> gcc, then, but gas doesn't even have a way to manually specify compact
> insns. You'd need linker branch relaxing to get it right 100% of the
> time, though, and even then it's tricky.
Linker branch relaxation is certainly a possible future feature, but
mainly for branches exceeding the 21-bit offset limit in large programs
if that proves to be an issue in practice.
My understanding is that TI's compiler tries to choose instructions that
be compacted (preferring the restricted set of registers allowed in most
compact instructions, for example) but leaves the final choice of
encodings to the assembler (and maybe linker); it doesn't model exact
instruction widths and restrictions precisely enough to do its own
splitting into fetch packets and choice of 16-bit/32-bit instructions.
Similar issues arise with Thumb-2 (ARM's compiler may do a better job than
GCC of modelling things; in GCC one issue is that instruction length
information, depending on register allocation, is needed a long time
before register allocation) - indeed, code alignment via selective use of
wide instruction forms where narrow ones are also available (rather than
using NOPs), a whole-function problem similar to but simpler than the one
I mentioned for C6X, is also of potential use on Thumb-2.
--
Joseph S. Myers
joseph@codesourcery.com