19991023 ICE compiling XFree86
Richard Henderson
rth@cygnus.com
Sun Oct 31 23:33:00 GMT 1999
On Tue, Oct 26, 1999 at 10:18:47PM -0600, Jeffrey A Law wrote:
> If it gets too confused it is supposed to give up and assume the worst.
Yes, I see that now -- by marking all resources in use.
> It's always been some of the worst code in reorg/resource.
Indeed.
Thoughts on the brute-force solution of just re-running flow? Not the
best solution, but short of completely rewriting the cross-jump code...
r~
* jump.c (jump_optimize_1): If we did cross-jumping, and
the data will matter, rebuild the CFG.
* reg-stack.c (reg_to_stack): Only (re)build the CFG if
not optimizing. Don't run shorten_branches.
* resource.c (mark_target_live_regs): Check that the target
insn wasn't created after compute_bb_for_insn.
* toplev.c (rest_of_compilation): Run shorten_branches after
reg_to_stack.
Index: jump.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/jump.c,v
retrieving revision 1.82
diff -c -p -d -r1.82 jump.c
*** jump.c 1999/10/20 10:21:47 1.82
--- jump.c 1999/10/27 04:57:11
*************** Boston, MA 02111-1307, USA. */
*** 66,71 ****
--- 66,73 ----
#include "expr.h"
#include "real.h"
#include "except.h"
+ #include "basic-block.h"
+ #include "output.h"
#include "toplev.h"
/* ??? Eventually must record somehow the labels used by jumps
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 190,195 ****
--- 192,198 ----
int first = 1;
int max_uid = 0;
rtx last_insn;
+ int did_cross_jump = 0;
cross_jump_death_matters = (cross_jump == 2);
max_uid = init_label_info (f) + 1;
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 2127,2132 ****
--- 2130,2136 ----
if (newjpos != 0)
{
+ did_cross_jump = 1;
do_cross_jump (insn, newjpos, newlpos);
/* Make the old conditional jump
into an unconditional one. */
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 2179,2184 ****
--- 2183,2189 ----
if (newjpos != 0)
{
+ did_cross_jump = 1;
do_cross_jump (insn, newjpos, newlpos);
changed = 1;
next = insn;
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 2210,2215 ****
--- 2215,2221 ----
if (newjpos != 0)
{
+ did_cross_jump = 1;
do_cross_jump (insn, newjpos, newlpos);
changed = 1;
next = insn;
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 2274,2279 ****
--- 2280,2302 ----
/* Show JUMP_CHAIN no longer valid. */
jump_chain = 0;
+
+ #if defined(DELAY_SLOTS) || defined(STACK_REGS)
+ /* ??? Keep the CFG up to date after cross-jumping. */
+ if (did_cross_jump && !cross_jump_death_matters)
+ {
+ sbitmap blocks;
+
+ find_basic_blocks (f, old_max_reg, NULL, 0);
+
+ blocks = sbitmap_alloc (n_basic_blocks);
+ sbitmap_ones (blocks);
+ count_or_remove_death_notes (blocks, 1);
+ sbitmap_free (blocks);
+
+ life_analysis (f, old_max_reg, NULL, 0);
+ }
+ #endif
}
/* Initialize LABEL_NUSES and JUMP_LABEL fields. Delete any REG_LABEL
Index: reg-stack.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reg-stack.c,v
retrieving revision 1.42
diff -c -p -d -r1.42 reg-stack.c
*** reg-stack.c 1999/10/27 01:25:12 1.42
--- reg-stack.c 1999/10/27 04:57:11
*************** pop_stack (regstack, regno)
*** 406,413 ****
register file. FIRST is the first insn in the function, FILE is the
dump file, if used.
! Construct a CFG and run life analysis. (When optimizing, the data
! was corruped by jump2's cross-jumping.) Then convert each insn one
by one. Run a last jump_optimize pass, if optimizing, to eliminate
code duplication created when the converter inserts pop insns on
the edges. */
--- 406,412 ----
register file. FIRST is the first insn in the function, FILE is the
dump file, if used.
! Construct a CFG and run life analysis. Then convert each insn one
by one. Run a last jump_optimize pass, if optimizing, to eliminate
code duplication created when the converter inserts pop insns on
the edges. */
*************** reg_to_stack (first, file)
*** 430,445 ****
if (i > LAST_STACK_REG)
return;
! /* Ok, floating point instructions exist. Rebuild the CFG and run
! life analysis. */
! find_basic_blocks (first, max_reg_num (), file, 0);
! blocks = sbitmap_alloc (n_basic_blocks);
! sbitmap_ones (blocks);
! count_or_remove_death_notes (blocks, 1);
! sbitmap_free (blocks);
! life_analysis (first, max_reg_num (), file, 0);
/* Set up block info for each basic block. */
bi = (block_info) alloca ((n_basic_blocks + 1) * sizeof (*bi));
--- 429,447 ----
if (i > LAST_STACK_REG)
return;
! /* Ok, floating point instructions exist. If not optimizing,
! build the CFG and run life analysis. */
! if (! optimize)
! {
! find_basic_blocks (first, max_reg_num (), file, 0);
! blocks = sbitmap_alloc (n_basic_blocks);
! sbitmap_ones (blocks);
! count_or_remove_death_notes (blocks, 1);
! sbitmap_free (blocks);
! life_analysis (first, max_reg_num (), file, 0);
! }
/* Set up block info for each basic block. */
bi = (block_info) alloca ((n_basic_blocks + 1) * sizeof (*bi));
*************** reg_to_stack (first, file)
*** 488,496 ****
{
jump_optimize (first, JUMP_CROSS_JUMP_DEATH_MATTERS,
!JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN);
-
- /* This has the effect of resetting label alignments around loops. */
- shorten_branches (get_insns ());
}
VARRAY_FREE (stack_regs_mentioned_data);
--- 490,495 ----
Index: resource.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/resource.c,v
retrieving revision 1.16
diff -c -p -d -r1.16 resource.c
*** resource.c 1999/10/27 03:44:08 1.16
--- resource.c 1999/10/27 04:57:11
*************** mark_target_live_regs (insns, target, re
*** 831,837 ****
b = tinfo->block;
}
! if (b == -1)
b = BLOCK_NUM (target);
if (target_hash_table != NULL)
--- 831,838 ----
b = tinfo->block;
}
! if (b == -1
! && INSN_UID (target) < (int) VARRAY_SIZE (basic_block_for_insn))
b = BLOCK_NUM (target);
if (target_hash_table != NULL)
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.245
diff -c -p -d -r1.245 toplev.c
*** toplev.c 1999/10/27 03:24:38 1.245
--- toplev.c 1999/10/27 04:57:11
*************** rest_of_compilation (decl)
*** 4333,4344 ****
ggc_collect ();
#endif
- /* Shorten branches. */
- TIMEVAR (shorten_branch_time,
- {
- shorten_branches (get_insns ());
- });
-
#ifdef STACK_REGS
if (stack_reg_dump)
open_dump_file (".20.stack", decl_printable_name (decl, 2));
--- 4333,4338 ----
*************** rest_of_compilation (decl)
*** 4355,4360 ****
--- 4349,4360 ----
if (ggc_p)
ggc_collect ();
#endif
+
+ /* Shorten branches. */
+ TIMEVAR (shorten_branch_time,
+ {
+ shorten_branches (get_insns ());
+ });
/* Now turn the rtl into assembler code. */
More information about the Gcc-patches
mailing list