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: Listing file-scope variables inside a pass


On 3/20/07, Karthikeyan M <karthikeyan.m@gmail.com> wrote:
Thanks.
Where exactly should I be looking?
cgraph.c, cgraphunit.c, cgraph.h
see cgraph_varpool_nodes, FOR_EACH_STATIC_VARIABLE (static here means
having scope greater than a single function, it does not mean "all
variables declared static in C")

Will the cgraph nodes also have global declarations that are never
used inside any
function .
If you ask for all of them, it will give you all of them
If you ask for only the needed ones, it will give you all of the
needed ones (see FOR_EACH_STATIC_VARIABLE)

On 3/20/07, Daniel Berlin <dberlin@dberlin.org> wrote: > On 3/20/07, Dave Korn <dave.korn@artimi.com> wrote: > > On 19 March 2007 22:16, Karthikeyan M wrote: > > > > > What should I do if I want a list of all file-scope variables inside > > > my own pass ? > > > > > > The file_scope variable is local to c-decl.c . Is there a reason why > > > the scope holding variables are local to c-decl.c ? > > > > Because we want to keep front-, mid- and back- ends of the compiler as > > modular and non-interdependent as possible, perhaps? > > > > If you need a routine to dump that data, why not write it in c-decl.c and > > just expose the prototype in a suitable header file (c-tree.h)? > > > He already can get the file-scope variables by going through the > cgraph variable nodes. >


--


Karthik

****************************************************************************
To laugh often and love much; to win the respect of intelligent
persons and the affection of children; to earn the approbation of
honest critics; to appreciate beauty; to give of one's self; to leave
the world a bit better, whether by a healthy child, a garden patch or
a redeemed social condition; to have played and laughed with
enthusiasm and sung with exultation; to know even one life has
breathed easier because you have lived--that is to have succeeded.
--Ralph Waldo Emerson
****************************************************************************



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