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: TREE_CODE: arrays and variables


Andrea Callia D'Iddio wrote on 04/17/07 08:30:

> I know that if expression 'e' is a variable or an array element, then
> TREE_CODE(e)==VAR_DECL. But how can I know if 'e' is a variable, or an
> array element? and, if it's an array element, how can I know which is
> the index value? can I have other informations such as array's size
> and array's name?

If you only have 'e', then you can check TREE_TYPE('e') which should
return ARRAY_TYPE if 'e' is an array.

But before finding 'e' you should have found the ARRAY_REF that holds
'e' and the index into 'e'.  See tree.def for how to access ARRAY_REF
elements.


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