diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 90a3e6b7956..f8075c596fa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2010-07-12 Richard Sandiford + + * Makefile.in (bb-reorder.o, target-globals.o): Depend on bb-reorder.h + * bb-reorder.h: New file. + * bb-reorder.c (default_target_bb_reorder): New variable. + (this_target_bb_reorder): New conditional variable. + (uncond_jump_length): Redefine as a macro. + * target-globals.h (this_target_bb_reorder): Declare. + (target_globals): Add a bb_reorder field. + (restore_target_globals): Copy the bb_reorder field to + this_target_bb-reorder. + * target-globals.c: Include bb-reorder.h. + (default_target_globals): Initialize the bb_reorder field. + (save_target_globals): Likewise. + 2010-07-12 Richard Sandiford * Makefile.in (gcse.o, target-globals.o): Depend on gcse.h.. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index c093623eaf8..c6f199f95be 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -3434,7 +3434,8 @@ lists.o: lists.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TOPLEV_H) $(DIAGN bb-reorder.o : bb-reorder.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(FLAGS_H) $(TIMEVAR_H) output.h $(CFGLAYOUT_H) $(FIBHEAP_H) \ $(TARGET_H) $(FUNCTION_H) $(TM_P_H) $(OBSTACK_H) $(EXPR_H) $(REGS_H) \ - $(PARAMS_H) $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(TREE_PASS_H) $(DF_H) + $(PARAMS_H) $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(TREE_PASS_H) $(DF_H) \ + bb-reorder.h tracer.o : tracer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TREE_H) $(BASIC_BLOCK_H) hard-reg-set.h output.h $(CFGLAYOUT_H) \ $(FLAGS_H) $(TIMEVAR_H) $(PARAMS_H) $(COVERAGE_H) $(FIBHEAP_H) \ @@ -3483,7 +3484,7 @@ lower-subreg.o : lower-subreg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ target-globals.o : target-globals.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) insn-config.h $(MACHMODE_H) $(GGC_H) $(TOPLEV_H) target-globals.h \ $(FLAGS_H) $(REGS_H) $(RTL_H) reload.h expmed.h $(EXPR_H) $(OPTABS_H) \ - $(LIBFUNCS_H) $(CFGLOOP_H) $(IRA_INT_H) builtins.h gcse.h + $(LIBFUNCS_H) $(CFGLOOP_H) $(IRA_INT_H) builtins.h gcse.h bb-reorder.h $(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) \ $(RTL_H) $(REGS_H) hard-reg-set.h insn-config.h conditions.h \ diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c index cf282d222a6..2bf0b853165 100644 --- a/gcc/bb-reorder.c +++ b/gcc/bb-reorder.c @@ -86,6 +86,7 @@ #include "toplev.h" /* user_defined_section_attribute */ #include "tree-pass.h" #include "df.h" +#include "bb-reorder.h" /* The number of rounds. In most cases there will only be 4 rounds, but when partitioning hot and cold basic blocks into separate sections of @@ -101,6 +102,14 @@ #endif +struct target_bb_reorder default_target_bb_reorder; +#if SWITCHABLE_TARGET +struct target_bb_reorder *this_target_bb_reorder = &default_target_bb_reorder; +#endif + +#define uncond_jump_length \ + (this_target_bb_reorder->x_uncond_jump_length) + /* Branch thresholds in thousandths (per mille) of the REG_BR_PROB_BASE. */ static int branch_threshold[N_ROUNDS] = {400, 200, 100, 0, 0}; @@ -111,9 +120,6 @@ static int exec_threshold[N_ROUNDS] = {500, 200, 50, 0, 0}; block the edge destination is not duplicated while connecting traces. */ #define DUPLICATION_THRESHOLD 100 -/* Length of unconditional jump instruction. */ -static int uncond_jump_length; - /* Structure to hold needed information for each basic block. */ typedef struct bbro_basic_block_data_def { diff --git a/gcc/bb-reorder.h b/gcc/bb-reorder.h new file mode 100644 index 00000000000..0b5ed254826 --- /dev/null +++ b/gcc/bb-reorder.h @@ -0,0 +1,37 @@ +/* Basic block reordering routines for the GNU compiler. + Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 + Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_BB_REORDER +#define GCC_BB_REORDER + +/* Target-specific globals. */ +struct target_bb_reorder { + /* Length of unconditional jump instruction. */ + int x_uncond_jump_length; +}; + +extern GTY(()) struct target_bb_reorder default_target_bb_reorder; +#if SWITCHABLE_TARGET +extern struct target_bb_reorder *this_target_bb_reorder; +#else +#define this_target_bb_reorder (&default_target_bb_reorder) +#endif + +#endif diff --git a/gcc/target-globals.c b/gcc/target-globals.c index 02aa5d873c1..49b9dc85457 100644 --- a/gcc/target-globals.c +++ b/gcc/target-globals.c @@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see #include "ira-int.h" #include "builtins.h" #include "gcse.h" +#include "bb-reorder.h" #if SWITCHABLE_TARGET struct target_globals default_target_globals = { @@ -54,7 +55,8 @@ struct target_globals default_target_globals = { &default_target_ira, &default_target_ira_int, &default_target_builtins, - &default_target_gcse + &default_target_gcse, + &default_target_bb_reorder }; struct target_globals * @@ -76,6 +78,7 @@ save_target_globals (void) g->ira_int = XCNEW (struct target_ira_int); g->builtins = XCNEW (struct target_builtins); g->gcse = XCNEW (struct target_gcse); + g->bb_reorder = XCNEW (struct target_bb_reorder); restore_target_globals (g); target_reinit (); return g; diff --git a/gcc/target-globals.h b/gcc/target-globals.h index cdad7085e9a..166f21ada4f 100644 --- a/gcc/target-globals.h +++ b/gcc/target-globals.h @@ -34,6 +34,7 @@ extern struct target_ira *this_target_ira; extern struct target_ira_int *this_target_ira_int; extern struct target_builtins *this_target_builtins; extern struct target_gcse *this_target_gcse; +extern struct target_bb_reorder *this_target_bb_reorder; struct GTY(()) target_globals { struct target_flag_state *GTY((skip)) flag_state; @@ -49,6 +50,7 @@ struct GTY(()) target_globals { struct target_ira_int *GTY((skip)) ira_int; struct target_builtins *GTY((skip)) builtins; struct target_gcse *GTY((skip)) gcse; + struct target_bb_reorder *GTY((skip)) bb_reorder; }; extern struct target_globals default_target_globals; @@ -71,6 +73,7 @@ restore_target_globals (struct target_globals *g) this_target_ira_int = g->ira_int; this_target_builtins = g->builtins; this_target_gcse = g->gcse; + this_target_bb_reorder = g->bb_reorder; } #endif