* rtl.h (set_rtx_cost, get_full_set_rtx_cost): New functions.
* auto-inc-dec.c (attempt_change): Use set_rtx_cost.
* cfgloopanal.c (seq_cost): Likewise.
* loop-invariant.c (create_new_invariant): Likewise.
* postreload.c (move2add_use_add2_insn, move2add_use_add3_insn)
(reload_cse_move2add): Use get_full_set_rtx_cost.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177850
138bc75d-0d04-0410-961f-
82ee72b054a4
+2011-08-18 Richard Sandiford <richard.sandiford@linaro.org>
+
+ * rtl.h (set_rtx_cost, get_full_set_rtx_cost): New functions.
+ * auto-inc-dec.c (attempt_change): Use set_rtx_cost.
+ * cfgloopanal.c (seq_cost): Likewise.
+ * loop-invariant.c (create_new_invariant): Likewise.
+ * postreload.c (move2add_use_add2_insn, move2add_use_add3_insn)
+ (reload_cse_move2add): Use get_full_set_rtx_cost.
+
2011-08-18 Richard Guenther <rguenther@suse.de>
* expr.c (get_inner_reference): Fix typo in last change.
XEXP (mem_tmp, 0) = new_addr;
old_cost = (rtx_cost (mem, SET, speed)
- + rtx_cost (PATTERN (inc_insn.insn), SET, speed));
+ + set_rtx_cost (PATTERN (inc_insn.insn), speed));
new_cost = rtx_cost (mem_tmp, SET, speed);
/* The first item of business is to see if this is profitable. */
{
set = single_set (seq);
if (set)
- cost += rtx_cost (set, SET, speed);
+ cost += set_rtx_cost (set, speed);
else
cost++;
}
the loop. Otherwise we save only cost of the computation. */
if (def)
{
- inv->cost = rtx_cost (set, SET, speed);
+ inv->cost = set_rtx_cost (set, speed);
/* ??? Try to determine cheapness of address computation. Unfortunately
the address cost is only a relative measure, we can't really compare
it with any absolute number, but only with other address costs.
struct full_rtx_costs oldcst, newcst;
rtx tem = gen_rtx_PLUS (GET_MODE (reg), reg, new_src);
- get_full_rtx_cost (pat, SET, &oldcst);
+ get_full_set_rtx_cost (pat, &oldcst);
SET_SRC (pat) = tem;
- get_full_rtx_cost (pat, SET, &newcst);
+ get_full_set_rtx_cost (pat, &newcst);
SET_SRC (pat) = src;
if (costs_lt_p (&newcst, &oldcst, speed)
rtx plus_expr;
init_costs_to_max (&mincst);
- get_full_rtx_cost (pat, SET, &oldcst);
+ get_full_set_rtx_cost (pat, &oldcst);
plus_expr = gen_rtx_PLUS (GET_MODE (reg), reg, const0_rtx);
SET_SRC (pat) = plus_expr;
else
{
XEXP (plus_expr, 1) = new_src;
- get_full_rtx_cost (pat, SET, &newcst);
+ get_full_set_rtx_cost (pat, &newcst);
if (costs_lt_p (&newcst, &mincst, speed))
{
struct full_rtx_costs oldcst, newcst;
rtx tem = gen_rtx_PLUS (GET_MODE (reg), reg, new_src);
- get_full_rtx_cost (set, SET, &oldcst);
+ get_full_set_rtx_cost (set, &oldcst);
SET_SRC (set) = tem;
get_full_rtx_cost (tem, SET, &newcst);
SET_SRC (set) = old_src;
extern bool truncated_to_mode (enum machine_mode, const_rtx);
extern int low_bitmask_len (enum machine_mode, unsigned HOST_WIDE_INT);
+#ifndef GENERATOR_FILE
+/* Return the cost of SET X. SPEED_P is true if optimizing for speed
+ rather than size. */
+
+static inline int
+set_rtx_cost (rtx x, bool speed_p)
+{
+ return rtx_cost (x, INSN, speed_p);
+}
+
+/* Like set_rtx_cost, but return both the speed and size costs in C. */
+
+static inline void
+get_full_set_rtx_cost (rtx x, struct full_rtx_costs *c)
+{
+ get_full_rtx_cost (x, INSN, c);
+}
+#endif
/* 1 if RTX is a subreg containing a reg that is already known to be
sign- or zero-extended from the mode of the subreg to the mode of