public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* External or local SYMBOL_REF?
@ 2000-09-16 13:07 lars brinkhoff
  2000-09-18  6:05 ` Joern Rennecke
  0 siblings, 1 reply; 3+ messages in thread
From: lars brinkhoff @ 2000-09-16 13:07 UTC (permalink / raw)
  To: gcc

If I have an rtx x for which GET_CODE (x) == SYMBOL_REF, how do I
find out whether the symbol is external or local?

E.g.

extern int a; // external
static int b; // local
       int c; // local

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

* Re: External or local SYMBOL_REF?
  2000-09-16 13:07 External or local SYMBOL_REF? lars brinkhoff
@ 2000-09-18  6:05 ` Joern Rennecke
  2000-09-19 10:10   ` lars brinkhoff
  0 siblings, 1 reply; 3+ messages in thread
From: Joern Rennecke @ 2000-09-18  6:05 UTC (permalink / raw)
  To: lars brinkhoff; +Cc: gcc

> If I have an rtx x for which GET_CODE (x) == SYMBOL_REF, how do I
> find out whether the symbol is external or local?
> 
> E.g.
> 
> extern int a; // external
> static int b; // local
>        int c; // local

There no such information in the rtl in general.
You can arrange for the inforamation to be extracted from the tree and
encoded in the name of the symbol by defining ENCODE_SECTION_INFO.

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

* Re: External or local SYMBOL_REF?
  2000-09-18  6:05 ` Joern Rennecke
@ 2000-09-19 10:10   ` lars brinkhoff
  0 siblings, 0 replies; 3+ messages in thread
From: lars brinkhoff @ 2000-09-19 10:10 UTC (permalink / raw)
  To: Joern Rennecke; +Cc: gcc

Joern Rennecke <amylaar@cygnus.co.uk> writes:
> > If I have an rtx x for which GET_CODE (x) == SYMBOL_REF, how do I
> > find out whether the symbol is external or local?
> There no such information in the rtl in general.
> You can arrange for the inforamation to be extracted from the tree and
> encoded in the name of the symbol by defining ENCODE_SECTION_INFO.

Thanks.  This seems to work well:

#define ENCODE_SECTION_INFO(DECL)       encode_section_info(DECL)

#define SYMBOL_REF_EXTERNAL SYMBOL_REF_FLAG

void
encode_section_info (decl)
     tree decl;
{
  enum tree_code code = TREE_CODE (decl);
  if (code == VAR_DECL || code == FUNCTION_DECL)
    SYMBOL_REF_EXTERNAL (XEXP (DECL_RTL (decl), 0)) = !TREE_STATIC (decl);
}

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

end of thread, other threads:[~2000-09-19 10:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-16 13:07 External or local SYMBOL_REF? lars brinkhoff
2000-09-18  6:05 ` Joern Rennecke
2000-09-19 10:10   ` lars brinkhoff

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).