This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Generate tree/rtx for address-of exp?


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]