summaryrefslogtreecommitdiff
path: root/gcc/ira-int.h
diff options
context:
space:
mode:
authorvmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-16 15:15:48 +0000
committervmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-16 15:15:48 +0000
commit8f6c49f5439f316279d260c2c1bb0d478cd19dcb (patch)
treecb80a649f68346c26aa9c7e3333e0ca57fbc0396 /gcc/ira-int.h
parent3e10a823e1263be1541e1d9e91676460bb12d926 (diff)
downloadgcc-8f6c49f5439f316279d260c2c1bb0d478cd19dcb.tar.gz
2009-04-16 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/39762 * ira-int.h (ira_register_move_cost, ira_may_move_in_cost, ira_may_move_out_cost): Add comments about way of their usage. (ira_get_register_move_cost, ira_get_may_move_cost): New functions. * ira-conflicts.c (process_regs_for_copy): Use function ira_get_register_move_cost instead of global ira_register_move_cost. * ira-color.c (update_copy_costs, calculate_allocno_spill_cost, color_pass, move_spill_restore, update_curr_costs): Ditto. * ira-lives.c (process_single_reg_class_operands): Ditto. * ira-emit.c (emit_move_list): Ditto. * ira-costs.c (copy_cost): Don't call ira_init_register_move_cost. (record_reg_classes): Ditto. Use functions ira_get_register_move_cost and ira_get_may_move_cost instead of global vars ira_register_move_cost, ira_may_move_out_cost and ira_may_move_in_cost. (record_address_regs): Don't call ira_init_register_move_cost. Use function ira_get_may_move_cost instead of global ira_may_move_in_cost. (process_bb_node_for_hard_reg_moves): Use function ira_get_register_move_cost instead of global ira_register_move_cost. (ira_costs): Don't call ira_init_register_move_cost. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146198 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ira-int.h')
-rw-r--r--gcc/ira-int.h39
1 files changed, 35 insertions, 4 deletions
diff --git a/gcc/ira-int.h b/gcc/ira-int.h
index 6e66cc49572..5b8c1ef0bae 100644
--- a/gcc/ira-int.h
+++ b/gcc/ira-int.h
@@ -730,21 +730,24 @@ ira_allocno_set_iter_next (ira_allocno_set_iterator *i)
extern HARD_REG_SET ira_reg_mode_hard_regset
[FIRST_PSEUDO_REGISTER][NUM_MACHINE_MODES];
-/* Arrays analogous to macros MEMORY_MOVE_COST and
- REGISTER_MOVE_COST. */
+/* Arrays analogous to macros MEMORY_MOVE_COST and REGISTER_MOVE_COST.
+ Don't use ira_register_move_cost directly. Use function of
+ ira_get_may_move_cost instead. */
extern short ira_memory_move_cost[MAX_MACHINE_MODE][N_REG_CLASSES][2];
extern move_table *ira_register_move_cost[MAX_MACHINE_MODE];
/* Similar to may_move_in_cost but it is calculated in IRA instead of
regclass. Another difference we take only available hard registers
into account to figure out that one register class is a subset of
- the another one. */
+ the another one. Don't use it directly. Use function of
+ ira_get_may_move_cost instead. */
extern move_table *ira_may_move_in_cost[MAX_MACHINE_MODE];
/* Similar to may_move_out_cost but it is calculated in IRA instead of
regclass. Another difference we take only available hard registers
into account to figure out that one register class is a subset of
- the another one. */
+ the another one. Don't use it directly. Use function of
+ ira_get_may_move_cost instead. */
extern move_table *ira_may_move_out_cost[MAX_MACHINE_MODE];
/* Register class subset relation: TRUE if the first class is a subset
@@ -941,6 +944,34 @@ extern void ira_emit (bool);
+/* Return cost of moving value of MODE from register of class FROM to
+ register of class TO. */
+static inline int
+ira_get_register_move_cost (enum machine_mode mode,
+ enum reg_class from, enum reg_class to)
+{
+ if (ira_register_move_cost[mode] == NULL)
+ ira_init_register_move_cost (mode);
+ return ira_register_move_cost[mode][from][to];
+}
+
+/* Return cost of moving value of MODE from register of class FROM to
+ register of class TO. Return zero if IN_P is true and FROM is
+ subset of TO or if IN_P is false and FROM is superset of TO. */
+static inline int
+ira_get_may_move_cost (enum machine_mode mode,
+ enum reg_class from, enum reg_class to,
+ bool in_p)
+{
+ if (ira_register_move_cost[mode] == NULL)
+ ira_init_register_move_cost (mode);
+ return (in_p
+ ? ira_may_move_in_cost[mode][from][to]
+ : ira_may_move_out_cost[mode][from][to]);
+}
+
+
+
/* The iterator for all allocnos. */
typedef struct {
/* The number of the current element in IRA_ALLOCNOS. */