Intermediate representation and informations

Dave Korn dave.korn.cygwin@googlemail.com
Mon May 18 14:35:00 GMT 2009


Nicolas COLLIN wrote:

> In my source code I have some useful informations about variables (for
> example a variable which is a real time attribute) and I would like to
> know it in the intermediate representation to do what I have to about
> it. Is there a way to have some informations in the intermediate
> representation ? Like #pragma I think but with my own keywords and
> meanings.

  Annotating declarations is exactly what the __attribute__ keyword was
designed for for.  There are some details in the internals manual about how to
implement new attributes, although they focus on backend target-specific
custom attributes, but it'll give you an idea where to start looking.  Once
they've been parsed properly, you can look them up via DECL_ATTRIBUTES (or
TYPE_ATTRIBUTES if you're dealing with a type rather than variable).  I think
you'll find that the attribute handling functions and data structures have
been fairly highly-conserved down the years, so what the current manual says
should be simple enough to apply backward to the EGCS version you're using.

    cheers,
      DaveK




More information about the Gcc mailing list