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]

Re: External or local SYMBOL_REF?


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);
}

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