This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: TREE_CODE: arrays and variables
- From: Diego Novillo <dnovillo at redhat dot com>
- To: "Andrea Callia D'Iddio" <andrea dot calliadiddio at gmail dot com>
- Cc: gcc <gcc at gcc dot gnu dot org>
- Date: Tue, 17 Apr 2007 13:22:56 -0400
- Subject: Re: TREE_CODE: arrays and variables
- References: <9625a8490704170530o1ebcdc00u3a0005d43738c0ab@mail.gmail.com>
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.