This is the mail archive of the gcc-help@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: Tree


On 4 July 2011 16:13, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 4 July 2011 15:28, konica sarker wrote:
>> "A tree is a pointer type, but the object to which it points may be of
>> a variety of types"
>>
>> suppose i have a tree t;
>> can you help me, how to identify the object type of the tree?
>
> From http://gcc.gnu.org/onlinedocs/gccint/Tree-overview.html
>
> "You can tell what kind of node a particular tree is by using the
> TREE_CODE macro."
>
>> what does the function TREE_TYPE() do?
>
> From http://gcc.gnu.org/onlinedocs/gccint/Macros-and-Functions.html
>
> "Many trees store the type of an expression or declaration in this field."
>
> And from gcc/tree.h:
>
> /* In all nodes that are expressions, this is the data type of the expression.
> ? In POINTER_TYPE nodes, this is the type that the pointer points to.
> ? In ARRAY_TYPE nodes, this is the type of the elements.
> ? In VECTOR_TYPE nodes, this is the type of the elements. ?*/
> #define TREE_TYPE(NODE) __extension__ \
> (*({__typeof (NODE) const __t = CONTAINS_STRUCT_CHECK (NODE, TS_TYPED); \
> ? ?&__t->typed.type; }))
>

The way i tend to think of tree's is just DAG's,
http://gcc.gnu.org/wiki/GenericAPI
I started documenting more there, but i will continue to add to that
as its no where near complete.


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