/* Loop unrolling.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2016 Free Software Foundation, Inc.
This file is part of GCC.
#include "config.h"
#include "system.h"
#include "coretypes.h"
-#include "tm.h"
+#include "backend.h"
+#include "target.h"
#include "rtl.h"
#include "tree.h"
-#include "hard-reg-set.h"
-#include "obstack.h"
-#include "basic-block.h"
+#include "cfghooks.h"
+#include "optabs.h"
+#include "emit-rtl.h"
+#include "recog.h"
+#include "profile.h"
+#include "cfgrtl.h"
#include "cfgloop.h"
#include "params.h"
+#include "dojump.h"
#include "expr.h"
-#include "hash-table.h"
-#include "recog.h"
-#include "target.h"
#include "dumpfile.h"
/* This pass performs loop unrolling. We only perform this
/* Hashtable helper for iv_to_split. */
-struct iv_split_hasher : typed_free_remove <iv_to_split>
+struct iv_split_hasher : free_ptr_hash <iv_to_split>
{
- typedef iv_to_split value_type;
- typedef iv_to_split compare_type;
- static inline hashval_t hash (const value_type *);
- static inline bool equal (const value_type *, const compare_type *);
+ static inline hashval_t hash (const iv_to_split *);
+ static inline bool equal (const iv_to_split *, const iv_to_split *);
};
/* A hash function for information about insns to split. */
inline hashval_t
-iv_split_hasher::hash (const value_type *ivts)
+iv_split_hasher::hash (const iv_to_split *ivts)
{
return (hashval_t) INSN_UID (ivts->insn);
}
/* An equality functions for information about insns to split. */
inline bool
-iv_split_hasher::equal (const value_type *i1, const compare_type *i2)
+iv_split_hasher::equal (const iv_to_split *i1, const iv_to_split *i2)
{
return i1->insn == i2->insn;
}
/* Hashtable helper for iv_to_split. */
-struct var_expand_hasher : typed_free_remove <var_to_expand>
+struct var_expand_hasher : free_ptr_hash <var_to_expand>
{
- typedef var_to_expand value_type;
- typedef var_to_expand compare_type;
- static inline hashval_t hash (const value_type *);
- static inline bool equal (const value_type *, const compare_type *);
+ static inline hashval_t hash (const var_to_expand *);
+ static inline bool equal (const var_to_expand *, const var_to_expand *);
};
/* Return a hash for VES. */
inline hashval_t
-var_expand_hasher::hash (const value_type *ves)
+var_expand_hasher::hash (const var_to_expand *ves)
{
return (hashval_t) INSN_UID (ves->insn);
}
/* Return true if I1 and I2 refer to the same instruction. */
inline bool
-var_expand_hasher::equal (const value_type *i1, const compare_type *i2)
+var_expand_hasher::equal (const var_to_expand *i1, const var_to_expand *i2)
{
return i1->insn == i2->insn;
}
in order to create a jump. */
static rtx_insn *
-compare_and_jump_seq (rtx op0, rtx op1, enum rtx_code comp, rtx label, int prob,
- rtx_insn *cinsn)
+compare_and_jump_seq (rtx op0, rtx op1, enum rtx_code comp,
+ rtx_code_label *label, int prob, rtx_insn *cinsn)
{
- rtx_insn *seq, *jump;
+ rtx_insn *seq;
+ rtx_jump_insn *jump;
rtx cond;
- enum machine_mode mode;
+ machine_mode mode;
mode = GET_MODE (op0);
if (mode == VOIDmode)
gcc_assert (rtx_equal_p (op0, XEXP (cond, 0)));
gcc_assert (rtx_equal_p (op1, XEXP (cond, 1)));
emit_jump_insn (copy_insn (PATTERN (cinsn)));
- jump = get_last_insn ();
- gcc_assert (JUMP_P (jump));
+ jump = as_a <rtx_jump_insn *> (get_last_insn ());
JUMP_LABEL (jump) = JUMP_LABEL (cinsn);
LABEL_NUSES (JUMP_LABEL (jump))++;
redirect_jump (jump, label, 0);
op0 = force_operand (op0, NULL_RTX);
op1 = force_operand (op1, NULL_RTX);
do_compare_rtx_and_jump (op0, op1, comp, 0,
- mode, NULL_RTX, NULL_RTX, label, -1);
- jump = get_last_insn ();
- gcc_assert (JUMP_P (jump));
- JUMP_LABEL (jump) = label;
+ mode, NULL_RTX, NULL, label, -1);
+ jump = as_a <rtx_jump_insn *> (get_last_insn ());
+ jump->set_jump_target (label);
LABEL_NUSES (label)++;
}
add_int_reg_note (jump, REG_BR_PROB, prob);
Set *DEBUG_USES to the number of debug insns that reference the
variable. */
-bool
+static bool
referenced_in_one_insn_in_loop_p (struct loop *loop, rtx reg,
int *debug_uses)
{
{
rtx expr, *loc, incr, var;
rtx_insn *seq;
- enum machine_mode mode = GET_MODE (ivts->base_var);
+ machine_mode mode = GET_MODE (ivts->base_var);
rtx src, dest, set;
/* Construct base + DELTA * step. */
rtx_insn *seq;
rtx var, zero_init;
unsigned i;
- enum machine_mode mode = GET_MODE (ve->reg);
+ machine_mode mode = GET_MODE (ve->reg);
bool honor_signed_zero_p = HONOR_SIGNED_ZEROS (mode);
if (ve->var_expansions.length () == 0)