Generate tree/rtx for address-of exp?
Jim Wilson
wilson@specifixinc.com
Tue Jun 1 07:06:00 GMT 2004
MajorZ wrote:
> 1. Is there a universal field in tree/rtx for
> address-of exp? No matter what exp could be.
No.
> 2. Is there some function A that could help to
> calculate the offset no matter it is structure, array
> or mix?
Create an ADDR_EXPR tree, and pass it to expand_expr. That will return
RTL corresponding to the address. If you want the address of a struture
member, then you need a ADDR_EXPR of a COMPONENT_REF tree. Etc.
> 3. Can some nice guy could should me the simple
> pseudocode for the function A if I have to write it
> myself? Or what are the situations I need to think of,
> like for array, for strcuture, for arrays of strutures
> etc.
Write a simple C testcase, run gdb on cc1, put a breakpoint in
expand_expr in the ADDR_EXPR case, and then print out the tree with the
pt gdb macro (or use debug_tree directly).
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
More information about the Gcc
mailing list