public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* How does one traverse all the global decls
@ 2019-08-21 21:33 Gary Oblock
  2019-08-22  9:16 ` Martin Jambor
  0 siblings, 1 reply; 4+ messages in thread
From: Gary Oblock @ 2019-08-21 21:33 UTC (permalink / raw)
  To: GCC Development

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.

Thanks,

Gary Oblock

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How does one traverse all the global decls
  2019-08-21 21:33 How does one traverse all the global decls Gary Oblock
@ 2019-08-22  9:16 ` Martin Jambor
  2019-08-22 10:49   ` Richard Biener
  2019-08-22 18:19   ` [EXT] " Gary Oblock
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Jambor @ 2019-08-22  9:16 UTC (permalink / raw)
  To: Gary Oblock, GCC Development

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.

Martin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How does one traverse all the global decls
  2019-08-22  9:16 ` Martin Jambor
@ 2019-08-22 10:49   ` Richard Biener
  2019-08-22 18:19   ` [EXT] " Gary Oblock
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Biener @ 2019-08-22 10:49 UTC (permalink / raw)
  To: Martin Jambor; +Cc: Gary Oblock, GCC Development

On Thu, Aug 22, 2019 at 11:16 AM Martin Jambor <mjambor@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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [EXT] Re: How does one traverse all the global decls
  2019-08-22  9:16 ` Martin Jambor
  2019-08-22 10:49   ` Richard Biener
@ 2019-08-22 18:19   ` Gary Oblock
  1 sibling, 0 replies; 4+ messages in thread
From: Gary Oblock @ 2019-08-22 18:19 UTC (permalink / raw)
  To: Martin Jambor, GCC Development

On 8/22/19 2:16 AM, Martin Jambor wrote:
> External Email
>
> ----------------------------------------------------------------------
> 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.
>
> Martin
>
Martin --

Thanks, even though this wasn't exactly what I was hoping for. :-)

-- Gary

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-22 18:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-21 21:33 How does one traverse all the global decls Gary Oblock
2019-08-22  9:16 ` Martin Jambor
2019-08-22 10:49   ` Richard Biener
2019-08-22 18:19   ` [EXT] " Gary Oblock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).