MIPS assembler branch relaxations

Alexandre Oliva aoliva@redhat.com
Wed Oct 9 16:51:00 GMT 2002


On Sep 17, 2002, Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> wrote:

> Alexandre Oliva wrote:

>> Ok, I'm now convinced not doing such relaxations under certain
>> conditions is the way to go.  But what are the exact conditions?
>> nomacro (as suggested),

> Always, as it should prevent expansions.

>> noat (to avoid clobbering $at in the expanded
>> sequences)

> Only if $at is actually used. AFAICS this is the PIC case.

Below you'll find a revised patch that prevents us from attempting to
do branch relaxation in the two cases above, and that introduces the 
-relax-branch and -no-relax-branch options.  -no-relax-branch is in
effect by default, because I found out the assembler generates worse
code for:

	la	$3,l2-l3	# -30

in gas/testsuite/gas/mips/empic.s, because by the time it computes the
offset between l3 and l2, it's already committed to a longer expansion
of `la', instead of the single-instruction it uses currently.  This
could probably be overcome using generic relaxation tables, but that's
too much work for now.

> Btw, your patch uses explicit binary patterns to create insns, is it
> actually impossible to use mips_ip()/append_insn() instead?

I haven't really tried to do it, out of fear of running into corner
cases such as the conversion of `j' to `b' in EMBEDDED_PIC.  I agree
it would be desirable, but I preferred not to take the risk, since
it's essential to know in advance exactly which instructions we're
going to emit.


Ok to install?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gas-mips-branch-relax.patch
Type: text/x-patch
Size: 36995 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20021009/a9673628/attachment.bin>
-------------- next part --------------

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer


More information about the Binutils mailing list