aboutsummaryrefslogtreecommitdiff
path: root/gcc/sched-int.h
diff options
context:
space:
mode:
authorVladimir Makarov <vmakarov@redhat.com>2009-09-02 18:54:25 +0000
committerVladimir Makarov <vmakarov@gcc.gnu.org>2009-09-02 18:54:25 +0000
commitce18efcb54ff5d3de8b035aa2cd34db4715b8bfd (patch)
tree4fff239f690be40be173f6b04a6883338c271d49 /gcc/sched-int.h
parentf8563a3ba77cb002cf22d1c74715340a96fb404e (diff)
downloadgcc-ce18efcb54ff5d3de8b035aa2cd34db4715b8bfd.zip
gcc-ce18efcb54ff5d3de8b035aa2cd34db4715b8bfd.tar.gz
gcc-ce18efcb54ff5d3de8b035aa2cd34db4715b8bfd.tar.bz2
invoke.texi (-fsched-pressure): Document it.
2009-09-02 Vladimir Makarov <vmakarov@redhat.com> * doc/invoke.texi (-fsched-pressure): Document it. (-fsched-reg-pressure-heuristic): Remove it. * reload.c (ira.h): Include. (find_reloads): Add choosing reload on number of small spilled classes. * haifa-sched.c (ira.h): Include. (sched_pressure_p, sched_regno_cover_class, curr_reg_pressure, saved_reg_pressure, curr_reg_live, saved_reg_live, region_ref_regs): New variables. (sched_init_region_reg_pressure_info, mark_regno_birth_or_death, initiate_reg_pressure_info, setup_ref_regs, initiate_bb_reg_pressure_info, save_reg_pressure, restore_reg_pressure, dying_use_p, print_curr_reg_pressure): New functions. (setup_insn_reg_pressure_info): New function. (rank_for_schedule): Add pressure checking and insn issue time. Remove comparison of insn reg weights. (ready_sort): Set insn reg pressure info. (update_register_pressure, setup_insn_max_reg_pressure, update_reg_and_insn_max_reg_pressure, sched_setup_bb_reg_pressure_info): New functions. (schedule_insn): Add code for printing and updating reg pressure info. (find_set_reg_weight, find_insn_reg_weight): Remove. (ok_for_early_queue_removal): Do nothing if pressure_only_p. (debug_ready_list): Print reg pressure info. (schedule_block): Ditto. Check insn issue time. (sched_init): Set up sched_pressure_p. Allocate and set up some reg pressure related info. (sched_finish): Free some reg pressure related info. (fix_tick_ready): Make insn always ready if pressure_p. (init_h_i_d): Don't call find_insn_reg_weight. (haifa_finish_h_i_d): Free insn reg pressure info. * ira-int.h (ira_hard_regno_cover_class, ira_reg_class_nregs, ira_memory_move_cost, ira_class_hard_regs, ira_class_hard_regs_num, ira_no_alloc_regs, ira_available_class_regs, ira_reg_class_cover_size, ira_reg_class_cover, ira_class_translate): Move to ira.h. * ira-lives.c (single_reg_class): Check mode to find how many registers are necessary for operand. (ira_implicitly_set_insn_hard_regs): New. * common.opt (fsched-pressure): New options. (fsched-reg-pressure-heuristic): Remove. * ira.c (setup_eliminable_regset): Rename to ira_setup_eliminable_regset. Make it external. (expand_reg_info): Pass cover class to setup_reg_classes. (ira): Call resize_reg_info instead of allocate_reg_info. * sched-deps.c: Include ira.h. (implicit_reg_pending_clobbers, implicit_reg_pending_uses): New. (create_insn_reg_use, create_insn_reg_set, setup_insn_reg_uses, reg_pressure_info, insn_use_p, mark_insn_pseudo_birth, mark_insn_hard_regno_birth, mark_insn_reg_birth, mark_pseudo_death, mark_hard_regno_death, mark_reg_death, mark_insn_reg_store, mark_insn_reg_clobber, setup_insn_reg_pressure_info): New. (sched_analyze_1): Update implicit_reg_pending_uses. (sched_analyze_insn): Find implicit sets, uses, clobbers of regs. Use them to create dependencies. Set insn reg uses and pressure info. Process reg_pending_uses in one place. (free_deps): Free implicit sets. (remove_from_deps): Remove implicit sets if necessary. Check implicit sets when clearing reg_last_in_use. (init_deps_global): Clear implicit_reg_pending_clobbers and implicit_reg_pending_uses. * ira.h (ira_hard_regno_cover_class, ira_reg_class_nregs, ira_memory_move_cost, ira_class_hard_regs, ira_class_hard_regs_num, ira_no_alloc_regs, ira_available_class_regs, ira_reg_class_cover_size, ira_reg_class_cover, ira_class_translate): Move from ira-int.h. (ira_setup_eliminable_regset, ira_set_pseudo_classes, ira_implicitly_set_insn_hard_regs): New prototypes. * ira-costs.c (pseudo_classes_defined_p, allocno_p, cost_elements_num): New variables. (allocno_costs, total_costs): Rename to costs and total_allocno_costs. (COSTS_OF_ALLOCNO): Rename to COSTS. (allocno_pref): Rename to pref. (allocno_pref_buffer): Rename to pref_buffer. (common_classes): Rename to regno_cover_class. (COST_INDEX): New. (record_reg_classes): Set allocno attributes only if allocno_p. (record_address_regs): Ditto. Use COST_INDEX instead of ALLOCNO_NUM. (scan_one_insn): Use COST_INDEX and COSTS instead of ALLOCNO_NUM and COSTS_OF_ALLOCNO. (print_costs): Rename to print_allocno_costs. (print_pseudo_costs): New. (process_bb_node_for_costs): Split into 2 functions with new function process_bb_for_costs. Pass BB to process_bb_for_costs. (find_allocno_class_costs): Rename to find_costs_and_classes. Add new parameter dump_file. Use cost_elements_num instead of ira_allocnos_num. Make one iteration if preferred classes were already calculated for scheduler. Make 2 versions of code depending on allocno_p. (setup_allocno_cover_class_and_costs): Check allocno_p. Use regno_cover_class and COSTS instead of common_classes and COSTS_OF_ALLOCNO. (init_costs, finish_costs): New. (ira_costs): Set up allocno_p and cost_elements_num. Call init_costs and finish_costs. (ira_set_pseudo_classes): New. * rtl.h (allocate_reg_info): Remove. (resize_reg_info): Change return type. (reg_cover_class): New. (setup_reg_classes): Add new parameter. * sched-int.h (struct deps_reg): New member implicit_sets. (sched_pressure_p, sched_regno_cover_class): New external definitions. (INCREASE_BITS): New macro. (struct reg_pressure_data, struct reg_use_data): New. (struct _haifa_insn_data): Remove reg_weight. Add members reg_pressure, reg_use_list, reg_set_list, and reg_pressure_excess_cost_change. (struct deps): New member implicit_sets. (pressure_p): New variable. (COVER_CLASS_BITS, INCREASE_BITS): New macros. (struct reg_pressure_data, struct reg_use_data): New. (INSN_REG_WEIGHT): Remove. (INSN_REG_PRESSURE, INSN_MAX_REG_PRESSURE, INSN_REG_USE_LIST, INSN_REG_SET_LIST, INSN_REG_PRESSURE_EXCESS_COST_CHANGE): New macros. (sched_init_region_reg_pressure_info, sched_setup_bb_reg_pressure_info): New prototypes. * reginfo.c (struct reg_pref): New member coverclass. (reg_cover_class): New function. (reginfo_init, pass_reginfo_init): Move after free_reg_info. (reg_info_size): New variable. (allocate_reg_info): Make static. Setup reg_info_size. (resize_reg_info): Use reg_info_size. Return flag of resizing. (setup_reg_classes): Add a new parameter. Setup cover class too. * Makefile.in (reload.o, haifa-sched.o, sched-deps.o): Add ira.h to the dependencies. * sched-rgn.c (deps_join): Set up implicit_sets. (schedule_region): Set up region and basic blocks pressure relative info. * passes.c (init_optimization_passes): Move pass_subregs_of_mode_init before pass_sched. From-SVN: r151348
Diffstat (limited to 'gcc/sched-int.h')
-rw-r--r--gcc/sched-int.h89
1 files changed, 84 insertions, 5 deletions
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index 518fcb5..de780e5 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -441,6 +441,7 @@ struct deps_reg
{
rtx uses;
rtx sets;
+ rtx implicit_sets;
rtx clobbers;
int uses_length;
int clobbers_length;
@@ -642,6 +643,14 @@ extern spec_info_t spec_info;
extern struct haifa_sched_info *current_sched_info;
+/* Do register pressure sensitive insn scheduling if the flag is set
+ up. */
+extern bool sched_pressure_p;
+
+/* Map regno -> its cover class. The map defined only when
+ SCHED_PRESSURE_P is true. */
+extern enum reg_class *sched_regno_cover_class;
+
/* Indexed by INSN_UID, the collection of all data associated with
a single instruction. */
@@ -687,6 +696,52 @@ struct _haifa_deps_insn_data
unsigned int cant_move : 1;
};
+/* Bits used for storing values of the fields in the following
+ structure. */
+#define INCREASE_BITS 8
+
+/* The structure describes how the corresponding insn increases the
+ register pressure for each cover class. */
+struct reg_pressure_data
+{
+ /* Pressure increase for given class because of clobber. */
+ unsigned int clobber_increase : INCREASE_BITS;
+ /* Increase in register pressure for given class because of register
+ sets. */
+ unsigned int set_increase : INCREASE_BITS;
+ /* Pressure increase for given class because of unused register
+ set. */
+ unsigned int unused_set_increase : INCREASE_BITS;
+ /* Pressure change: #sets - #deaths. */
+ int change : INCREASE_BITS;
+};
+
+/* The following structure describes usage of registers by insns. */
+struct reg_use_data
+{
+ /* Regno used in the insn. */
+ int regno;
+ /* Insn using the regno. */
+ rtx insn;
+ /* Cyclic list of elements with the same regno. */
+ struct reg_use_data *next_regno_use;
+ /* List of elements with the same insn. */
+ struct reg_use_data *next_insn_use;
+};
+
+/* The following structure describes used sets of registers by insns.
+ Registers are pseudos whose cover class is not NO_REGS or hard
+ registers available for allocations. */
+struct reg_set_data
+{
+ /* Regno used in the insn. */
+ int regno;
+ /* Insn setting the regno. */
+ rtx insn;
+ /* List of elements with the same insn. */
+ struct reg_set_data *next_insn_set;
+};
+
struct _haifa_insn_data
{
/* We can't place 'struct _deps_list' into h_i_d instead of deps_list_t
@@ -712,10 +767,6 @@ struct _haifa_insn_data
short cost;
- /* This weight is an estimation of the insn's contribution to
- register pressure. */
- short reg_weight;
-
/* Set if there's DEF-USE dependence between some speculatively
moved load insn and this one. */
unsigned int fed_by_spec_load : 1;
@@ -740,6 +791,26 @@ struct _haifa_insn_data
/* Original pattern of the instruction. */
rtx orig_pat;
+
+ /* The following array contains info how the insn increases register
+ pressure. There is an element for each cover class of pseudos
+ referenced in insns. */
+ struct reg_pressure_data *reg_pressure;
+ /* The following array contains maximal reg pressure between last
+ scheduled insn and given insn. There is an element for each
+ cover class of pseudos referenced in insns. This info updated
+ after scheduling each insn for each insn between the two
+ mentioned insns. */
+ int *max_reg_pressure;
+ /* The following list contains info about used pseudos and hard
+ registers available for allocation. */
+ struct reg_use_data *reg_use_list;
+ /* The following list contains info about set pseudos and hard
+ registers available for allocation. */
+ struct reg_set_data *reg_set_list;
+ /* Info about how scheduling the insn changes cost of register
+ pressure excess (between source and target). */
+ int reg_pressure_excess_cost_change;
};
typedef struct _haifa_insn_data haifa_insn_data_def;
@@ -755,7 +826,12 @@ extern VEC(haifa_insn_data_def, heap) *h_i_d;
/* Accessor macros for h_i_d. There are more in haifa-sched.c and
sched-rgn.c. */
#define INSN_PRIORITY(INSN) (HID (INSN)->priority)
-#define INSN_REG_WEIGHT(INSN) (HID (INSN)->reg_weight)
+#define INSN_REG_PRESSURE(INSN) (HID (INSN)->reg_pressure)
+#define INSN_MAX_REG_PRESSURE(INSN) (HID (INSN)->max_reg_pressure)
+#define INSN_REG_USE_LIST(INSN) (HID (INSN)->reg_use_list)
+#define INSN_REG_SET_LIST(INSN) (HID (INSN)->reg_set_list)
+#define INSN_REG_PRESSURE_EXCESS_COST_CHANGE(INSN) \
+ (HID (INSN)->reg_pressure_excess_cost_change)
#define INSN_PRIORITY_STATUS(INSN) (HID (INSN)->priority_status)
typedef struct _haifa_deps_insn_data haifa_deps_insn_data_def;
@@ -1153,7 +1229,9 @@ extern void extend_dependency_caches (int, bool);
extern void debug_ds (ds_t);
+
/* Functions in haifa-sched.c. */
+extern void sched_init_region_reg_pressure_info (void);
extern int haifa_classify_insn (const_rtx);
extern void get_ebb_head_tail (basic_block, basic_block, rtx *, rtx *);
extern int no_real_insns_p (const_rtx, const_rtx);
@@ -1163,6 +1241,7 @@ extern int dep_cost_1 (dep_t, dw_t);
extern int dep_cost (dep_t);
extern int set_priorities (rtx, rtx);
+extern void sched_setup_bb_reg_pressure_info (basic_block, rtx);
extern void schedule_block (basic_block *);
extern int cycle_issued_insns;