aboutsummaryrefslogtreecommitdiff
path: root/gcc/expmed.h
diff options
context:
space:
mode:
authorBill Schmidt <wschmidt@linux.ibm.com>2012-07-26 13:10:04 +0000
committerWilliam Schmidt <wschmidt@gcc.gnu.org>2012-07-26 13:10:04 +0000
commit6dd8f4bb6154b0d8190a09369dc51b2acd427b93 (patch)
treed1c32e077e8672a0302c870fe8ff5a2256a82879 /gcc/expmed.h
parent0263463dd114d7ea50230ae6c53e7031615b2ec8 (diff)
downloadgcc-6dd8f4bb6154b0d8190a09369dc51b2acd427b93.zip
gcc-6dd8f4bb6154b0d8190a09369dc51b2acd427b93.tar.gz
gcc-6dd8f4bb6154b0d8190a09369dc51b2acd427b93.tar.bz2
tree-ssa-loop-ivopts.c (mbc_entry_hash): Remove.
2012-07-26 Bill Schmidt <wschmidt@linux.ibm.com> * tree-ssa-loop-ivopts.c (mbc_entry_hash): Remove. (mbc_entry_eq): Likewise. (mult_costs): Likewise. (cost_tables_exist): Likewise. (initialize_costs): Likewise. (finalize_costs): Likewise. (tree_ssa_iv_optimize_init): Remove call to initialize_costs. (add_regs_cost): Remove. (multiply_regs_cost): Likewise. (add_const_cost): Likewise. (extend_or_trunc_reg_cost): Likewise. (negate_reg_cost): Likewise. (struct mbc_entry): Likewise. (multiply_by_const_cost): Likewise. (get_address_cost): Change add_regs_cost calls to add_cost lookups; change multiply_by_const_cost to mult_by_coeff_cost. (force_expr_to_var_cost): Likewise. (difference_cost): Change multiply_by_const_cost to mult_by_coeff_cost. (get_computation_cost_at): Change add_regs_cost calls to add_cost lookups; change multiply_by_const_cost to mult_by_coeff_cost. (determine_iv_cost): Change add_regs_cost calls to add_cost lookups. (tree_ssa_iv_optimize_finalize): Remove call to finalize_costs. * tree-ssa-address.c (expmed.h): New #include. (most_expensive_mult_to_index): Change multiply_by_const_cost to mult_by_coeff_cost. * gimple-ssa-strength-reduction.c (expmed.h): New #include. (stmt_cost): Change to use mult_by_coeff_cost, mul_cost, add_cost, neg_cost, and convert_cost instead of IVOPTS interfaces. (execute_strength_reduction): Remove calls to initialize_costs and finalize_costs. * expmed.c (struct init_expmed_rtl): Add convert rtx_def. (init_expmed_one_mode): Initialize convert rtx_def; initialize x_convert_cost for related modes. (mult_by_coeff_cost): New function. * expmed.h (NUM_MODE_INT): New #define. (struct target_expmed): Add x_convert_cost matrix. (set_convert_cost): New inline function. (convert_cost): Likewise. (mult_by_coeff_cost): New extern decl. * tree-flow.h (initialize_costs): Remove decl. (finalize_costs): Likewise. (multiply_by_const_cost): Likewise. (add_regs_cost): Likewise. (multiply_regs_cost): Likewise. (add_const_cost): Likewise. (extend_or_trunc_reg_cost): Likewise. (negate_reg_cost): Likewise. * Makefile.in (gimple-ssa-strength-reduction.o): Update dependencies. (tree-ssa-address.o): Update dependencies. From-SVN: r189890
Diffstat (limited to 'gcc/expmed.h')
-rw-r--r--gcc/expmed.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/gcc/expmed.h b/gcc/expmed.h
index 37f5755..ea141bc 100644
--- a/gcc/expmed.h
+++ b/gcc/expmed.h
@@ -124,6 +124,8 @@ struct alg_hash_entry {
#define NUM_ALG_HASH_ENTRIES 307
#endif
+#define NUM_MODE_INT (MAX_MODE_INT - MIN_MODE_INT + 1)
+
/* Target-dependent globals. */
struct target_expmed {
/* Each entry of ALG_HASH caches alg_code for some integer. This is
@@ -155,6 +157,11 @@ struct target_expmed {
int x_udiv_cost[2][NUM_MACHINE_MODES];
int x_mul_widen_cost[2][NUM_MACHINE_MODES];
int x_mul_highpart_cost[2][NUM_MACHINE_MODES];
+
+ /* Conversion costs are only defined between two scalar integer modes
+ of different sizes. The first machine mode is the destination mode,
+ and the second is the source mode. */
+ int x_convert_cost[2][NUM_MODE_INT][NUM_MODE_INT];
};
extern struct target_expmed default_target_expmed;
@@ -197,4 +204,43 @@ extern struct target_expmed *this_target_expmed;
#define mul_highpart_cost \
(this_target_expmed->x_mul_highpart_cost)
+/* Set the COST for converting from FROM_MODE to TO_MODE when optimizing
+ for SPEED. */
+
+static inline void
+set_convert_cost (enum machine_mode to_mode, enum machine_mode from_mode,
+ bool speed, int cost)
+{
+ int to_idx, from_idx;
+
+ gcc_assert (to_mode >= MIN_MODE_INT
+ && to_mode <= MAX_MODE_INT
+ && from_mode >= MIN_MODE_INT
+ && from_mode <= MAX_MODE_INT);
+
+ to_idx = to_mode - MIN_MODE_INT;
+ from_idx = from_mode - MIN_MODE_INT;
+ this_target_expmed->x_convert_cost[speed][to_idx][from_idx] = cost;
+}
+
+/* Return the cost for converting from FROM_MODE to TO_MODE when optimizing
+ for SPEED. */
+
+static inline int
+convert_cost (enum machine_mode to_mode, enum machine_mode from_mode,
+ bool speed)
+{
+ int to_idx, from_idx;
+
+ gcc_assert (to_mode >= MIN_MODE_INT
+ && to_mode <= MAX_MODE_INT
+ && from_mode >= MIN_MODE_INT
+ && from_mode <= MAX_MODE_INT);
+
+ to_idx = to_mode - MIN_MODE_INT;
+ from_idx = from_mode - MIN_MODE_INT;
+ return this_target_expmed->x_convert_cost[speed][to_idx][from_idx];
+}
+
+extern int mult_by_coeff_cost (HOST_WIDE_INT, enum machine_mode, bool);
#endif