diff options
author | Jan Hubicka <jh@suse.cz> | 2003-02-12 22:48:59 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2003-02-12 21:48:59 +0000 |
commit | e72fcfe8e47d6b453a9a7685c64b8595c32a2252 (patch) | |
tree | 145028e0c53cc6c7857dc24db0335535b3ff24ab /gcc/tree-inline.c | |
parent | 9037b0c71ed8277d06fd67fff15ea40aee9754ef (diff) | |
download | gcc-e72fcfe8e47d6b453a9a7685c64b8595c32a2252.zip gcc-e72fcfe8e47d6b453a9a7685c64b8595c32a2252.tar.gz gcc-e72fcfe8e47d6b453a9a7685c64b8595c32a2252.tar.bz2 |
Makefile.in (CRTSTUFF_CFLAGS): Add -fno-unit-at-a-time
* Makefile.in (CRTSTUFF_CFLAGS): Add -fno-unit-at-a-time
(OBJS): Add callgraph.o
(callgraph.o): New.
* c-decl.c (expand_body_1): Break out from ...
(expand_body): This one; change calling convention
(finish_function): Move some of expand_body logic here.
(c_expand_deferred_function): Update call of expand_body
(c_expand_stmt): Use c_expand_body_1.
* c-lang.c (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Define.
* c-objc-commin.c (c_objc_common_finish_file): Use callgraph code.
* c-tree.h (c_expand_body): Declare.
* callgraph.c: New file.
* flags.h (flag_unit_at_a_time): Declare.
* langhooks.h (LANG_HOOKS_CALLGRAPH_LOWER_FUNCTION,
LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION,
LANG_HOOKS_CALLGRAPH_INITIALIZER): New macros.
* langhooks.h (struct lang_hooks_for_callgraph): New.
(struct lang_hooks): Add callgraph field.
* toplev.c (flag_unit_at_a_time): New.
(lang_independent_options): Add flag_unit_at_a_time.
(process_options): Disable unit-at-a-time mode for frontends not
supporting callgraph.
* tree-inline.c (typedef struct inline_data): Add "decl"
(expand_call_inline): Update callgraph.
(optimize_inline_calls): Set id.decl.
* tree.h (cgraph_finalize_function, cgraph_finalize_compilation_unit,
cgraph_create_edges, dump_cgraph, cgraph_optimize, cgraph_remove_call
cgraph_calls_p): Declare.
* invoke.texi (-funit-at-a-time): Document
From-SVN: r62789
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index e4bdf12..19b7a4f 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -103,6 +103,8 @@ typedef struct inline_data /* Hash table used to prevent walk_tree from visiting the same node umpteen million times. */ htab_t tree_pruner; + /* Decl of function we are inlining into. */ + tree decl; } inline_data; /* Prototypes. */ @@ -1368,6 +1370,13 @@ expand_call_inline (tp, walk_subtrees, data) /* For accounting, subtract one for the saved call/ret. */ id->inlined_stmts += DECL_NUM_STMTS (fn) - 1; + /* Update callgraph if needed. */ + if (id->decl && flag_unit_at_a_time) + { + cgraph_remove_call (id->decl, fn); + cgraph_create_edges (id->decl, *inlined_body); + } + /* Recurse into the body of the just inlined function. */ expand_calls_inline (inlined_body, id); VARRAY_POP (id->fns); @@ -1414,6 +1423,7 @@ optimize_inline_calls (fn) /* Clear out ID. */ memset (&id, 0, sizeof (id)); + id.decl = fn; /* Don't allow recursion into FN. */ VARRAY_TREE_INIT (id.fns, 32, "fns"); VARRAY_PUSH_TREE (id.fns, fn); |