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: How can i get a ref from a this pointer ?


Richard Buchmann wrote:
I'm looking for a simple way to get something like a COMPONENT_REF tree node
from an expression tree node.

If you already have address arithmetic, then there is no easy way to get the COMPONENT_REF back. You probably have to do this manually. Look up the type info, and then look at the fields of the type to find out which one is at the index.


The PLUS_EXPR node has 2 operands : the first is a NOP_EXPR node (this
pointer...) and the second one is an integer node (the offset).
I would like to get a COMPONENT_REF node to know what FIELD is used : a or b.

You didn't mention which gcc sources you use. This will likely work differently in different gcc versions.


In current gcc development sources, which have the tree-ssa optimization passes, the COMPONENT_REF seems to be still there. If I compile with -fdump-tree-all, and look at the t02 and t03 files, I see "->" which is a COMPONENT_REF. Maybe you are looking at older gcc sources? In older gcc sources, you probably can't do much useful with the trees.
--
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]