This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Ada bootstrap failure due to loop optimization and builtin_stack_alloc
- From: Richard Henderson <rth at redhat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 3 Aug 2004 12:36:29 -0700
- Subject: Re: Ada bootstrap failure due to loop optimization and builtin_stack_alloc
- References: <10408031916.AA14129@vlsi1.ultra.nyu.edu>
On Tue, Aug 03, 2004 at 03:16:25PM -0400, Richard Kenner wrote:
> Yes, absolutely we can. Patch in testing.
>
> Can you let me know how? Ada has some types that this should also be
> set on (unrelated to this issue).
I've created a DECL_VALUE_EXPR that may be set for a decl. After
this has been set, the original decl should never be referenced,
and the value of the decl can be computed from the given expression.
In the case of variable sized data, we get
char xyzzy[i];
bar(xyzzy);
return xyzzy[1];
=>
...
T.9 = __builtin_alloca (T.7);
xyzzy.8 = (char[T.1] *)T.9;
bar (xyzzy.8);
T.11 = (*xyzzy.8)[1];
T.10 = (int)T.11;
return T.10;
So we've replaced xyzzy (the VLA) with xyzzy.8 (a pointer to the array).
We'll have set DECL_VALUE_EXPR(xyzzy) = <INDIRECT_REF xyzzy.8>.
With a little bit of rearrangement in dwarf2out.c, we can render this as
.ascii "xyzzy\0" # DW_AT_name
...
.byte 0x2 # DW_AT_location
.byte 0x73 # DW_OP_breg3
.sleb128 0
The breg3 is because xyzzy.8 got allocated to reg3, %ebx. If I add
an asm with some clobbers, to force the register allocator to spill
xyzzy.8 to memory, I get
.byte 0x3 # DW_AT_location
.byte 0x91 # DW_OP_fbreg
.sleb128 -16
.byte 0x6 # DW_OP_deref
Here we find the address of xyzzy.8 on the stack, and dereference.
All as we expected.
The full generality of DECL_VALUE_EXPR should be able to handle
debug info for SRA. Of course, IIRC gdb doesn't actually handle
DW_OP_piece at the moment, so it's largely irrelevant for now.
I'm in the process of running the gdb testsuite to make sure I didn't
somehow bust things up for some corner case. Perhaps I'll have it
all done tomorrow.
r~