This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: virtual stack regs.
- From: Rask Ingemann Lambertsen <rask at sygehus dot dk>
- To: Kenneth Zadeck <zadeck at naturalbridge dot com>
- Cc: ubizjak at gmail dot com, gcc at gcc dot gnu dot org
- Date: Tue, 19 Jun 2007 11:04:55 +0200
- Subject: Re: virtual stack regs.
- References: <46772329.5010500@naturalbridge.com>
On Mon, Jun 18, 2007 at 08:28:25PM -0400, Kenneth Zadeck wrote:
> I would like to get some more information about pr32374.
>
> I do not know what virtual_stack_vars are and there is no documentation
> in the doc directory.
less -p 'Virtual registers ' gcc/rtl.h
less -p 'enum global_rtl_index' gcc/rtl.h
> 1) What are these?
They are placeholders. The vregs pass will replace them with
stack_pointer_rtx, (hard_)frame_pointer_rtx and arg_pointer_rtx using
information from STARTING_FRAME_OFFSET, FIRST_PARM_OFFSET and such.
Here are two examples, where arg_pointer_rtx is (reg/f:HI 14 argp) and
(hard_)frame_pointer_rtx is (reg/f:HI 10 bp):
(insn ... (set (reg/v/f:HI 39 [ tmp ])
(mem/f/c/i:HI (plus:HI (reg/f:HI 15 virtual-incoming-args)
(const_int 4 [0x4])) [0 tmp+0 S2 A16])) -1 (nil)
(expr_list ...
(nil)))
becomes
(insn ... (set (reg/v/f:HI 39 [ tmp ])
(mem/f/c/i:HI (plus:HI (reg/f:HI 14 argp)
(const_int 6 [0x6])) [0 tmp+0 S2 A16])) 9 {*movhi} (nil)
(expr_list ...
(nil)))
(where argp is a virtual hard reg later eliminated by reload) because
FIRST_PARM_OFFSET is 2, and
(insn ... (parallel [
(set (reg:HI 62)
(plus:HI (reg/f:HI 16 virtual-stack-vars)
(reg:HI 61)))
(clobber (reg:CC 13 cc))
]) -1 (nil)
(nil))
becomes
(insn ... (parallel [
(set (reg:HI 62)
(plus:HI (reg/f:HI 10 bp)
(reg:HI 61)))
(clobber (reg:CC 13 cc))
]) 44 {*addhi3} (nil)
(nil))
because STARTING_FRAME_OFFSET is 0.
> 2) Why are they uninitialized?
There is no meaningful value to assign to them.
> 3) If they really are uninitialized, why is it a problem to assign zero
> to them.
It is possible to mess up the substitution that the vregs pass performs.
IIRC, it happened to me once because I accidentally put one of these virtual
pseudo inside a (clobber) or (use) or something like that. I don't quite
recall the details, but maybe the substitution fails if they appear outside
an operand?
> 4) If they are not uninitialized, where is the initialization code? Why
> does df not see it?
Hmm, how do you handle arg_pointer_rtx, frame_pointer_rtx and the like?
The are all uninitialized until the prologue is emitted, which is some time
after reload.
> 5) How can I tell if a reg is a virtual_stack_reg?
FIRST_VIRTUAL_REGISTER <= regno <= LAST_VIRTUAL_REGISTER
--
Rask Ingemann Lambertsen