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]

Symbol table use in backend


I'm writing a backend for GCC to compile to Java bytecode, and I'm having
some problems with function calls. 

The problem is that the Java Virtual Machine
needs to know the exact arguments of a function at call-time.  So far,
I've been deducing it from the values last loaded into the argument
registers, but with more complex jump sequences, this doesn't always work.

I'd /like/ to be able to look up the declaration tree for a function being
called from it's SYMBOL_REF, something like 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.

Is there any way to get the information I want from within the backend, or
is it going to take more hacking than I initially thought (hopefully I'm
missing something obvious and simple :-)?

Thanks,
Jamie.


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