From 3071fab5054b156e506212b86c62d614bd10e284 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 29 Oct 1999 14:45:05 -0700 Subject: [PATCH] flow.c (count_or_remove_death_notes): Equate NULL with the universal set. * flow.c (count_or_remove_death_notes): Equate NULL with the universal set. * jump.c, reg-stack.c, toplev.c: Revert Oct 27 change. * toplev.c (rest_of_compilation): Rebuild CFG immediately before dbr_schedule. * i386.c (pic_label_no): Delete. (ix86_attr_length_default): Don't use single_set to peek inside a parallel. * recog.c (peephole2_optimize): Allow recog_next_insn to index the first insn after bb->end. * i386.md (push mem peeps): Scratch is live after evaluation of the memory. (cmp mem peep): Similarly. From-SVN: r30269 --- gcc/ChangeLog | 19 +++++++++++++++++++ gcc/config/i386/i386.c | 22 ++++++++++++++++++---- gcc/config/i386/i386.md | 24 ++++++++++++------------ gcc/flow.c | 5 +++-- gcc/jump.c | 23 ----------------------- gcc/recog.c | 4 ++-- gcc/toplev.c | 23 ++++++++++++++++------- 7 files changed, 70 insertions(+), 50 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 059f3e4a516..37642fcfab5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +Fri Oct 29 14:34:17 1999 Richard Henderson + + * flow.c (count_or_remove_death_notes): Equate NULL with the + universal set. + + * jump.c, reg-stack.c, toplev.c: Revert Oct 27 change. + * toplev.c (rest_of_compilation): Rebuild CFG immediately before + dbr_schedule. + + * i386.c (pic_label_no): Delete. + (ix86_attr_length_default): Don't use single_set to peek + inside a parallel. + + * recog.c (peephole2_optimize): Allow recog_next_insn to index + the first insn after bb->end. + * i386.md (push mem peeps): Scratch is live after evaluation + of the memory. + (cmp mem peep): Similarly. + Fri Oct 29 11:50:11 1999 Catherine Moore * calls.c (emit_library_call_value): Fix declaration of alignment_pad. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index a1ac359d71e..43bc4eebc39 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -178,8 +178,6 @@ struct machine_function rtx stack_locals[(int) MAX_MACHINE_MODE][MAX_386_STACK_LOCALS]; }; -static int pic_label_no = 0; - #define ix86_stack_locals (current_function->machine->stack_locals) /* which cpu are we scheduling for */ @@ -5180,8 +5178,24 @@ ix86_attr_length_default (insn) break; case TYPE_LEA: - len += memory_address_length (SET_SRC (single_set (insn))); - goto just_opcode; + { + /* Irritatingly, single_set doesn't work with REG_UNUSED present, + as we'll get from running life_analysis during reg-stack when + not optimizing. */ + rtx set = PATTERN (insn); + if (GET_CODE (set) == SET) + ; + else if (GET_CODE (set) == PARALLEL + && XVECLEN (set, 0) == 2 + && GET_CODE (XVECEXP (set, 0, 0)) == SET + && GET_CODE (XVECEXP (set, 0, 1)) == CLOBBER) + set = XVECEXP (set, 0, 0); + else + abort (); + + len += memory_address_length (SET_SRC (set)); + goto just_opcode; + } case TYPE_OTHER: case TYPE_MULTI: diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 4641b06b05e..73a9e98ee5a 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -7731,27 +7731,27 @@ ;; Don't push memory operands (define_peephole2 - [(match_scratch:SI 2 "r") - (set (match_operand:SI 0 "push_operand" "") - (match_operand:SI 1 "memory_operand" ""))] + [(set (match_operand:SI 0 "push_operand" "") + (match_operand:SI 1 "memory_operand" "")) + (match_scratch:SI 2 "r")] "! optimize_size && ! TARGET_PUSH_MEMORY" [(set (match_dup 2) (match_dup 1)) (set (match_dup 0) (match_dup 2))] "") (define_peephole2 - [(match_scratch:HI 2 "r") - (set (match_operand:HI 0 "push_operand" "") - (match_operand:HI 1 "memory_operand" ""))] + [(set (match_operand:HI 0 "push_operand" "") + (match_operand:HI 1 "memory_operand" "")) + (match_scratch:HI 2 "r")] "! optimize_size && ! TARGET_PUSH_MEMORY" [(set (match_dup 2) (match_dup 1)) (set (match_dup 0) (match_dup 2))] "") (define_peephole2 - [(match_scratch:QI 2 "q") - (set (match_operand:QI 0 "push_operand" "") - (match_operand:QI 1 "memory_operand" ""))] + [(set (match_operand:QI 0 "push_operand" "") + (match_operand:QI 1 "memory_operand" "")) + (match_scratch:QI 2 "q")] "! optimize_size && ! TARGET_PUSH_MEMORY" [(set (match_dup 2) (match_dup 1)) (set (match_dup 0) (match_dup 2))] @@ -7827,10 +7827,10 @@ ;; Don't compare memory with zero, load and use a test instead. (define_peephole2 - [(match_scratch:SI 3 "r") - (set (reg:CCNO 17) + [(set (reg:CCNO 17) (compare:CCNO (match_operand:SI 0 "memory_operand" "") - (const_int 0)))] + (const_int 0))) + (match_scratch:SI 3 "r")] "! optimize_size" [(set (match_dup 3) (match_dup 0)) (set (reg:CCNO 17) (compare:CCNO (match_dup 3) (const_int 0)))] diff --git a/gcc/flow.c b/gcc/flow.c index 2dee6f97f87..19d50b0870d 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -5748,7 +5748,8 @@ recompute_reg_usage (f, loop_step) } /* Optionally removes all the REG_DEAD and REG_UNUSED notes from a set of - blocks. Returns a count of the number of registers that died. */ + blocks. If BLOCKS is NULL, assume the universal set. Returns a count + of the number of registers that died. */ int count_or_remove_death_notes (blocks, kill) @@ -5762,7 +5763,7 @@ count_or_remove_death_notes (blocks, kill) basic_block bb; rtx insn; - if (! TEST_BIT (blocks, i)) + if (blocks && ! TEST_BIT (blocks, i)) continue; bb = BASIC_BLOCK (i); diff --git a/gcc/jump.c b/gcc/jump.c index 8170930780b..72a13589af0 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -66,8 +66,6 @@ Boston, MA 02111-1307, USA. */ #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 @@ -192,7 +190,6 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) 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; @@ -2130,7 +2127,6 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) if (newjpos != 0) { - did_cross_jump = 1; do_cross_jump (insn, newjpos, newlpos); /* Make the old conditional jump into an unconditional one. */ @@ -2183,7 +2179,6 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) if (newjpos != 0) { - did_cross_jump = 1; do_cross_jump (insn, newjpos, newlpos); changed = 1; next = insn; @@ -2215,7 +2210,6 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) if (newjpos != 0) { - did_cross_jump = 1; do_cross_jump (insn, newjpos, newlpos); changed = 1; next = insn; @@ -2280,23 +2274,6 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only) /* 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 diff --git a/gcc/recog.c b/gcc/recog.c index b7d8e71ef3e..1246ca8ef78 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -2730,7 +2730,7 @@ peephole2_optimize (dump_file) care about subsequent life info; recog_last_allowed_insn to restrict how far forward we will allow the match to proceed. */ - recog_last_allowed_insn = bb->end; + recog_last_allowed_insn = NEXT_INSN (bb->end); for (insn = bb->end; ; insn = prev) { prev = PREV_INSN (insn); @@ -2749,7 +2749,7 @@ peephole2_optimize (dump_file) if (insn == bb->head) bb->head = NEXT_INSN (prev); - recog_last_allowed_insn = prev; + recog_last_allowed_insn = NEXT_INSN (prev); SET_BIT (blocks, i); changed = 1; } diff --git a/gcc/toplev.c b/gcc/toplev.c index 1933b41b41b..6f8883bbbbe 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -4319,7 +4319,16 @@ rest_of_compilation (decl) if (dbr_sched_dump) open_dump_file (".19.dbr", decl_printable_name (decl, 2)); - TIMEVAR (dbr_sched_time, dbr_schedule (insns, rtl_dump_file)); + TIMEVAR + (dbr_sched_time, + { + /* ??? Keep the CFG up to date after cross-jumping. */ + find_basic_blocks (insns, max_reg_num (), rtl_dump_file, 1); + count_or_remove_death_notes (NULL, 1); + life_analysis (insns, max_reg_num (), rtl_dump_file, 1); + + dbr_schedule (insns, rtl_dump_file); + }); if (dbr_sched_dump) { @@ -4333,6 +4342,12 @@ rest_of_compilation (decl) 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)); @@ -4350,12 +4365,6 @@ rest_of_compilation (decl) ggc_collect (); #endif - /* Shorten branches. */ - TIMEVAR (shorten_branch_time, - { - shorten_branches (get_insns ()); - }); - /* Now turn the rtl into assembler code. */ TIMEVAR (final_time,