From 1540f9ebc44746587921098f337cfac4916aa285 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 30 Mar 2002 14:26:19 +0100 Subject: [PATCH] local-alloc.c (local_alloc): Avoid call of update_equiv_regs when not optimizing. * local-alloc.c (local_alloc): Avoid call of update_equiv_regs when not optimizing. * toplev.c (rest_of_compilation): Cann mark_constant_function only when optimizing. * flow.c (calculate_global_regs_live): Ensure that all AUX fields are NULL. * cfgcleanup.c (bb_flags): Add BB_NONTHREADABLE_BLOCK. (thread_jump): Set BB_NONTHREADABLE_BLOCK, check it. (try_optimize_cfg): clear all AUX fields. * i386.c (aligned_operand): Be prepared for SUBREGed registers. (ix86_decompose_address): Use REG_P instead of GET_CODE (...) == REG. (ix86_address_cost): Be prepared for SUBREGed registers. (legitimate_address_p): Accept SUBREGed registers. From-SVN: r51604 --- gcc/ChangeLog | 18 ++++++++++++++++++ gcc/cfgcleanup.c | 33 +++++++++++++++++++++++++-------- gcc/config/i386/i386.c | 36 +++++++++++++++++++++++++++++------- gcc/flow.c | 10 ++++++++++ gcc/local-alloc.c | 3 ++- gcc/toplev.c | 3 ++- 6 files changed, 86 insertions(+), 17 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 288d75bc3f2..a320e7a90fe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +Sat Mar 30 14:08:55 CET 2002 Jan Hubicka + + * local-alloc.c (local_alloc): Avoid call of update_equiv_regs when not optimizing. + + * toplev.c (rest_of_compilation): Cann mark_constant_function + only when optimizing. + + * flow.c (calculate_global_regs_live): Ensure that all AUX fields are NULL. + + * cfgcleanup.c (bb_flags): Add BB_NONTHREADABLE_BLOCK. + (thread_jump): Set BB_NONTHREADABLE_BLOCK, check it. + (try_optimize_cfg): clear all AUX fields. + + * i386.c (aligned_operand): Be prepared for SUBREGed registers. + (ix86_decompose_address): Use REG_P instead of GET_CODE (...) == REG. + (ix86_address_cost): Be prepared for SUBREGed registers. + (legitimate_address_p): Accept SUBREGed registers. + 2002-03-29 Richard Henderson PR target/5672 diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index f31f168f7b5..b6a7f0cc4ea 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -54,7 +54,8 @@ enum bb_flags { /* Set if BB is the forwarder block to avoid too many forwarder_block_p calls. */ - BB_FORWARDER_BLOCK = 1 + BB_FORWARDER_BLOCK = 1, + BB_NONTHREADABLE_BLOCK = 2 }; #define BB_FLAGS(BB) (enum bb_flags) (BB)->aux @@ -279,17 +280,28 @@ thread_jump (mode, e, b) regset nonequal; bool failed = false; + if (BB_FLAGS (b) & BB_NONTHREADABLE_BLOCK) + return NULL; + /* At the moment, we do handle only conditional jumps, but later we may want to extend this code to tablejumps and others. */ if (!e->src->succ->succ_next || e->src->succ->succ_next->succ_next) return NULL; if (!b->succ || !b->succ->succ_next || b->succ->succ_next->succ_next) - return NULL; + { + BB_SET_FLAG (b, BB_NONTHREADABLE_BLOCK); + return NULL; + } /* Second branch must end with onlyjump, as we will eliminate the jump. */ - if (!any_condjump_p (e->src->end) || !any_condjump_p (b->end) - || !onlyjump_p (b->end)) + if (!any_condjump_p (e->src->end)) return NULL; + + if (!any_condjump_p (b->end) || !onlyjump_p (b->end)) + { + BB_SET_FLAG (b, BB_NONTHREADABLE_BLOCK); + return NULL; + } set1 = pc_set (e->src->end); set2 = pc_set (b->end); @@ -324,7 +336,10 @@ thread_jump (mode, e, b) for (insn = NEXT_INSN (b->head); insn != NEXT_INSN (b->end); insn = NEXT_INSN (insn)) if (INSN_P (insn) && side_effects_p (PATTERN (insn))) - return NULL; + { + BB_SET_FLAG (b, BB_NONTHREADABLE_BLOCK); + return NULL; + } cselib_init (); @@ -363,7 +378,10 @@ thread_jump (mode, e, b) /* Later we should clear nonequal of dead registers. So far we don't have life information in cfg_cleanup. */ if (failed) - goto failed_exit; + { + BB_SET_FLAG (b, BB_NONTHREADABLE_BLOCK); + goto failed_exit; + } /* cond2 must not mention any register that is not equal to the former block. */ @@ -1723,8 +1741,7 @@ try_optimize_cfg (mode) if (mode & CLEANUP_CROSSJUMP) remove_fake_edges (); - for (i = 0; i < n_basic_blocks; i++) - BASIC_BLOCK (i)->aux = NULL; + clear_aux_for_blocks (); return changed_overall; } diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 8e9df35a9d6..f36495eeae5 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -3467,6 +3467,11 @@ aligned_operand (op, mode) if (! ix86_decompose_address (op, &parts)) abort (); + if (parts.base && GET_CODE (parts.base) == SUBREG) + parts.base = SUBREG_REG (parts.base); + if (parts.index && GET_CODE (parts.index) == SUBREG) + parts.index = SUBREG_REG (parts.index); + /* Look for some component that isn't known to be aligned. */ if (parts.index) { @@ -4404,7 +4409,7 @@ ix86_decompose_address (addr, out) rtx scale_rtx = NULL_RTX; int retval = 1; - if (GET_CODE (addr) == REG || GET_CODE (addr) == SUBREG) + if (REG_P (addr) || GET_CODE (addr) == SUBREG) base = addr; else if (GET_CODE (addr) == PLUS) { @@ -4531,6 +4536,11 @@ ix86_address_cost (x) if (!ix86_decompose_address (x, &parts)) abort (); + if (parts.base && GET_CODE (parts.base) == SUBREG) + parts.base = SUBREG_REG (parts.base); + if (parts.index && GET_CODE (parts.index) == SUBREG) + parts.index = SUBREG_REG (parts.index); + /* More complex memory references are better. */ if (parts.disp && parts.disp != const0_rtx) cost--; @@ -4745,9 +4755,15 @@ legitimate_address_p (mode, addr, strict) if (base) { + rtx reg; reason_rtx = base; - if (GET_CODE (base) != REG) + if (GET_CODE (base) == SUBREG) + reg = SUBREG_REG (base); + else + reg = base; + + if (GET_CODE (reg) != REG) { reason = "base is not a register"; goto report_error; @@ -4759,8 +4775,8 @@ legitimate_address_p (mode, addr, strict) goto report_error; } - if ((strict && ! REG_OK_FOR_BASE_STRICT_P (base)) - || (! strict && ! REG_OK_FOR_BASE_NONSTRICT_P (base))) + if ((strict && ! REG_OK_FOR_BASE_STRICT_P (reg)) + || (! strict && ! REG_OK_FOR_BASE_NONSTRICT_P (reg))) { reason = "base is not valid"; goto report_error; @@ -4775,9 +4791,15 @@ legitimate_address_p (mode, addr, strict) if (index) { + rtx reg; reason_rtx = index; - if (GET_CODE (index) != REG) + if (GET_CODE (index) == SUBREG) + reg = SUBREG_REG (index); + else + reg = index; + + if (GET_CODE (reg) != REG) { reason = "index is not a register"; goto report_error; @@ -4789,8 +4811,8 @@ legitimate_address_p (mode, addr, strict) goto report_error; } - if ((strict && ! REG_OK_FOR_INDEX_STRICT_P (index)) - || (! strict && ! REG_OK_FOR_INDEX_NONSTRICT_P (index))) + if ((strict && ! REG_OK_FOR_INDEX_STRICT_P (reg)) + || (! strict && ! REG_OK_FOR_INDEX_NONSTRICT_P (reg))) { reason = "index is not valid"; goto report_error; diff --git a/gcc/flow.c b/gcc/flow.c index 61008e630e0..332d5434f68 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -1071,6 +1071,16 @@ calculate_global_regs_live (blocks_in, blocks_out, flags) regset_head new_live_at_end_head; int i; + /* Some passes used to forget clear aux field of basic block causing + sick behaviour here. */ +#ifdef ENABLE_CHECKING + if (ENTRY_BLOCK_PTR->aux || EXIT_BLOCK_PTR->aux) + abort (); + for (i = 0; i < n_basic_blocks; i++) + if (BASIC_BLOCK (i)->aux) + abort (); +#endif + tmp = INITIALIZE_REG_SET (tmp_head); new_live_at_end = INITIALIZE_REG_SET (new_live_at_end_head); call_used = INITIALIZE_REG_SET (call_used_head); diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c index c44f3686bb8..4da7eac849a 100644 --- a/gcc/local-alloc.c +++ b/gcc/local-alloc.c @@ -352,7 +352,8 @@ local_alloc () /* Promote REG_EQUAL notes to REG_EQUIV notes and adjust status of affected registers. */ - update_equiv_regs (); + if (optimize) + update_equiv_regs (); /* This sets the maximum number of quantities we can have. Quantity numbers start at zero and we can have one for each pseudo. */ diff --git a/gcc/toplev.c b/gcc/toplev.c index 86d4d607623..1baf772452b 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2856,7 +2856,8 @@ rest_of_compilation (decl) life_analyzis rarely eliminates modification of external memory. */ - mark_constant_function (); + if (optimize) + mark_constant_function (); close_dump_file (DFI_cfg, print_rtl_with_bb, insns); -- 2.30.2