This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] calls.c: recognize Java calls.
- To: egcs-patches at egcs dot cygnus dot com
- Subject: [PATCH] calls.c: recognize Java calls.
- From: Alexandre Petit-Bianco <apbianco at cygnus dot com>
- Date: Fri, 19 Nov 1999 14:55:48 -0800
This patch allows Java calls to be recognized when `expand_call'
considers inlining the call.
Java function accesses (direct or vtable indirected) are always
wrapped around a NOP_EXPR:
java/expr.c:expand_invoke:
...
func = build1 (NOP_EXPR, build_pointer_type (method_type), func);
...
The patch below takes that into account in order for expand_call to
get a hold on the fndecl in the case of a Java method invokation.
Let me know what you think.
./A
Fri Nov 19 14:30:08 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* calls.c (expand_call): Allow Java calls to be recognized.
Index: calls.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/calls.c,v
retrieving revision 1.69
diff -u -p -r1.69 calls.c
--- calls.c 1999/11/16 17:43:39 1.69
+++ calls.c 1999/11/19 22:48:40
@@ -1655,9 +1655,13 @@ expand_call (exp, target, ignore)
As a result, decide whether this is a call to an integrable function. */
p = TREE_OPERAND (exp, 0);
- if (TREE_CODE (p) == ADDR_EXPR)
+ if (TREE_CODE (p) == ADDR_EXPR
+ || (TREE_CODE (p) == NOP_EXPR
+ && TREE_CODE (TREE_OPERAND (p, 0)) == ADDR_EXPR))
{
fndecl = TREE_OPERAND (p, 0);
+ if (TREE_CODE (fndecl) == ADDR_EXPR)
+ fndecl = TREE_OPERAND (fndecl, 0);
if (TREE_CODE (fndecl) != FUNCTION_DECL)
fndecl = 0;
else