This is the mail archive of the 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: Mapping calls to declarations

on 13/8/01 4:54 pm, Daniel Berlin at wrote:
>> I need to be able to, in the function call instruction patterns (or
>> functions called by them), map from a function call to a declaration.  I
>> first tried looking up the SYMBOL_REF in the symbol table, but this does not
>> work*.
> Err.
> I can do what you said in the message, and the function decls i get
> correspond exactly to the function in question, as they should.

I'm trying to do this in the output template substitution function (i.e. the
one called by the PRINT_OPERAND macro) like (quoting from my own previous
mail) this:

> tree t = lookup_name(get_identifier (XSTR(x, 0)));
> if (t && TREE_CODE (t) == FUNCTION_DECL)
>   {
>      jvm_write_function_args(t);
>   }
> where x is the SYMBOL_REF for the function.  Though this works, in the
> sense that it doesn't crash, the declarations I get out always seem to
> correspond to either a "void function(void);" or "int function(void);"
> declaration, which is wrong.

I should add that I /do/ get a valid FUNCTION_DECL node out, it's just one
with no arguments (i.e. DECL_ARGUMENTS(t) returns 0) and seems to always
return void or int (as examined by DECL_RESULT).

>> My next thought was to get the declaration via get_callee_fndecl,
>> somehow getting the tree for the call expression first, but I can't see a
>> way to do that.
> How early do you need to be able to do this?
> If you want to do it when creating the call instruction pattern itself,
> it's trivial.
> You'll be passed all the info you need.

Again, I need to do this in the output template substitution function (i.e.
the one called by the PRINT_OPERAND macro).

How can I get the tree expression for the call from within the instruction

Either method (or another) would be equally good - so long as I can map back
to the declaration from within the call instruction pattern.


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