This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How can I retrieve section-attribute infomation in RTL
- From: Jim Wilson <wilson at specifixinc dot com>
- To: liyongzhang <liyongzhang at tcxa dot com dot cn>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 21 Jul 2004 11:55:40 -0700
- Subject: Re: How can I retrieve section-attribute infomation in RTL
- References: <002f01c46e73$424cf290$1264a8c0@zz>
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