This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Saving the Tree declaration node in GCC 4.1.1.
- From: Ian Lance Taylor <iant at google dot com>
- To: "Rohit Arul Raj" <rohitarulraj at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 22 Dec 2006 21:28:51 -0800
- Subject: Re: Saving the Tree declaration node in GCC 4.1.1.
- References: <c356fd4e0612220437j4f9cbde9gd15714d2db2b9393@mail.gmail.com>
"Rohit Arul Raj" <rohitarulraj@gmail.com> writes:
> Before emitting a call instruction, i need to check for function
> attributes. Based on that i need to emit the corresponding call
> instruction. For that, before emitting the call instruction, i check
> for the attributes of the called function through the declaration
> node.
>
> tree fn_id, fn_decl;
> fn_id = get_identifier(name);
> fn_decl = lookup_name(fn_id);
I don't understand where you are trying to emit the call instruction.
Why do you only have the name? What language are you compiling?
Certainly calling lookup_name seems wrong.
Given a CALL_EXPR, you can use get_callee_fndecl to find the caller.
At the RTL level, you can usually use TARGET_ENCODE_SECTION_INFO and
SYMBOL_REF_FLAG to good effect. Or look at how ARM handles
ENCODED_LONG_CALL_ATTR_P via TARGET_STRIP_NAME_ENCODING.
Ian