aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/optimize.c
diff options
context:
space:
mode:
authorJason Merrill <jason@casey.cygnus.com>1999-12-16 00:09:35 +0000
committerJason Merrill <jason@gcc.gnu.org>1999-12-15 19:09:35 -0500
commit5afb79e7f856b5a9b4414ee34940b568aa77abe8 (patch)
tree8f73132ac5140a32542ad1c3a7a0a0ab4b8f62b4 /gcc/cp/optimize.c
parent6150df627a7fb825a10280e54c35c8250e69bae0 (diff)
downloadgcc-5afb79e7f856b5a9b4414ee34940b568aa77abe8.zip
gcc-5afb79e7f856b5a9b4414ee34940b568aa77abe8.tar.gz
gcc-5afb79e7f856b5a9b4414ee34940b568aa77abe8.tar.bz2
function.c (retrofit_block): Abort if we don't find a suitable insn.
* function.c (retrofit_block): Abort if we don't find a suitable insn. (insert_block_after_note): Abort if we don't have a previous block. Remove FN parameter. * function.h: Adjust. * tree.c (walk_tree): Walk operand subtrees in forward order. * optimize.c (expand_call_inline): Likewise. (optimize_function): Initialize id->scope_stmt to something useful. (remap_block): Assume id->scope_stmt has a useful value. From-SVN: r30965
Diffstat (limited to 'gcc/cp/optimize.c')
-rw-r--r--gcc/cp/optimize.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 2177e4a..7eae09d 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -176,13 +176,9 @@ remap_block (scope_stmt, decls, id)
/* We put the BLOCK_VARS in reverse order; fix that now. */
BLOCK_VARS (new_block) = nreverse (BLOCK_VARS (new_block));
/* Graft the new block into the tree. */
- insert_block_after_note (new_block,
- (id->scope_stmt
- ? SCOPE_STMT_BLOCK (id->scope_stmt)
- : NULL_TREE),
- (id->scope_stmt
- ? SCOPE_BEGIN_P (id->scope_stmt) : 1),
- VARRAY_TREE (id->fns, 0));
+ insert_block_after_note (new_block,
+ SCOPE_STMT_BLOCK (id->scope_stmt),
+ SCOPE_BEGIN_P (id->scope_stmt));
/* Remember that this is now the last scope statement with
an associated block. */
id->scope_stmt = scope_stmt;
@@ -536,7 +532,7 @@ expand_call_inline (tp, walk_subtrees, data)
inside the body of a TARGET_EXPR. */
if (TREE_CODE (*tp) == TARGET_EXPR)
{
- int i;
+ int i, len = first_rtl_op (TARGET_EXPR);
/* We're walking our own subtrees. */
*walk_subtrees = 0;
@@ -544,7 +540,7 @@ expand_call_inline (tp, walk_subtrees, data)
/* Actually walk over them. This loop is the body of
walk_trees, omitting the case where the TARGET_EXPR
itself is handled. */
- for (i = first_rtl_op (TARGET_EXPR) - 1; i >= 0; --i)
+ for (i = 0; i < len; ++i)
{
if (i == 2)
++id->in_target_cleanup_p;
@@ -615,7 +611,8 @@ expand_call_inline (tp, walk_subtrees, data)
id->scope_stmt = scope_stmt;
/* Tell the debugging backends that this block represents the
- outermost scope of the inlined function. */
+ outermost scope of the inlined function. FIXME what to do for
+ inlines in cleanups? */
if (SCOPE_STMT_BLOCK (scope_stmt))
BLOCK_ABSTRACT_ORIGIN (SCOPE_STMT_BLOCK (scope_stmt)) = DECL_ORIGIN (fn);
@@ -725,6 +722,13 @@ optimize_function (fn)
VARRAY_PUSH_TREE (id.fns, s->function_decl);
prev_fn = s->function_decl;
}
+
+ /* Initialize id->scope_stmt with a fake SCOPE_STMT for the outermost
+ block of the function (i.e. the BLOCK with __FUNCTION__ et al). */
+ id.scope_stmt = build_min_nt (SCOPE_STMT,
+ BLOCK_SUBBLOCKS (DECL_INITIAL (fn)));
+ SCOPE_BEGIN_P (id.scope_stmt) = 1;
+
/* Replace all calls to inline functions with the bodies of those
functions. */
expand_calls_inline (&DECL_SAVED_TREE (fn), &id);