GIMPLE: obtaining informations about variables
Diego Novillo
dnovillo@google.com
Thu Feb 14 14:56:00 GMT 2008
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.
More information about the Gcc
mailing list