Re: Understanding RTL (dumps)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/06/11 12:53, kevin diggs wrote:
> Hi,
> 
> Sorry for the noise. I am trying to learn RTL. A simple function's
> PowerPC RTL (gcc 3.4.6) has as one of the first RTL expressions:
> 
> (insn 3 2 4 (set (mem/f:SI (reg/f:SI 114 virtual-stack-vars) [0 u+0 S4 A32])
>         (reg:SI 3 3 [ u ])) -1 (nil)
>     (nil))
> 
> From the gcc-int manual, the first 3 fields (arguments) are:
> 
> 1) unique id
> 2) previous instruction chain
> 3) next instruction chain
> 
> The last four are:  RTL expression for the side effect (pattern),
> instruction code of match (-1 if not yet matched), dependent
> instruction list, and note list.
> 
> So for this example (which I *think* is putting the register argument
> (PowerPC ABI?) on the stack???):
> 
> 1) 3
> 2) 2
> 3) 4
> 5) (set (mem/f:SI (reg/f:SI 114 virtual-stack-vars) [0 u+0 S4 A32])
> (reg:SI 3 3 [u]) )
> 6) -1
> 7) (nil)
> 8) (nil)
> 
> I am having trouble reading the pattern (field 5). It is a set:
> 
> (set lval x)
> 
> Two arguments, in this case the address is a mem:
> 
> (mem/f:SI ...)
> 
> and the source (x) is a reg:
> 
> (reg:SI 3 3 [u])
> 
> A mem has two arguments:
> 
> (mem:m addr alias)
> 
> The addr appears to be a reg but regs only have one argument? What is
> "virtual-stack-vars"? Is the stuff in square brackets the alias set?
> It's a vector (list?), right?
> 
> The 'x' in the set is "(reg:SI 3 3 [u])". What is the second '3' and
> the '[u]'???
A lot of this is covered in the GCC internals documentation.
Personally, I just look at the texi source rather than the formatted
texinfo blobs.

@findex MEM_POINTER
@cindex @code{mem} and @samp{/f}
@cindex @code{frame_related}, in @code{mem}
@item MEM_POINTER (@var{x})
Nonzero in a @code{mem} if the memory reference holds a pointer.
Stored in the @code{frame_related} field and printed as @samp{/f}.

The second "3" is the register's name.  Apparently hard reg 3 has no
convenient pseudo name on your target.  The "u" is the REG_EXPR:

@findex REG_EXPR
@item REG_EXPR (@var{x})
If this register is known to hold the value of some user-level
declaration, this is that tree node.

virtual-stack-vars is a special pseudo used to reference objects in the
stack.  Again, I would refer you to the rtl.texi documentation which
discusses the various virtual registers in more detail.

@findex VIRTUAL_STACK_VARS_REGNUM
@cindex @code{FRAME_GROWS_DOWNWARD} and virtual registers
@item VIRTUAL_STACK_VARS_REGNUM
If @code{FRAME_GROWS_DOWNWARD} is defined to a nonzero value, this points
to immediately above the first variable on the stack.  Otherwise, it points
to the first variable on the stack.

@cindex @code{STARTING_FRAME_OFFSET} and virtual registers
@cindex @code{FRAME_POINTER_REGNUM} and virtual registers
@code{VIRTUAL_STACK_VARS_REGNUM} is replaced with the sum of the
register given by @code{FRAME_POINTER_REGNUM} and the value
@code{STARTING_FRAME_OFFSET}.

jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNnMJzAAoJEBRtltQi2kC7SQgIAJ6Biiiw/ZHcLAXTUFRdAF61
8LbtX6vQ1Arc+BMhao0JiV5R9xPOlnz4B5JrlgtlOfc/Ov4ygo2AZITkrhBTkNEo
AMbO9cLrM3epgvxOaE5MVBpMTpQq6xlIV9xhSXRgSA4ozqCblqK0qw5mgIIhPgSc
LIMq/uZKDSyPvOXJMErrpeAnsnJunX5Kn8IYJGLf9NlcKQ4BU5EY5FX28XOZNPSX
WGT8Ne879rnNNThuPWNF+1TIu/YLd8VuEnXroGYfwrmbgEaAeh0sZ83IImzbWv3J
zzJItqOW+z87hA6vvb0h+OcpC6hP8wchtv/G9wqW7/DztQyHPOD0DN18SqobNlU=
=WaSs
-----END PGP SIGNATURE-----


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux