diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 942d733ed53..ff5d6f53a93 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2009-01-06 Richard Sandiford + + * function.h (rtl_data): Add a dbr_scheduled_p field. + * reorg.c (dbr_schedule): Set it. + (gate_handle_delay_slots): Check it. + * config/mips/mips.c (mips_base_delayed_branch): Delete. + (mips_reorg): Check flag_delayed_branch instead of + mips_base_delayed_branch. + (mips_override_options): Don't set mips_base_delayed_branch + or flag_delayed_branch. + 2009-01-06 Richard Sandiford PR rtl-optimization/38426. diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 290caa67691..55b1c22be66 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -453,7 +453,6 @@ static int mips_base_target_flags; bool mips_base_mips16; /* The ambient values of other global variables. */ -static int mips_base_delayed_branch; /* flag_delayed_branch */ static int mips_base_schedule_insns; /* flag_schedule_insns */ static int mips_base_reorder_blocks_and_partition; /* flag_reorder... */ static int mips_base_move_loop_invariants; /* flag_move_loop_invariants */ @@ -13297,7 +13296,7 @@ mips_reorg (void) mips16_lay_out_constants (); if (mips_r10k_cache_barrier != R10K_CACHE_BARRIER_NONE) r10k_insert_cache_barriers (); - if (mips_base_delayed_branch) + if (flag_delayed_branch) dbr_schedule (get_insns ()); mips_reorg_process_insns (); if (!TARGET_MIPS16 @@ -14058,7 +14057,6 @@ mips_override_options (void) /* Save base state of options. */ mips_base_target_flags = target_flags; - mips_base_delayed_branch = flag_delayed_branch; mips_base_schedule_insns = flag_schedule_insns; mips_base_reorder_blocks_and_partition = flag_reorder_blocks_and_partition; mips_base_move_loop_invariants = flag_move_loop_invariants; @@ -14071,9 +14069,6 @@ mips_override_options (void) Do all CPP-sensitive stuff in non-MIPS16 mode; we'll switch to MIPS16 mode afterwards if need be. */ mips_set_mips16_mode (false); - - /* We call dbr_schedule from within mips_reorg. */ - flag_delayed_branch = 0; } /* Swap the register information for registers I and I + 1, which diff --git a/gcc/function.h b/gcc/function.h index 68df55e1a6e..f78d737b05f 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -444,6 +444,9 @@ struct rtl_data GTY(()) /* Nonzero if function stack realignment has been finalized, namely stack_realign_needed flag has been set and finalized after reload. */ bool stack_realign_finalized; + + /* True if dbr_schedule has already been called for this function. */ + bool dbr_scheduled_p; }; #define return_label (crtl->x_return_label) diff --git a/gcc/reorg.c b/gcc/reorg.c index 97570e858dd..fd6a58e02eb 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -4038,6 +4038,7 @@ dbr_schedule (rtx first) } #endif + crtl->dbr_scheduled_p = true; } #endif /* DELAY_SLOTS */ @@ -4045,7 +4046,7 @@ static bool gate_handle_delay_slots (void) { #ifdef DELAY_SLOTS - return flag_delayed_branch; + return flag_delayed_branch && !crtl->dbr_scheduled_p; #else return 0; #endif