On Thu, Aug 22, 2019 at 11:16 AM Martin Jambor <mjam...@suse.cz> wrote: > > Hi, > > On Wed, Aug 21 2019, Gary Oblock wrote: > > I'm trying to do some analysis code for an optimization > > that involves my code looking at all the declarations and > > types there of during the link time optimizations. > > > > Note, doing this for the local variables seems to be trivial > > because of FOR_EACH_LOCAL_DECL and there are also > > obvious ways of getting at the type information once I have > > a decl. However, I can't seem to find any similar way of > > getting at the global level decls. > > > > I'd appreciate your help on this. > > > > Look at FOR_EACH_VARIABLE defined in cgraph.h (because symtab.h does not > exist) and it's various uses throughout the compiler.
There's also IPA-REFs so you can iterate over references of global variables (not sure if there's a nice FOR_EACH interface for that). Richard. > > Martin