This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GIMPLE: obtaining informations about variables
- From: "Diego Novillo" <dnovillo at google dot com>
- To: "Andrea Callia D'Iddio" <andrea dot calliadiddio at gmail dot com>
- Cc: gcc <gcc at gcc dot gnu dot org>
- Date: Thu, 14 Feb 2008 09:56:20 -0500
- Subject: Re: GIMPLE: obtaining informations about variables
- References: <9625a8490802140639y35c1138ep3c04813cd4d35bac@mail.gmail.com>
On Thu, Feb 14, 2008 at 9:39 AM, Andrea Callia D'Iddio
<andrea.calliadiddio@gmail.com> wrote:
> But how can I obtain the list of variables used by a function? (global
> variables and also function local variables)
Once you are in SSA form, the table REFERENCED_VARS contains all the
symbols that are referenced by the current function. You can use the
iterator FOR_EACH_REFERENCED_VAR to access them.
> And how can I obtain informations about a variable, such as the type
> (int, float, array, pointer) and, if it's a static array, the number
> of elements?
For every symbol V in REFERENCED_VARS, TREE_TYPE (V) is the type. See
the internal documentation on TREE_TYPE to see how to access the
various fields.
There are pointers to various internal documents, tutorials, etc on
the GCC wiki. http://gcc.gnu.org/wiki/GettingStarted
Diego.