[tree-ssa] New regressions after 2003-10-26
Diego Novillo
dnovillo@redhat.com
Tue Oct 28 17:45:00 GMT 2003
Richard, Zdenek,
One of the attached changes introduced new regressions in the C, C++ and
libmudflap testsuites.
The libmudflap failures are all the same:
<src>/libmudflap/testsuite/libmudflap.c/fail5-frag.c:10:
internal compiler error: in insn_locators_initialize, at cfglayout.c:314
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
-------------------------------------------------------------------------------
Testsuite differences between 20031026/gcc.sum.gz and 20031028/gcc.sum.gz
-------------------------------------------------------------------------------
New regressions in 20031028/gcc.sum.gz:
FAIL: gcc.dg/debug/debug-6.c scan-assembler xyzzy
FAIL: gcc.dg/debug/debug-6.c scan-assembler xyzzy
FAIL: gcc.dg/debug/debug-6.c scan-assembler xyzzy
FAIL: gcc.dg/debug/debug-6.c scan-assembler xyzzy
FAIL: 37:is 2:should be 1
FAIL: 93:is 3:should be 2
FAIL: 140:is 10:should be 5
FAIL: 142:is 10:should be 5
FAIL: 143:is 6:should be 1
FAIL: 152:is 12:should be 6
FAIL: 154:is 12:should be 6
FAIL: 156:is 12:should be 6
FAIL: 158:is 10:should be 6
FAIL: 160:is 8:should be 4
FAIL: 169:is 22:should be 11
FAIL: 171:is 22:should be 11
FAIL: 172:is 16:should be 5
FAIL: 173:is 13:should be 2
FAIL: 228:is 5:should be 3
FAIL: gcc.misc-tests/gcov-4.c gcov: 15 failures in line counts
FAIL: 15:is 9:should be 5
FAIL: gcc.misc-tests/gcov-6.c gcov: 1 failures in line counts
Fixed regressions in 20031028/gcc.sum.gz:
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Testsuite differences between 20031026/g++.sum.gz and 20031028/g++.sum.gz
-------------------------------------------------------------------------------
New regressions in 20031028/g++.sum.gz:
FAIL: 200:is 15:should be 11
FAIL: 202:is 23:should be 1
FAIL: g++.dg/gcov/gcov-1.C gcov: 3 failures in line counts
Fixed regressions in 20031028/g++.sum.gz:
FAIL: 200:is 4:should be 11
FAIL: 202:is 12:should be 1
FAIL: 212:is -:should be 11
FAIL: g++.dg/gcov/gcov-1.C gcov: 4 failures in line counts
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Testsuite differences between 20031026/libjava.sum.gz and 20031028/libjava.sum.gz
-------------------------------------------------------------------------------
New regressions in 20031028/libjava.sum.gz:
FAIL: Thread_Join execution - gij test
Fixed regressions in 20031028/libjava.sum.gz:
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Testsuite differences between 20031026/libmudflap.sum.gz and 20031028/libmudflap.sum.gz
-------------------------------------------------------------------------------
New regressions in 20031028/libmudflap.sum.gz:
FAIL: libmudflap.c/fail1-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/fail10-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/fail13-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/fail14-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/fail15-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/fail2-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/fail21-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/fail27-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/fail3-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/fail4-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/fail5-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/pass10-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/pass14-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/pass15-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/pass18-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/pass25-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/pass32-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/pass33-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/pass4-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/pass5-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.c/fail1-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/fail10-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/fail13-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/fail14-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/fail15-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/fail2-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/fail21-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/fail27-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/fail3-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/fail4-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/fail5-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/pass10-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/pass14-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/pass15-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/pass18-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/pass25-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/pass32-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/pass4-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c/pass5-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.c++/pass27-frag.cxx (-O2) (test for excess errors)
FAIL: libmudflap.c++/pass27-frag.cxx (-O3) (test for excess errors)
FAIL: libmudflap.cth/pass37-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.cth/pass39-frag.c (-O2) (test for excess errors)
FAIL: libmudflap.cth/pass37-frag.c (-O3) (test for excess errors)
FAIL: libmudflap.cth/pass39-frag.c (-O3) (test for excess errors)
Fixed regressions in 20031028/libmudflap.sum.gz:
-------------------------------------------------------------------------------
Thanks. Diego.
-------------- next part --------------
--- gcc.prev/gcc/ChangeLog.tree-ssa 2003-10-25 15:42:50.000000000 -0400
+++ gcc/gcc/ChangeLog.tree-ssa 2003-10-26 20:31:58.000000000 -0500
@@ -1,3 +1,59 @@
+2003-10-26 Richard Henderson <rth@redhat.com>
+
+ * gimplify.c (keep_function_tree_in_gimple_form): Remove.
+ (gimplify_function_tree): Return void. Remove hack for
+ language not supporting gimple.
+ * tree.h: Update decls.
+ * langhooks-def.h (LANG_HOOKS_GIMPLE_BEFORE_INLINING): New.
+ * langhooks.h (struct lang_hooks): Add gimple_before_inlining.
+ * tree-inline.c (copy_body_r): Check that instead of
+ keep_function_tree_in_gimple_form.
+ (initialize_inlined_parameters): Likewise.
+ (expand_call_inline, expand_calls_inline): Likewise.
+
+ * explow.c (probe_stack_range): Never emit loop notes.
+ * expr.c (emit_block_move_via_loop): Likewise.
+ * toplev.c (rest_of_compilation): Always synthesize loop notes.
+
+2003-10-26 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * Makefile.in (gimple-low.o): Add function.h dependency.
+ * gimple-low.c (struct lower_data): New field block.
+ (lower_function_body, lower_stmt, lower_bind_expr): Record
+ the block at statements.
+ * cfglayout.c (insn_locators_initialize): Use new info about
+ * blocks.
+ * expr.c (expand_expr): Record block changes.
+ * function.c (blocks_nreverse): Export.
+ (uninitialized_vars_warning): Use DECL_RTL_SET_P to test for presence
+ of rtl.
+ (reset_block_changes, record_block_change, finalize_block_changes,
+ check_block_change, free_block_changes): New functions.
+ * function.h (struct function): New bitfield dont_emit_block_notes.
+ New field ib_boundaries_block.
+ (blocks_nreverse, reset_block_changes, record_block_change,
+ finalize_block_changes, check_block_change, free_block_changes):
+ Declare.
+ * sibcall.c (optimize_sibling_and_tail_recursive_call): Don't call
+ reorder_blocks when dont_emit_block_notes.
+ * stmt.c (expand_start_bindings_and_block, expand_end_bindings):
+ Don't emit block notes when dont_emit_block_notes.
+ * toplev.c (rest_of_compilation): Don't call reorder_blocks when
+ dont_emit_block_notes.
+ * tree.c (build1): Initialize TREE_BLOCK field.
+ * tree-flow.h (lower_function_body): Declare.
+ * tree-optimize.c: Include function.h.
+ (optimize_function_tree): Call lower_function_body.
+ * tree.h (struct tree_exp): Add block field.
+ (TREE_BLOCK): New macro.
+
+2003-10-26 Richard Henderson <rth@redhat.com>
+
+ * tree.h (tree_dump_index): Add TDI_lower.
+ * tree-dump.c (dump_files): Add .lower entry.
+ * tree-optimize.c (optimize_function_tree): Move lower_function_body,
+ (tree_rest_of_compilation): here. Tidy .useless dump.
+
2003-10-25 Jan Hubicka <jh@suse.cz>
* c-common.c (c_estimate_num_insns_1): Kill.
--- gcc.prev/gcc/Makefile.in 2003-10-25 13:48:22.000000000 -0400
+++ gcc/gcc/Makefile.in 2003-10-26 13:16:52.000000000 -0500
@@ -1579,7 +1579,7 @@ gimplify.o : gimplify.c $(CONFIG_H) $(SY
gimple-low.o : gimple-low.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) errors.h \
diagnostic.h $(TREE_SIMPLE_H) tree-inline.h varray.h langhooks.h \
langhooks-def.h $(TREE_FLOW_H) $(TIMEVAR_H) $(TM_H) coretypes.h except.h \
- flags.h $(RTL_H)
+ flags.h $(RTL_H) function.h
tree-browser.o : tree-browser.c tree-browser.def $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) errors.h tree-inline.h diagnostic.h $(HASHTAB_H) \
$(TM_H) coretypes.h
--- gcc.prev/gcc/cfglayout.c 2003-10-06 13:36:14.000000000 -0400
+++ gcc/gcc/cfglayout.c 2003-10-26 13:16:53.000000000 -0500
@@ -310,10 +310,14 @@ insn_locators_initialize (void)
switch (NOTE_LINE_NUMBER (insn))
{
case NOTE_INSN_BLOCK_BEG:
+ if (cfun->dont_emit_block_notes)
+ abort ();
block = NOTE_BLOCK (insn);
delete_insn (insn);
break;
case NOTE_INSN_BLOCK_END:
+ if (cfun->dont_emit_block_notes)
+ abort ();
block = BLOCK_SUPERCONTEXT (block);
if (block && TREE_CODE (block) == FUNCTION_DECL)
block = 0;
@@ -328,11 +332,17 @@ insn_locators_initialize (void)
break;
}
}
+
+ if (cfun->dont_emit_block_notes)
+ check_block_change (insn, &block);
}
/* Tag the blocks with a depth number so that change_scope can find
the common parent easily. */
set_block_levels (DECL_INITIAL (cfun->decl), 0);
+
+ if (cfun->dont_emit_block_notes)
+ free_block_changes ();
}
/* For each lexical block, set BLOCK_NUMBER to the depth at which it is
--- gcc.prev/gcc/explow.c 2003-09-28 02:06:21.000000000 -0400
+++ gcc/gcc/explow.c 2003-10-26 20:31:58.000000000 -0500
@@ -1490,23 +1490,16 @@ probe_stack_range (HOST_WIDE_INT first,
rtx test_lab = gen_label_rtx ();
rtx end_lab = gen_label_rtx ();
rtx temp;
- int create_notes
- = ! keep_function_tree_in_gimple_form (current_function_decl);
if (GET_CODE (test_addr) != REG
|| REGNO (test_addr) < FIRST_PSEUDO_REGISTER)
test_addr = force_reg (Pmode, test_addr);
- if (create_notes)
- emit_note (NOTE_INSN_LOOP_BEG);
emit_jump (test_lab);
emit_label (loop_lab);
emit_stack_probe (test_addr);
- if (create_notes)
- emit_note (NOTE_INSN_LOOP_CONT);
-
#ifdef STACK_GROWS_DOWNWARD
#define CMP_OPCODE GTU
temp = expand_binop (Pmode, sub_optab, test_addr, incr, test_addr,
@@ -1524,8 +1517,6 @@ probe_stack_range (HOST_WIDE_INT first,
emit_cmp_and_jump_insns (test_addr, last_addr, CMP_OPCODE,
NULL_RTX, Pmode, 1, loop_lab);
emit_jump (end_lab);
- if (create_notes)
- emit_note (NOTE_INSN_LOOP_END);
emit_label (end_lab);
emit_stack_probe (last_addr);
--- gcc.prev/gcc/expr.c 2003-10-18 19:59:44.000000000 -0400
+++ gcc/gcc/expr.c 2003-10-26 20:31:58.000000000 -0500
@@ -1676,9 +1676,6 @@ emit_block_move_via_loop (rtx x, rtx y,
{
rtx cmp_label, top_label, iter, x_addr, y_addr, tmp;
enum machine_mode iter_mode;
- int create_notes
- = ! keep_function_tree_in_gimple_form (current_function_decl);
-
iter_mode = GET_MODE (size);
if (iter_mode == VOIDmode)
@@ -1694,9 +1691,6 @@ emit_block_move_via_loop (rtx x, rtx y,
y_addr = force_operand (XEXP (y, 0), NULL_RTX);
do_pending_stack_adjust ();
- if (create_notes)
- emit_note (NOTE_INSN_LOOP_BEG);
-
emit_jump (cmp_label);
emit_label (top_label);
@@ -1713,15 +1707,10 @@ emit_block_move_via_loop (rtx x, rtx y,
if (tmp != iter)
emit_move_insn (iter, tmp);
- if (create_notes)
- emit_note (NOTE_INSN_LOOP_CONT);
emit_label (cmp_label);
emit_cmp_and_jump_insns (iter, size, LT, NULL_RTX, iter_mode,
true, top_label);
-
- if (create_notes)
- emit_note (NOTE_INSN_LOOP_END);
}
/* Copy all or part of a value X into registers starting at REGNO.
@@ -6229,6 +6218,10 @@ expand_expr (tree exp, rtx target, enum
input_location = *EXPR_LOCUS (exp);
emit_line_note (input_location);
+ /* Record where the insns produced belong. */
+ if (cfun->dont_emit_block_notes)
+ record_block_change (TREE_BLOCK (exp));
+
ret = expand_expr_1 (exp, target, tmode, modifier);
input_location = saved_location;
@@ -8416,7 +8409,11 @@ expand_expr_1 (tree exp, rtx target, enu
{
expand_start_else ();
if (EXPR_LOCUS (exp))
- emit_line_note (*(EXPR_LOCUS (exp)));
+ {
+ emit_line_note (*(EXPR_LOCUS (exp)));
+ if (cfun->dont_emit_block_notes)
+ record_block_change (TREE_BLOCK (exp));
+ }
expand_elseif (TREE_OPERAND (exp, 0));
expand_expr (TREE_OPERAND (exp, 1), const0_rtx, VOIDmode, 0);
}
--- gcc.prev/gcc/f/ChangeLog.tree-ssa 2003-09-24 17:43:13.000000000 -0400
+++ gcc/gcc/f/ChangeLog.tree-ssa 2003-10-26 19:08:36.000000000 -0500
@@ -1,3 +1,7 @@
+2003-10-26 Richard Henderson <rth@redhat.com>
+
+ * config-lang.in: Remove.
+
2003-09-24 Jason Merrill <jason@redhat.com>
* com.c, ste.c: Revert earlier change.
--- gcc.prev/gcc/f/config-lang.in 2002-08-25 21:35:18.000000000 -0400
+++ gcc/gcc/f/config-lang.in 1969-12-31 19:00:00.000000000 -0500
@@ -1,36 +0,0 @@
-# Top level configure fragment for GNU FORTRAN.
-# Copyright (C) 1995, 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
-
-#This file is part of GNU Fortran.
-
-#GNU Fortran is free software; you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 2, or (at your option)
-#any later version.
-
-#GNU Fortran is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
-
-#You should have received a copy of the GNU General Public License
-#along with GNU Fortran; see the file COPYING. If not, write to
-#the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-#02111-1307, USA.
-
-# Configure looks for the existence of this file to auto-config each language.
-# We define several parameters used by configure:
-#
-# language - name of language as it would appear in $(LANGUAGES)
-# compilers - value to add to $(COMPILERS)
-# stagestuff - files to add to $(STAGESTUFF)
-
-language="f77"
-
-compilers="f771\$(exeext)"
-
-stagestuff="g77\$(exeext) g77-cross\$(exeext) f771\$(exeext)"
-
-target_libs=target-libf2c
-
-gtfiles="\$(srcdir)/f/com.c \$(srcdir)/f/com.h \$(srcdir)/f/ste.c \$(srcdir)/f/where.h \$(srcdir)/f/where.c \$(srcdir)/f/lex.c"
--- gcc.prev/gcc/fortran/ChangeLog 2003-10-23 12:45:53.000000000 -0400
+++ gcc/gcc/fortran/ChangeLog 2003-10-26 20:32:00.000000000 -0500
@@ -1,5 +1,11 @@
2003-10-23 Richard Henderson <rth@redhat.com>
+ * f96-lang.c (gfc_gimplify_expr): Remove.
+ (LANG_HOOKS_GIMPLIFY_EXPR): Remove.
+ (LANG_HOOKS_GIMPLE_BEFORE_INLINING): New.
+
+2003-10-23 Richard Henderson <rth@redhat.com>
+
* f95-lang.c (gfc_gimplify_expr): Return gimplify_status.
2003-10-20 Paul Brook <paul@nowt.org>
--- gcc.prev/gcc/fortran/f95-lang.c 2003-10-23 12:45:53.000000000 -0400
+++ gcc/gcc/fortran/f95-lang.c 2003-10-26 20:32:00.000000000 -0500
@@ -106,7 +106,6 @@ void set_block (tree);
static void gfc_be_parse_file (int);
static int gfc_expand_decl (tree t);
static void gfc_expand_stmt (tree t);
-static int gfc_gimplify_expr (tree *, tree *, tree *);
#undef LANG_HOOKS_NAME
#undef LANG_HOOKS_INIT
@@ -124,7 +123,7 @@ static int gfc_gimplify_expr (tree *, tr
#undef LANG_HOOKS_UNSIGNED_TYPE
#undef LANG_HOOKS_SIGNED_TYPE
#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
-#undef LANG_HOOKS_GIMPLIFY_EXPR
+#undef LANG_HOOKS_GIMPLE_BEFORE_INLINING
#undef LANG_HOOKS_RTL_EXPAND_STMT
/* Define lang hooks. */
@@ -144,8 +143,7 @@ static int gfc_gimplify_expr (tree *, tr
#define LANG_HOOKS_UNSIGNED_TYPE gfc_unsigned_type
#define LANG_HOOKS_SIGNED_TYPE gfc_signed_type
#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE gfc_signed_or_unsigned_type
-/* We need to provide this otherwise the gimplifier ignores us. */
-#define LANG_HOOKS_GIMPLIFY_EXPR gfc_gimplify_expr
+#define LANG_HOOKS_GIMPLE_BEFORE_INLINING false
#define LANG_HOOKS_RTL_EXPAND_STMT gfc_expand_stmt
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
@@ -361,18 +359,6 @@ gfc_print_identifier (FILE * file ATTRIB
{
return;
}
-
-
-/* This must exist otherwise the gimplifier ignores us. */
-
-static int
-gfc_gimplify_expr (tree * expr_p ATTRIBUTE_UNUSED,
- tree * pre_p ATTRIBUTE_UNUSED,
- tree *post_p ATTRIBUTE_UNUSED)
-{
- /* Just let the gimplifier handle everything. */
- return GS_UNHANDLED;
-}
/* These functions and variables deal with binding contours. We only
--- gcc.prev/gcc/function.c 2003-10-18 19:59:46.000000000 -0400
+++ gcc/gcc/function.c 2003-10-26 13:16:54.000000000 -0500
@@ -265,7 +265,6 @@ static tree *identify_blocks_1 (rtx, tre
static void reorder_blocks_0 (tree);
static void reorder_blocks_1 (rtx, tree, varray_type *);
static void reorder_fix_fragments (tree);
-static tree blocks_nreverse (tree);
static int all_blocks (tree, tree *);
static tree *get_block_vector (tree, int *);
extern tree debug_find_var_in_block_tree (tree, tree);
@@ -5607,7 +5606,7 @@ uninitialized_vars_warning (tree block)
flow.c that the entire aggregate was initialized.
Unions are troublesome because members may be shorter. */
&& ! AGGREGATE_TYPE_P (TREE_TYPE (decl))
- && DECL_RTL (decl) != 0
+ && DECL_RTL_SET_P (decl)
&& GET_CODE (DECL_RTL (decl)) == REG
/* Global optimizations can make it difficult to determine if a
particular variable has been initialized. However, a VAR_DECL
@@ -5622,7 +5621,7 @@ uninitialized_vars_warning (tree block)
decl, decl);
if (extra_warnings
&& TREE_CODE (decl) == VAR_DECL
- && DECL_RTL (decl) != 0
+ && DECL_RTL_SET_P (decl)
&& GET_CODE (DECL_RTL (decl)) == REG
&& regno_clobbered_at_setjmp (REGNO (DECL_RTL (decl))))
warning ("%Jvariable '%D' might be clobbered by `longjmp' or `vfork'",
@@ -6186,7 +6185,7 @@ reorder_fix_fragments (tree block)
/* Reverse the order of elements in the chain T of blocks,
and return the new head of the chain (old last element). */
-static tree
+tree
blocks_nreverse (tree t)
{
tree prev = 0, decl, next;
@@ -7955,4 +7954,56 @@ init_function_once (void)
VARRAY_INT_INIT (sibcall_epilogue, 0, "sibcall_epilogue");
}
+/* Resets insn_block_boundaries array. */
+
+void
+reset_block_changes ()
+{
+ VARRAY_TREE_INIT (cfun->ib_boundaries_block, 100, "ib_boundaries_block");
+ VARRAY_PUSH_TREE (cfun->ib_boundaries_block, NULL_TREE);
+}
+
+/* Record the boundary for BLOCK. */
+void
+record_block_change (tree block)
+{
+ int i, n;
+ tree last_block;
+
+ if (!block)
+ return;
+
+ last_block = VARRAY_TOP_TREE (cfun->ib_boundaries_block);
+ VARRAY_POP (cfun->ib_boundaries_block);
+ n = get_max_uid ();
+ for (i = VARRAY_ACTIVE_SIZE (cfun->ib_boundaries_block); i < n; i++)
+ VARRAY_PUSH_TREE (cfun->ib_boundaries_block, last_block);
+
+ VARRAY_PUSH_TREE (cfun->ib_boundaries_block, block);
+}
+
+/* Finishes record of boundaries. */
+void finalize_block_changes ()
+{
+ record_block_change (DECL_INITIAL (current_function_decl));
+}
+
+/* For INSN return the BLOCK it belongs to. */
+void
+check_block_change (rtx insn, tree *block)
+{
+ unsigned uid = INSN_UID (insn);
+
+ if (uid >= VARRAY_ACTIVE_SIZE (cfun->ib_boundaries_block))
+ return;
+
+ *block = VARRAY_TREE (cfun->ib_boundaries_block, uid);
+}
+
+/* Releases the ib_boundaries_block records. */
+void
+free_block_changes ()
+{
+ cfun->ib_boundaries_block = NULL;
+}
#include "gt-function.h"
--- gcc.prev/gcc/function.h 2003-10-06 13:36:33.000000000 -0400
+++ gcc/gcc/function.h 2003-10-26 13:16:54.000000000 -0500
@@ -392,6 +392,10 @@ struct function GTY(())
delay list for them is recorded here. */
rtx epilogue_delay_list;
+ /* Nonzero if NOTE_INSN_BLOCK_BEG / NOTE_INSN_BLOCK_END notes should not
+ be emitted. */
+ unsigned int dont_emit_block_notes : 1;
+
/* How commonly executed the function is. Initialized during branch
probabilities pass. */
enum function_frequency {
@@ -412,6 +416,9 @@ struct function GTY(())
/* Line number of the end of the function. */
location_t function_end_locus;
+ /* Array mapping insn uids to blocks. */
+ struct varray_head_tag *ib_boundaries_block;
+
/* Collected bit flags. */
/* Nonzero if function being compiled needs to be given an address
@@ -604,6 +611,13 @@ extern void reorder_blocks (void);
/* Set BLOCK_NUMBER for all the blocks in FN. */
extern void number_blocks (tree);
+extern tree blocks_nreverse (tree);
+extern void reset_block_changes (void);
+extern void record_block_change (tree);
+extern void finalize_block_changes (void);
+extern void check_block_change (rtx, tree *);
+extern void free_block_changes (void);
+
/* Return size needed for stack frame based on slots so far allocated.
This size counts from zero. It is not rounded to STACK_BOUNDARY;
the caller may have to do that. */
--- gcc.prev/gcc/gimple-low.c 2003-10-25 13:48:23.000000000 -0400
+++ gcc/gcc/gimple-low.c 2003-10-26 13:16:54.000000000 -0500
@@ -43,7 +43,8 @@ Software Foundation, 59 Temple Place - S
struct lower_data
{
- void *dummy; /* To get rid of an empty structure warning. */
+ /* Block the current statement belongs to. */
+ tree block;
};
static void lower_stmt_body (tree *, struct lower_data *);
@@ -63,7 +64,16 @@ lower_function_body (tree *body)
if (TREE_CODE (*body) != BIND_EXPR)
abort ();
+ data.block = DECL_INITIAL (current_function_decl);
+ BLOCK_SUBBLOCKS (data.block) = NULL_TREE;
+ BLOCK_CHAIN (data.block) = NULL_TREE;
+
lower_stmt_body (&BIND_EXPR_BODY (*body), &data);
+
+ if (data.block != DECL_INITIAL (current_function_decl))
+ abort ();
+ BLOCK_SUBBLOCKS (data.block) =
+ blocks_nreverse (BLOCK_SUBBLOCKS (data.block));
}
/* Lowers the EXPR. Unlike gimplification the statements are not relowered
@@ -85,6 +95,9 @@ lower_stmt (tree_stmt_iterator *tsi, str
{
tree stmt = tsi_stmt (*tsi);
+ if (EXPR_LOCUS (stmt))
+ TREE_BLOCK (stmt) = data->block;
+
switch (TREE_CODE (stmt))
{
case BIND_EXPR:
@@ -130,9 +143,32 @@ lower_stmt (tree_stmt_iterator *tsi, str
static void
lower_bind_expr (tree_stmt_iterator *tsi, struct lower_data *data)
{
+ tree old_block = data->block;
tree stmt = tsi_stmt (*tsi);
+ if (BIND_EXPR_BLOCK (stmt))
+ {
+ data->block = BIND_EXPR_BLOCK (stmt);
+
+ /* Block tree may get clobbered by inlining. Normally this would be
+ fixed in rest_of_decl_compilation using block notes, but since we
+ are not going to emit them, it is up to us. */
+ BLOCK_CHAIN (data->block) = BLOCK_SUBBLOCKS (old_block);
+ BLOCK_SUBBLOCKS (old_block) = data->block;
+ BLOCK_SUBBLOCKS (data->block) = NULL_TREE;
+ BLOCK_SUPERCONTEXT (data->block) = old_block;
+ }
lower_stmt_body (&BIND_EXPR_BODY (stmt), data);
+
+ if (BIND_EXPR_BLOCK (stmt))
+ {
+ if (data->block != BIND_EXPR_BLOCK (stmt))
+ abort ();
+
+ BLOCK_SUBBLOCKS (data->block) =
+ blocks_nreverse (BLOCK_SUBBLOCKS (data->block));
+ data->block = old_block;
+ }
}
/* Checks whether EXPR is a simple local goto. */
--- gcc.prev/gcc/gimplify.c 2003-10-24 03:41:31.000000000 -0400
+++ gcc/gcc/gimplify.c 2003-10-26 20:31:59.000000000 -0500
@@ -3147,52 +3147,18 @@ gimplify_body (tree *body_p, tree fndecl
input_location = saved_location;
}
-/* Return nonzero if we should keep FNDECL in gimple form during inlining. */
-
-int
-keep_function_tree_in_gimple_form (tree fndecl)
-{
- tree fnbody;
-
- /* If the front-end does not support gimplification, then this
- function was never in gimple form to begin with. */
- if (lang_hooks.gimplify_expr == lhd_gimplify_expr)
- return 0;
-
- /* If the function has no body, then we consider it not in gimple
- form. */
- fnbody = DECL_SAVED_TREE (fndecl);
- if (fnbody == NULL_TREE)
- return 0;
-
- return 1;
-}
-
-/* Entry point to the gimplification pass. FNDECL is the FUNCTION_DECL
- node for the function we want to gimplify. */
+/* Entry point to the gimplification pass. FNDECL is the FUNCTION_DECL
+ node for the function we want to gimplify. */
-bool
+void
gimplify_function_tree (tree fndecl)
{
- tree fnbody;
tree oldfn;
- /* FIXME. Hack. If this front end does not support gimplification,
- do nothing. */
- if (lang_hooks.gimplify_expr == lhd_gimplify_expr)
- return false;
-
- fnbody = DECL_SAVED_TREE (fndecl);
- if (fnbody == NULL_TREE)
- return false;
-
oldfn = current_function_decl;
current_function_decl = fndecl;
- gimplify_body (&fnbody, fndecl);
+ gimplify_body (&DECL_SAVED_TREE (fndecl), fndecl);
- DECL_SAVED_TREE (fndecl) = fnbody;
current_function_decl = oldfn;
-
- return true;
}
diff -r -dupN -x '*.1' -x '*.7' -x '*.info*' -x '.#*' -x '*.rej' -x '*.orig' -x CVS -x autom4te.cache -x '*-parse.c' -x '*-parse.y' -x 'gengtype-*.c' -x 'gengtype-*.h' -x '*/java/parse-scan.c' -x '*/java/parse.c' -x '*/treelang/lex.c' -x '*/treelang/parse.*' gcc.prev/gcc/langhooks-def.h gcc/gcc/langhooks-def.h
--- gcc.prev/gcc/langhooks-def.h 2003-10-25 15:42:52.000000000 -0400
+++ gcc/gcc/langhooks-def.h 2003-10-26 20:31:59.000000000 -0500
@@ -207,6 +207,7 @@ extern int lhd_gimplify_expr (tree *, tr
/* Hooks for tree gimplification. */
#define LANG_HOOKS_GIMPLIFY_EXPR lhd_gimplify_expr
+#define LANG_HOOKS_GIMPLE_BEFORE_INLINING true
/* Tree dump hooks. */
extern bool lhd_tree_dump_dump_tree (void *, tree);
@@ -319,7 +320,8 @@ extern int lhd_tree_dump_type_quals (tre
LANG_HOOKS_DECLS, \
LANG_HOOKS_FOR_TYPES_INITIALIZER, \
LANG_HOOKS_RTL_EXPAND_INITIALIZER, \
- LANG_HOOKS_GIMPLIFY_EXPR \
+ LANG_HOOKS_GIMPLIFY_EXPR, \
+ LANG_HOOKS_GIMPLE_BEFORE_INLINING \
}
#endif /* GCC_LANG_HOOKS_DEF_H */
--- gcc.prev/gcc/langhooks.h 2003-10-25 15:42:52.000000000 -0400
+++ gcc/gcc/langhooks.h 2003-10-26 20:31:59.000000000 -0500
@@ -425,6 +425,10 @@ struct lang_hooks
enum gimplify_status, though we can't see that type here. */
int (*gimplify_expr) (tree *, tree *, tree *);
+ /* True if the front end has gimplified the function before running the
+ inliner, false if the front end generates GENERIC directly. */
+ bool gimple_before_inlining;
+
/* Whenever you add entries here, make sure you adjust langhooks-def.h
and langhooks.c accordingly. */
};
--- gcc.prev/gcc/sibcall.c 2003-07-23 12:59:57.000000000 -0400
+++ gcc/gcc/sibcall.c 2003-10-26 13:16:54.000000000 -0500
@@ -748,7 +748,8 @@ optimize_sibling_and_tail_recursive_call
/* There may have been NOTE_INSN_BLOCK_{BEGIN,END} notes in the
CALL_PLACEHOLDER alternatives that we didn't emit. Rebuild the
lexical block tree to correspond to the notes that still exist. */
- if (replaced_call_placeholder)
+ if (replaced_call_placeholder
+ && !cfun->dont_emit_block_notes)
reorder_blocks ();
/* This information will be invalid after inline expansion. Kill it now. */
--- gcc.prev/gcc/stmt.c 2003-10-09 13:09:34.000000000 -0400
+++ gcc/gcc/stmt.c 2003-10-26 13:16:54.000000000 -0500
@@ -3399,7 +3399,7 @@ expand_start_bindings_and_block (int fla
abort ();
/* Create a note to mark the beginning of the block. */
- if (block_flag)
+ if (block_flag && !cfun->dont_emit_block_notes)
{
note = emit_note (NOTE_INSN_BLOCK_BEG);
NOTE_BLOCK (note) = block;
@@ -3819,7 +3819,7 @@ expand_end_bindings (tree vars, int mark
We do this now, after running cleanups on the variables
just going out of scope, so they are in scope for their cleanups. */
- if (mark_ends)
+ if (mark_ends && !cfun->dont_emit_block_notes)
{
rtx note = emit_note (NOTE_INSN_BLOCK_END);
NOTE_BLOCK (note) = NOTE_BLOCK (thisblock->data.block.first_insn);
--- gcc.prev/gcc/toplev.c 2003-10-18 19:59:51.000000000 -0400
+++ gcc/gcc/toplev.c 2003-10-26 20:31:59.000000000 -0500
@@ -3165,15 +3165,20 @@ rest_of_compilation (tree decl)
have been run to re-initialize it. */
cse_not_expected = ! optimize;
- /* First, make sure that NOTE_BLOCK is set correctly for each
- NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note. */
- if (!cfun->x_whole_function_mode_p)
- identify_blocks ();
+ if (!cfun->dont_emit_block_notes)
+ {
+ /* First, make sure that NOTE_BLOCK is set correctly for each
+ NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note. */
+ if (!cfun->x_whole_function_mode_p)
+ identify_blocks ();
- /* In function-at-a-time mode, we do not attempt to keep the BLOCK
- tree in sensible shape. So, we just recalculate it here. */
- if (cfun->x_whole_function_mode_p)
- reorder_blocks ();
+ /* In function-at-a-time mode, we do not attempt to keep the BLOCK
+ tree in sensible shape. So, we just recalculate it here. */
+ if (cfun->x_whole_function_mode_p)
+ reorder_blocks ();
+ }
+ else
+ finalize_block_changes ();
init_flow ();
@@ -3201,7 +3206,8 @@ rest_of_compilation (tree decl)
over the instruction sequence faster, and allow the garbage
collector to reclaim the memory used by the notes. */
remove_unnecessary_notes ();
- reorder_blocks ();
+ if (!cfun->dont_emit_block_notes)
+ reorder_blocks ();
ggc_collect ();
@@ -3317,8 +3323,7 @@ rest_of_compilation (tree decl)
cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_PRE_LOOP
| (flag_thread_jumps ? CLEANUP_THREADING : 0));
- if (keep_function_tree_in_gimple_form (current_function_decl))
- create_loop_notes ();
+ create_loop_notes ();
if (optimize)
{
--- gcc.prev/gcc/tree-dump.c 2003-10-24 00:28:54.000000000 -0400
+++ gcc/gcc/tree-dump.c 2003-10-26 05:01:27.000000000 -0500
@@ -654,6 +654,7 @@ static struct dump_file_info dump_files[
{".gimple", "tree-gimple", 0, 0},
{".useless", "tree-useless", 0, 0},
{".eh", "tree-eh", 0, 0},
+ {".lower", "tree-lower", 0, 0},
{".cfg", "tree-cfg", 0, 0},
{".dot", "tree-dot", 0, 0},
{".tail", "tree-tail", 0, 0},
--- gcc.prev/gcc/tree-flow.h 2003-10-25 13:48:23.000000000 -0400
+++ gcc/gcc/tree-flow.h 2003-10-26 13:16:55.000000000 -0500
@@ -489,6 +489,8 @@ extern void mark_new_vars_to_rename (tre
#define TDFA_USE_OPS 1 << 0
#define TDFA_USE_VOPS 1 << 1
+/* In gimple-low.c */
+void lower_function_body (tree *);
/* In tree-ssa.c */
extern void init_tree_ssa (void);
--- gcc.prev/gcc/tree-inline.c 2003-10-25 15:42:52.000000000 -0400
+++ gcc/gcc/tree-inline.c 2003-10-26 20:31:59.000000000 -0500
@@ -458,7 +458,7 @@ copy_body_r (tree *tp, int *walk_subtree
if (assignment)
{
/* Do not create a statement containing a naked RESULT_DECL. */
- if (keep_function_tree_in_gimple_form (id->decl))
+ if (lang_hooks.gimple_before_inlining)
if (TREE_CODE (assignment) == RESULT_DECL)
gimplify_stmt (&assignment);
@@ -724,7 +724,7 @@ initialize_inlined_parameters (inline_da
TREE_CHAIN (var) = vars;
vars = var;
/* Make gimplifier happy about this variable. */
- var->decl.seen_in_bind_expr = keep_function_tree_in_gimple_form (fn);
+ var->decl.seen_in_bind_expr = lang_hooks.gimple_before_inlining;
/* Even if P was TREE_READONLY, the new VAR should not be.
In the original code, we would have constructed a
@@ -789,8 +789,7 @@ initialize_inlined_parameters (inline_da
value);
}
- if (gimplify_init_stmts_p
- && keep_function_tree_in_gimple_form (fn))
+ if (gimplify_init_stmts_p && lang_hooks.gimple_before_inlining)
gimplify_body (&init_stmts, fn);
add_var_to_bind_expr (bind_expr, vars);
@@ -1605,7 +1604,7 @@ expand_call_inline (tree *tp, int *walk_
/* If we are working with gimple form, then we need to keep the tree
in gimple form. If we are not in gimple form, we can just replace
*tp with the new BIND_EXPR. */
- if (keep_function_tree_in_gimple_form (id->decl))
+ if (lang_hooks.gimple_before_inlining)
{
tree save_decl;
@@ -1732,7 +1731,7 @@ expand_calls_inline (tree *tp, inline_da
recursively as we do not know anything about the structure
of the tree. */
- if (! keep_function_tree_in_gimple_form (id->decl))
+ if (!lang_hooks.gimple_before_inlining)
{
walk_tree (tp, expand_call_inline, id, id->tree_pruner);
return;
--- gcc.prev/gcc/tree-optimize.c 2003-10-25 13:48:24.000000000 -0400
+++ gcc/gcc/tree-optimize.c 2003-10-26 20:31:59.000000000 -0500
@@ -58,12 +58,14 @@ optimize_function_tree (tree fndecl)
if (errorcount || sorrycount)
return;
- /* Lower the structured statements. */
- lower_function_body (&DECL_SAVED_TREE (fndecl));
-
/* Build the flowgraph. */
init_flow ();
+ lower_function_body (&DECL_SAVED_TREE (fndecl));
+ /* Avoid producing notes for blocks. */
+ cfun->dont_emit_block_notes = 1;
+ reset_block_changes ();
+
build_tree_cfg (DECL_SAVED_TREE (fndecl));
/* Begin analysis and optimization passes. After the function is
@@ -275,35 +277,29 @@ tree_rest_of_compilation (tree fndecl, b
nested_p = true;
}
- /* Gimplify the function. Don't try to optimize the function if
- gimplification failed. */
- if (keep_function_tree_in_gimple_form (fndecl)
- || gimplify_function_tree (fndecl))
- {
- /* Debugging dump after gimplification. */
- dump_function (TDI_gimple, fndecl);
+ /* If the function has not already been gimplified, do so now. */
+ if (!lang_hooks.gimple_before_inlining)
+ gimplify_function_tree (fndecl);
- /* Run a pass over the statements deleting any obviously useless
- statements before we build the CFG. */
- remove_useless_stmts_and_vars (&DECL_SAVED_TREE (fndecl), false);
- {
- int flags;
- FILE *file = dump_begin (TDI_useless, &flags);
- if (file)
- {
- dump_function_to_file (fndecl, file, flags);
- dump_end (TDI_useless, file);
- }
- }
+ /* Debugging dump after gimplification. */
+ dump_function (TDI_gimple, fndecl);
- /* Run a pass to lower magic exception handling constructs into,
- well, less magic though not completely mundane constructs. */
- lower_eh_constructs (&DECL_SAVED_TREE (fndecl));
+ /* Run a pass over the statements deleting any obviously useless
+ statements before we build the CFG. */
+ remove_useless_stmts_and_vars (&DECL_SAVED_TREE (fndecl), false);
+ dump_function (TDI_useless, fndecl);
- /* Invoke the SSA tree optimizer. */
- if (optimize >= 1 && !flag_disable_tree_ssa)
- optimize_function_tree (fndecl);
- }
+ /* Run a pass to lower magic exception handling constructs into,
+ well, less magic though not completely mundane constructs. */
+ lower_eh_constructs (&DECL_SAVED_TREE (fndecl));
+
+ /* Lower the structured statements. */
+ lower_function_body (&DECL_SAVED_TREE (fndecl));
+ dump_function (TDI_lower, fndecl);
+
+ /* Invoke the SSA tree optimizer. */
+ if (optimize >= 1 && !flag_disable_tree_ssa)
+ optimize_function_tree (fndecl);
/* If the function has a variably modified type, there may be
SAVE_EXPRs in the parameter types. Their context must be set to
--- gcc.prev/gcc/tree.c 2003-10-23 23:24:45.000000000 -0400
+++ gcc/gcc/tree.c 2003-10-26 13:16:55.000000000 -0500
@@ -2448,6 +2448,7 @@ build1 (enum tree_code code, tree type,
SET_EXPR_LOCUS (t, NULL);
TREE_COMPLEXITY (t) = 0;
TREE_OPERAND (t, 0) = node;
+ TREE_BLOCK (t) = NULL_TREE;
if (node && first_rtl_op (code) != 0)
{
TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (node);
--- gcc.prev/gcc/tree.h 2003-10-24 00:28:55.000000000 -0400
+++ gcc/gcc/tree.h 2003-10-26 20:31:59.000000000 -0500
@@ -432,6 +432,8 @@ extern void tree_operand_check_failed (i
#endif
+#define TREE_BLOCK(NODE) ((NODE)->exp.block)
+
#include "tree-check.h"
#define TYPE_CHECK(T) TREE_CLASS_CHECK (T, 't')
@@ -994,6 +996,7 @@ struct tree_exp GTY(())
struct tree_common common;
location_t *locus;
int complexity;
+ tree block;
tree GTY ((special ("tree_exp"),
desc ("TREE_CODE ((tree) &%0)")))
operands[1];
@@ -3440,10 +3443,9 @@ extern int containing_blocks_have_cleanu
void optimize_function_tree (tree);
/* In gimplify.c. */
-extern bool gimplify_function_tree (tree);
+extern void gimplify_function_tree (tree);
extern const char *get_name (tree);
extern tree unshare_expr (tree);
-extern int keep_function_tree_in_gimple_form (tree);
/* If KIND=='I', return a suitable global initializer (constructor) name.
If KIND=='D', return a suitable global clean-up (destructor) name. */
@@ -3500,6 +3502,7 @@ enum tree_dump_index
TDI_gimple, /* dump each function after gimplifying it. */
TDI_useless, /* dump after cleaning useless bits. */
TDI_eh, /* dump after lowering eh. */
+ TDI_lower, /* dump after lowering containers. */
TDI_cfg, /* dump the flowgraph for each function. */
TDI_dot, /* create a dot graph file for each
function's flowgraph. */
More information about the Gcc
mailing list