diff options
author | Andrew Haley <aph@cambridge.redhat.com> | 2002-08-16 10:32:30 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2002-08-16 10:32:30 +0000 |
commit | 7149627b8ede8a1f9b4735da0690f8b28209503e (patch) | |
tree | 664000a6e258478f587c0810b5dcd1a729ff2308 /gcc/java/decl.c | |
parent | d436bff8d6709d083432a14b8c7ff2fb753d6b2a (diff) | |
download | gcc-7149627b8ede8a1f9b4735da0690f8b28209503e.zip gcc-7149627b8ede8a1f9b4735da0690f8b28209503e.tar.gz gcc-7149627b8ede8a1f9b4735da0690f8b28209503e.tar.bz2 |
Make-lang.in (java-tree-inline.o): New.
2002-07-30 Andrew Haley <aph@cambridge.redhat.com>
* Make-lang.in (java-tree-inline.o): New.
(JAVA_OBJS): Add java-tree-inline.o.
* parse.y (source_end_java_method): Call java_optimize_inline.
(java_expand_method_bodies): Save method's tree in
DECL_SAVED_TREE.
(add_stmt_to_compound): Keep track of the number of statments.
* lang.c (java_init): Enable flag_inline_trees.
(java_post_options): If flag_inline_functions is on, enable
flag_inline_trees instread.
(decl_constant_value): New.
(java_tree_inlining_walk_subtrees): New.
* java-tree.h (DECL_NUM_STMTS): New macro.
(java_optimize_inline): Declare.
* expr.c (java_expand_expr): Allow a BLOCK to return a value.
Handle a LABEL_EXPR.
* decl.c (build_result_decl): If we already have a DECL_RESULT
don't make another.
(dump_function): New.
(java_optimize_inline): New.
(dump_function): New.
From-SVN: r56377
Diffstat (limited to 'gcc/java/decl.c')
-rw-r--r-- | gcc/java/decl.c | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/gcc/java/decl.c b/gcc/java/decl.c index bf5e5ff..9f055d3 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -41,9 +41,11 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "except.h" #include "java-except.h" #include "ggc.h" +#include "timevar.h" +#include "tree-inline.h" #if defined (DEBUG_JAVA_BINDING_LEVELS) -extern void indent PROTO((void)); +extern void indent PARAMS ((void)); #endif static tree push_jvm_slot PARAMS ((int, tree)); @@ -53,6 +55,7 @@ static struct binding_level *make_binding_level PARAMS ((void)); static tree create_primitive_vtable PARAMS ((const char *)); static tree check_local_named_variable PARAMS ((tree, tree, int, int *)); static tree check_local_unnamed_variable PARAMS ((tree, tree, tree)); +static void dump_function PARAMS ((enum tree_dump_index, tree)); /* Set to non-zero value in order to emit class initilization code before static field references. */ @@ -1662,11 +1665,18 @@ build_result_decl (fndecl) tree fndecl; { tree restype = TREE_TYPE (TREE_TYPE (fndecl)); - /* To be compatible with C_PROMOTING_INTEGER_TYPE_P in cc1/cc1plus. */ - if (INTEGRAL_TYPE_P (restype) - && TYPE_PRECISION (restype) < TYPE_PRECISION (integer_type_node)) - restype = integer_type_node; - return (DECL_RESULT (fndecl) = build_decl (RESULT_DECL, NULL_TREE, restype)); + tree result = DECL_RESULT (fndecl); + if (! result) + { + /* To be compatible with C_PROMOTING_INTEGER_TYPE_P in cc1/cc1plus. */ + if (INTEGRAL_TYPE_P (restype) + && TYPE_PRECISION (restype) < TYPE_PRECISION (integer_type_node)) + restype = integer_type_node; + result = build_decl (RESULT_DECL, NULL_TREE, restype); + DECL_CONTEXT (result) = fndecl; + DECL_RESULT (fndecl) = result; + } + return result; } void @@ -1825,4 +1835,34 @@ end_java_method () current_function_decl = NULL_TREE; } +/* Dump FUNCTION_DECL FN as tree dump PHASE. */ + +static void +dump_function (phase, fn) + enum tree_dump_index phase; + tree fn; +{ + FILE *stream; + int flags; + + stream = dump_begin (phase, &flags); + if (stream) + { + dump_node (fn, TDF_SLIM | flags, stream); + dump_end (phase, stream); + } +} + +void java_optimize_inline (fndecl) + tree fndecl; +{ + if (flag_inline_trees) + { + timevar_push (TV_INTEGRATION); + optimize_inline_calls (fndecl); + timevar_pop (TV_INTEGRATION); + dump_function (TDI_inlined, fndecl); + } +} + #include "gt-java-decl.h" |