Commit 5afb79e7 by Jason Merrill Committed by Jason Merrill

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
parent 6150df62
1999-12-15 Jason Merrill <jason@casey.cygnus.com>
* 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.
1999-12-15 Mark Mitchell <mark@codesourcery.com>
* builtins.c (expand_builtin_mathfn): Make sure not to expand the
......
1999-12-15 Jason Merrill <jason@casey.cygnus.com>
* 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.
1999-12-15 Nathan Sidwell <nathan@acm.org>
* typeck.c (build_c_cast): Expand warning message. Move pointer
......@@ -67,7 +74,6 @@
(reinit_parse_for_expr): Use.
(check_newline): Use.
>>>>>>> 1.1463
1999-12-13 Mark Mitchell <mark@codesourcery.com>
* optimize.c (initialize_inlined_parameters): Take FN to which the
......
......@@ -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);
......
......@@ -1623,21 +1623,19 @@ walk_tree (tp, func, data)
|| TREE_CODE_CLASS (code) == 'r'
|| TREE_CODE_CLASS (code) == 's')
{
int i;
int i, len;
/* Walk over all the sub-trees of this operand. */
i = first_rtl_op (code) - 1;
len = first_rtl_op (code);
/* TARGET_EXPRs are peculiar: operands 1 and 3 can be the same.
But, we only want to walk once. */
if (code == TARGET_EXPR
&& TREE_OPERAND (*tp, 3) == TREE_OPERAND (*tp, 1))
--i;
/* Go through the subtrees. */
while (i >= 0)
{
WALK_SUBTREE (TREE_OPERAND (*tp, i));
--i;
}
--len;
/* Go through the subtrees. We need to do this in forward order so
that the scope of a FOR_EXPR is handled properly. */
for (i = 0; i < len; ++i)
WALK_SUBTREE (TREE_OPERAND (*tp, i));
/* For statements, we also walk the chain so that we cover the
entire statement tree. */
......
......@@ -5495,22 +5495,22 @@ round_trampoline_addr (tramp)
/* Insert the BLOCK in the block-tree, knowing that the previous
block-note is for OLD_BLOCK. BEGIN_P is non-zero if the previous
block-note was the for the beginning of a BLOCK. FN is the
FUNCTION_DECL into which the BLOCK is being inserted. */
block-note was the for the beginning of a BLOCK. */
void
insert_block_after_note (block, old_block, begin_p, fn)
insert_block_after_note (block, old_block, begin_p)
tree block;
tree old_block;
int begin_p;
tree fn;
{
if (begin_p)
{
/* If there was no previous block, use the top-level block for
the function. */
/* If there was no previous block, something's gone terribly
wrong. We used to try to use DECL_INITIAL for the current
function, but that will never be correct, and completely
hoses the block structure. */
if (!old_block)
old_block = DECL_INITIAL (fn);
abort ();
BLOCK_SUPERCONTEXT (block) = old_block;
BLOCK_CHAIN (block) = BLOCK_SUBBLOCKS (old_block);
......@@ -5545,12 +5545,12 @@ retrofit_block (block, last_insn)
|| NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END))
break;
if (insn == NULL_RTX)
abort ();
insert_block_after_note (block,
insn ? NOTE_BLOCK (insn) : NULL_TREE,
insn
? (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG)
: 1,
current_function_decl);
NOTE_BLOCK (insn),
NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG);
}
/* The functions identify_blocks and reorder_blocks provide a way to
......
/* Structure for saving state for a nested function.
Copyright (C) 1989, 92-97, 1998 Free Software Foundation, Inc.
Copyright (C) 1989, 92-97, 1998, 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
......@@ -545,9 +545,8 @@ extern struct function *outer_function_chain;
extern void identify_blocks PROTO((tree, rtx));
/* Insert the BLOCK in the block-tree, knowing that the previous
block-note is for OLD_BLOCK. BEGIN_P is non-zero if the previous
block-note was the for the beginning of a BLOCK. FN is the
FUNCTION_DECL into which the BLOCK is being inserted. */
extern void insert_block_after_note PROTO((tree, tree, int, tree));
block-note was the for the beginning of a BLOCK. */
extern void insert_block_after_note PROTO((tree, tree, int));
/* Insert a new BLOCK at an appropriate place in the block tree. */
extern void retrofit_block PROTO((tree, rtx));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment