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


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

There is a hook TARGET_ENCODE_SECTION_INFO that you can use to translate
type info (like attributes) into flags on a SYMBOL_REF.  See the
SYMBOL_FLAG_* in rtl.h, and any target that defines the encode section
info hook.

For the caller, you can look at current_function_decl, which gets you
all of the type info for the current function, which gets you to the
attributes.  You can maybe also look at flags in the DECL_RTL SYMBOL_REF.

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.  This is something you can worry
about later.  If you look at other examples and/or step through gcc in a
debugger, then you may be able to figure it out yourself.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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