gcc/ia64 codegenerator questions
robert.muth@intel.com
robert.muth@intel.com
Wed Aug 28 11:20:00 GMT 2002
My group is working on a tool to optimize ia64 binaries.
It already works with images produced by intel compilers.
and I am trying to make it work for gcc as well.
I am using gcc 3.1 so my observations might already be outdated.
* break instructions after non returning calls
I believe that gcc tries to put a break instruction
after a call to functions like abort.
This is very useful to us as it keeps us from having
"impossible" control edges in our cfg.
I think this also necessary for "unwind" to work correctly.
the problem is that with -O3 the break seems to get optimized
away. This can be reproduced with the following simple program:
#include <stdlib.h>
void do_abort ()
{
abort ();
}
* delayed saving of ar.lc
In the code snippet below the prolog ends rather late
and even includes a call. Is this intentional or
is this a bug?
.endp efloor#
.align 16
.proc eldexp#
eldexp:
.prologue 12, 36
.mii
.save ar.pfs, r37
alloc r37 = ar.pfs, 3, 4, 5, 0
.fframe 32
adds r12 = -32, r12
;;
adds r35 = 18, r12
.mmi
mov r39 = r32
adds r40 = 16, r12
mov r32 = r1
.mib
nop.m 0
.save rp, r36
mov r36 = b0
br.call.sptk.many b0 = emovi#
;;
.mii
ld2 r8 = [r35]
mov r1 = r32
adds r39 = 16, r12
.mmb
mov r40 = r0
mov r41 = r0
nop.b 0
.mii
addl r43 = 64, r0
.save ar.lc, r38
mov r38 = ar.lc
.body
;;
add r3 = r33, r8
;;
.mib
mov r42 = r3
nop.i 0
* tail calls
It seems to me that tail calls are a little bit fragile
with respect to "unwinding".
In the code snippet below the alloc instruction
just before the actual tail call will hide the registers
r40 and r39. If I set a breakpoint at the last nop.i
in the debugger and try to unwind from there I might
have a problem.
.L333:
.mii
addl r24 = @gprel(subflg#), gp
addl r25 = 1, r0
mov r32 = r37
.mii
nop.m 0
mov ar.pfs = r39
;;
mov ar.lc = r40
.mii
st4 [r24] = r25
mov b0 = r38
;;
nop.i 0
.mib
alloc r2 = ar.pfs, 0, 0, 3, 0
nop.i 0
br.sptk.many eadd1#
;;
* slotting of calls
this is more question than a problem:
Does gcc always place call instructions in the last slot
of a bundle -- call shadows are a nasty problem to deal
with on our side.
Robert
More information about the Gcc-bugs
mailing list