public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Symbol table use in backend
@ 2001-08-07  2:33 James Montgomerie
  0 siblings, 0 replies; only message in thread
From: James Montgomerie @ 2001-08-07  2:33 UTC (permalink / raw)
  To: gcc

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-08-07  2:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-07  2:33 Symbol table use in backend James Montgomerie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).