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]
Other format: [Raw text]

RE: How can I retrieve section-attribute infomation in RTL


> -----Original Message-----
> From: gcc-owner On Behalf Of Jim Wilson
> Sent: 21 July 2004 19:56

> liyongzhang wrote:
> > For a RTL "call" insn pattern, how can I  retrieve section-attribute
> > infomation of the callee or caller functions.

> For the callee, if you have a SYMBOL_REF, then you can look at the
> SYMBOL_FLAG_* flag bits set by encode section info.  You can either do
> this when generating RTL via a call define_expand, or you can do this
> when generating assembly language.  Which is best depends on 
> the situation.

> If the callee is just a register, for instance an indirect call, then
> offhand I am not sure how to do it.  

  And don't forget that if your symbol_ref comes from an extern decl, it
can't be trusted.  E.g.

----------foo.h-------------
extern void foo (void);
----------foo.c--------------
void foo (void) __attribute__ ((section (".somewhereunexpected")))
{
    return;
}
----------bar.c--------------
#include "foo.h"
void bar (void)
{
    foo ();
}
-------------------------------

  When compiling bar.c, ENCODE_SECTION_INFO won't know about the fact that
foo has a section attribute specified.  So in the general case, you can only
find out the section info for symbols within the current compilation unit.
Extern symbols you have to either choose a failsafe option or come up with a
good heuristic.


    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


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