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: GIMPLE: obtaining informations about variables


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.


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