From 99a5b5de1381bebb00613232dfc1511e5c745d38 Mon Sep 17 00:00:00 2001 From: rth Date: Wed, 6 Oct 1999 17:22:54 +0000 Subject: [PATCH] * genconfig.c (main): Disable HAVE_conditional_arithmetic. * jump.c (jump_optimize_1): Document why. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29841 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/genconfig.c | 3 +++ gcc/jump.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2bba07c..67ad315 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Wed Oct 6 10:21:15 1999 Richard Henderson + + * genconfig.c (main): Disable HAVE_conditional_arithmetic. + * jump.c (jump_optimize_1): Document why. + Wed Oct 6 10:41:56 1999 Kaveh R. Ghazi * collect2.c (scan_prog_file, scan_libraries): Prototype function diff --git a/gcc/genconfig.c b/gcc/genconfig.c index 23bffea..bd31d73 100644 --- a/gcc/genconfig.c +++ b/gcc/genconfig.c @@ -348,8 +348,11 @@ from the machine description file `md'. */\n\n"); if (have_cmove_flag) printf ("#define HAVE_conditional_move\n"); +#if 0 + /* Disabled. See the discussion in jump.c. */ if (have_cond_arith_flag) printf ("#define HAVE_conditional_arithmetic\n"); +#endif if (have_lo_sum_flag) printf ("#define HAVE_lo_sum\n"); diff --git a/gcc/jump.c b/gcc/jump.c index dcd1a6a..f6e973e 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -943,6 +943,37 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) #endif /* HAVE_cc0 */ #ifdef HAVE_conditional_arithmetic + /* ??? This is disabled in genconfig, as this simple-minded + transformation can incredibly lengthen register lifetimes. + + Consider this example from cexp.c's yyparse: + + 234 (set (pc) + (if_then_else (ne (reg:DI 149) (const_int 0 [0x0])) + (label_ref 248) (pc))) + 237 (set (reg/i:DI 0 $0) (const_int 1 [0x1])) + 239 (set (pc) (label_ref 2382)) + 248 (code_label ("yybackup")) + + This will be transformed to: + + 237 (set (reg/i:DI 0 $0) + (if_then_else:DI (eq (reg:DI 149) (const_int 0 [0x0])) + (const_int 1 [0x1]) (reg/i:DI 0 $0))) + 239 (set (pc) + (if_then_else (eq (reg:DI 149) (const_int 0 [0x0])) + (label_ref 2382) (pc))) + + which, from this narrow viewpoint looks fine. Except that + between this and 3 other ocurrences of the same pattern, $0 + is now live for basically the entire function, and we'll + get an abort in caller_save. + + Any replacement for this code should recall that a set of + a register that is not live need not, and indeed should not, + be conditionalized. Either that, or delay the transformation + until after register allocation. */ + /* See if this is a conditional jump around a small number of instructions that we can conditionalize. Don't do this before the initial CSE pass or after reload. -- 2.7.4