aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2014-08-22 19:03:32 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2014-08-22 19:03:32 +0000
commit38295e01e2688696523e999002060a39545d218b (patch)
tree11fddc323c1a74924f1634abcfb3871822435727 /gcc/optabs.c
parent6210ec61d92762184a7c53e4fa2c9e1e037251ee (diff)
downloadgcc-38295e01e2688696523e999002060a39545d218b.zip
gcc-38295e01e2688696523e999002060a39545d218b.tar.gz
gcc-38295e01e2688696523e999002060a39545d218b.tar.bz2
optabs.c: Use rtx_insn and rtx_code_label
gcc/ * optabs.c (expand_doubleword_shift): Strengthen local "insn" from rtx to rtx_insn *. (expand_binop): Likewise for locals "entry_last", "last", "insns" (expand_twoval_unop): Likewise for locals entry_last", "last". (expand_twoval_binop): Likewise. (expand_twoval_binop_libfunc): Likewise for local "insns". (widen_leading): Likewise for local "last". (expand_doubleword_clz): Likewise for local "seq". Strengthen locals "hi0_label", "after_label" from rtx to rtx_code_label *. (widen_bswap): Strengthen local "last" from rtx to rtx_insn *. (expand_parity): Likewise for locals "last" and "seq". (expand_ffs): Likewise for local "seq". Strengthen local "nonzero_label" from rtx to rtx_code_label *. (expand_absneg_bit): Strengthen local "insns" from rtx to rtx_insn *. (expand_unop_direct): Likewise for local "last". (expand_unop): Likewise for locals "last", "insns". (expand_abs_nojump): Likewise for local "last". (expand_abs): Strengthen local "op1" from rtx to rtx_code_label *. (expand_one_cmpl_abs_nojump): Strengthen local "last" from rtx to rtx_insn *. (expand_copysign_absneg): Strengthen local "label" from rtx to rtx_code_label *. (expand_copysign_bit): Strengthen local "insns" from rtx to rtx_insn *. (struct no_conflict_data): Likewise for fields "first", "insn". (emit_libcall_block_1): Likewise for param "insns" and locals "next", "last", "insn". (emit_libcall_block): For now, add a checked cast to rtx_insn * on "insns" when invoking emit_libcall_block_1. Ultimately we want to strengthen insns itself. (prepare_cmp_insn): Strengthen local "last" from rtx to rtx_insn *. (emit_cmp_and_jump_insn_1): Likewise for local "insn". (prepare_float_lib_cmp): Likewise for local "insns". (emit_conditional_move): Likewise for local "last". (emit_conditional_add): Likewise. (have_sub2_insn): Likewise for local "seq". (expand_float): Likewise for local "insns". Strengthen locals "label", "neglabel" from rtx to rtx_code_label *. (expand_fix): Likewise for locals "last", "insn", "insns" (to rtx_insn *) and locals "lab1", "lab2" (to rtx_code_label *). (expand_fixed_convert): Likewise for local "insns" (to rtx_insn *). (expand_sfix_optab): Likewise for local "last". (expand_compare_and_swap_loop): Strengthen local "label" from rtx to rtx_code_label *. (maybe_emit_sync_lock_test_and_set): Strengthen local "last_insn" from rtx to rtx_insn *. (expand_atomic_fetch_op): Likewise for local "insn". (maybe_legitimize_operand_same_code): Likewise for local "last". (maybe_legitimize_operands): Likewise. From-SVN: r214355
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c134
1 files changed, 77 insertions, 57 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 60228d3..08d5c6e 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -59,7 +59,7 @@ struct target_libfuncs *this_target_libfuncs = &default_target_libfuncs;
static void prepare_float_lib_cmp (rtx, rtx, enum rtx_code, rtx *,
enum machine_mode *);
static rtx expand_unop_direct (enum machine_mode, optab, rtx, rtx, int);
-static void emit_libcall_block_1 (rtx, rtx, rtx, rtx, bool);
+static void emit_libcall_block_1 (rtx_insn *, rtx, rtx, rtx, bool);
/* Debug facility for use in GDB. */
void debug_optab_libfuncs (void);
@@ -1105,7 +1105,7 @@ expand_doubleword_shift (enum machine_mode op1_mode, optab binoptab,
#ifdef HAVE_conditional_move
/* Try using conditional moves to generate straight-line code. */
{
- rtx start = get_last_insn ();
+ rtx_insn *start = get_last_insn ();
if (expand_doubleword_shift_condmove (op1_mode, binoptab,
cmp_code, cmp1, cmp2,
outof_input, into_input,
@@ -1543,8 +1543,8 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
enum machine_mode wider_mode;
rtx libfunc;
rtx temp;
- rtx entry_last = get_last_insn ();
- rtx last;
+ rtx_insn *entry_last = get_last_insn ();
+ rtx_insn *last;
mclass = GET_MODE_CLASS (mode);
@@ -1740,7 +1740,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
&& optab_handler (binoptab, word_mode) != CODE_FOR_nothing)
{
int i;
- rtx insns;
+ rtx_insn *insns;
/* If TARGET is the same as one of the operands, the REG_EQUAL note
won't be accurate, so use a new target. */
@@ -1809,7 +1809,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
|| (shift_mask == BITS_PER_WORD - 1
&& double_shift_mask == BITS_PER_WORD * 2 - 1))
{
- rtx insns;
+ rtx_insn *insns;
rtx into_target, outof_target;
rtx into_input, outof_input;
int left_shift, outof_word;
@@ -1861,7 +1861,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
&& optab_handler (ashl_optab, word_mode) != CODE_FOR_nothing
&& optab_handler (lshr_optab, word_mode) != CODE_FOR_nothing)
{
- rtx insns;
+ rtx_insn *insns;
rtx into_target, outof_target;
rtx into_input, outof_input;
rtx inter;
@@ -2146,7 +2146,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
if (libfunc
&& (methods == OPTAB_LIB || methods == OPTAB_LIB_WIDEN))
{
- rtx insns;
+ rtx_insn *insns;
rtx op1x = op1;
enum machine_mode op1_mode = mode;
rtx value;
@@ -2334,8 +2334,8 @@ expand_twoval_unop (optab unoptab, rtx op0, rtx targ0, rtx targ1,
enum machine_mode mode = GET_MODE (targ0 ? targ0 : targ1);
enum mode_class mclass;
enum machine_mode wider_mode;
- rtx entry_last = get_last_insn ();
- rtx last;
+ rtx_insn *entry_last = get_last_insn ();
+ rtx_insn *last;
mclass = GET_MODE_CLASS (mode);
@@ -2408,8 +2408,8 @@ expand_twoval_binop (optab binoptab, rtx op0, rtx op1, rtx targ0, rtx targ1,
enum machine_mode mode = GET_MODE (targ0 ? targ0 : targ1);
enum mode_class mclass;
enum machine_mode wider_mode;
- rtx entry_last = get_last_insn ();
- rtx last;
+ rtx_insn *entry_last = get_last_insn ();
+ rtx_insn *last;
mclass = GET_MODE_CLASS (mode);
@@ -2490,7 +2490,7 @@ expand_twoval_binop_libfunc (optab binoptab, rtx op0, rtx op1,
enum machine_mode mode;
enum machine_mode libval_mode;
rtx libval;
- rtx insns;
+ rtx_insn *insns;
rtx libfunc;
/* Exactly one of TARG0 or TARG1 should be non-NULL. */
@@ -2556,7 +2556,8 @@ widen_leading (enum machine_mode mode, rtx op0, rtx target, optab unoptab)
{
if (optab_handler (unoptab, wider_mode) != CODE_FOR_nothing)
{
- rtx xop0, temp, last;
+ rtx xop0, temp;
+ rtx_insn *last;
last = get_last_insn ();
@@ -2591,9 +2592,10 @@ expand_doubleword_clz (enum machine_mode mode, rtx op0, rtx target)
rtx xop0 = force_reg (mode, op0);
rtx subhi = gen_highpart (word_mode, xop0);
rtx sublo = gen_lowpart (word_mode, xop0);
- rtx hi0_label = gen_label_rtx ();
- rtx after_label = gen_label_rtx ();
- rtx seq, temp, result;
+ rtx_code_label *hi0_label = gen_label_rtx ();
+ rtx_code_label *after_label = gen_label_rtx ();
+ rtx_insn *seq;
+ rtx temp, result;
/* If we were not given a target, use a word_mode register, not a
'mode' register. The result will fit, and nobody is expecting
@@ -2662,7 +2664,8 @@ widen_bswap (enum machine_mode mode, rtx op0, rtx target)
{
enum mode_class mclass = GET_MODE_CLASS (mode);
enum machine_mode wider_mode;
- rtx x, last;
+ rtx x;
+ rtx_insn *last;
if (!CLASS_HAS_WIDER_MODES_P (mclass))
return NULL_RTX;
@@ -2736,7 +2739,8 @@ expand_parity (enum machine_mode mode, rtx op0, rtx target)
{
if (optab_handler (popcount_optab, wider_mode) != CODE_FOR_nothing)
{
- rtx xop0, temp, last;
+ rtx xop0, temp;
+ rtx_insn *last;
last = get_last_insn ();
@@ -2773,7 +2777,8 @@ expand_parity (enum machine_mode mode, rtx op0, rtx target)
static rtx
expand_ctz (enum machine_mode mode, rtx op0, rtx target)
{
- rtx seq, temp;
+ rtx_insn *seq;
+ rtx temp;
if (optab_handler (clz_optab, mode) == CODE_FOR_nothing)
return 0;
@@ -2817,7 +2822,8 @@ expand_ffs (enum machine_mode mode, rtx op0, rtx target)
{
HOST_WIDE_INT val = 0;
bool defined_at_zero = false;
- rtx temp, seq;
+ rtx temp;
+ rtx_insn *seq;
if (optab_handler (ctz_optab, mode) != CODE_FOR_nothing)
{
@@ -2859,7 +2865,7 @@ expand_ffs (enum machine_mode mode, rtx op0, rtx target)
the operation sets condition codes that can be recycled for this.
(This is true on i386, for instance.) */
- rtx nonzero_label = gen_label_rtx ();
+ rtx_code_label *nonzero_label = gen_label_rtx ();
emit_cmp_and_jump_insns (op0, CONST0_RTX (mode), NE, 0,
mode, true, nonzero_label);
@@ -2916,7 +2922,8 @@ expand_absneg_bit (enum rtx_code code, enum machine_mode mode,
const struct real_format *fmt;
int bitpos, word, nwords, i;
enum machine_mode imode;
- rtx temp, insns;
+ rtx temp;
+ rtx_insn *insns;
/* The format has to have a simple sign bit. */
fmt = REAL_MODE_FORMAT (mode);
@@ -3013,7 +3020,7 @@ expand_unop_direct (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
{
struct expand_operand ops[2];
enum insn_code icode = optab_handler (unoptab, mode);
- rtx last = get_last_insn ();
+ rtx_insn *last = get_last_insn ();
rtx pat;
create_output_operand (&ops[0], target, mode);
@@ -3098,7 +3105,8 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
be always more efficient than the other fallback methods. */
if (mode == HImode)
{
- rtx last, temp1, temp2;
+ rtx_insn *last;
+ rtx temp1, temp2;
if (optab_handler (rotl_optab, mode) != CODE_FOR_nothing)
{
@@ -3156,7 +3164,7 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
if (optab_handler (unoptab, wider_mode) != CODE_FOR_nothing)
{
rtx xop0 = op0;
- rtx last = get_last_insn ();
+ rtx_insn *last = get_last_insn ();
/* For certain operations, we need not actually extend
the narrow operand, as long as we will truncate the
@@ -3195,7 +3203,7 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
&& optab_handler (unoptab, word_mode) != CODE_FOR_nothing)
{
int i;
- rtx insns;
+ rtx_insn *insns;
if (target == 0 || target == op0 || !valid_multiword_target_p (target))
target = gen_reg_rtx (mode);
@@ -3273,7 +3281,7 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
libfunc = optab_libfunc (unoptab, mode);
if (libfunc)
{
- rtx insns;
+ rtx_insn *insns;
rtx value;
rtx eq_value;
enum machine_mode outmode = mode;
@@ -3320,7 +3328,7 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
|| optab_libfunc (unoptab, wider_mode))
{
rtx xop0 = op0;
- rtx last = get_last_insn ();
+ rtx_insn *last = get_last_insn ();
/* For certain operations, we need not actually extend
the narrow operand, as long as we will truncate the
@@ -3430,7 +3438,7 @@ expand_abs_nojump (enum machine_mode mode, rtx op0, rtx target,
if (optab_handler (smax_optab, mode) != CODE_FOR_nothing
&& !HONOR_SIGNED_ZEROS (mode))
{
- rtx last = get_last_insn ();
+ rtx_insn *last = get_last_insn ();
temp = expand_unop (mode, result_unsignedp ? neg_optab : negv_optab,
op0, NULL_RTX, 0);
@@ -3473,7 +3481,8 @@ rtx
expand_abs (enum machine_mode mode, rtx op0, rtx target,
int result_unsignedp, int safe)
{
- rtx temp, op1;
+ rtx temp;
+ rtx_code_label *op1;
if (GET_MODE_CLASS (mode) != MODE_INT
|| ! flag_trapv)
@@ -3534,7 +3543,7 @@ expand_one_cmpl_abs_nojump (enum machine_mode mode, rtx op0, rtx target)
/* If we have a MAX insn, we can do this as MAX (x, ~x). */
if (optab_handler (smax_optab, mode) != CODE_FOR_nothing)
{
- rtx last = get_last_insn ();
+ rtx_insn *last = get_last_insn ();
temp = expand_unop (mode, one_cmpl_optab, op0, NULL_RTX, 0);
if (temp != 0)
@@ -3579,7 +3588,8 @@ expand_copysign_absneg (enum machine_mode mode, rtx op0, rtx op1, rtx target,
{
enum machine_mode imode;
enum insn_code icode;
- rtx sign, label;
+ rtx sign;
+ rtx_code_label *label;
if (target == op1)
target = NULL_RTX;
@@ -3662,7 +3672,8 @@ expand_copysign_bit (enum machine_mode mode, rtx op0, rtx op1, rtx target,
{
enum machine_mode imode;
int word, nwords, i;
- rtx temp, insns;
+ rtx temp;
+ rtx_insn *insns;
if (GET_MODE_SIZE (mode) <= UNITS_PER_WORD)
{
@@ -3842,7 +3853,8 @@ emit_unop_insn (enum insn_code icode, rtx target, rtx op0, enum rtx_code code)
struct no_conflict_data
{
- rtx target, first, insn;
+ rtx target;
+ rtx_insn *first, *insn;
bool must_stay;
};
@@ -3894,11 +3906,11 @@ no_conflict_move_test (rtx dest, const_rtx set, void *p0)
note with an operand of EQUIV. */
static void
-emit_libcall_block_1 (rtx insns, rtx target, rtx result, rtx equiv,
+emit_libcall_block_1 (rtx_insn *insns, rtx target, rtx result, rtx equiv,
bool equiv_may_trap)
{
rtx final_dest = target;
- rtx next, last, insn;
+ rtx_insn *next, *last, *insn;
/* If this is a reg with REG_USERVAR_P set, then it could possibly turn
into a MEM later. Protect the libcall block from this change. */
@@ -3994,7 +4006,8 @@ emit_libcall_block_1 (rtx insns, rtx target, rtx result, rtx equiv,
void
emit_libcall_block (rtx insns, rtx target, rtx result, rtx equiv)
{
- emit_libcall_block_1 (insns, target, result, equiv, false);
+ emit_libcall_block_1 (safe_as_a <rtx_insn *> (insns),
+ target, result, equiv, false);
}
/* Nonzero if we can perform a comparison of mode MODE straightforwardly.
@@ -4185,7 +4198,7 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx_code comparison, rtx size,
if (icode != CODE_FOR_nothing
&& insn_operand_matches (icode, 0, test))
{
- rtx last = get_last_insn ();
+ rtx_insn *last = get_last_insn ();
rtx op0 = prepare_operand (icode, x, 1, mode, cmp_mode, unsignedp);
rtx op1 = prepare_operand (icode, y, 2, mode, cmp_mode, unsignedp);
if (op0 && op1
@@ -4297,7 +4310,7 @@ emit_cmp_and_jump_insn_1 (rtx test, enum machine_mode mode, rtx label, int prob)
enum machine_mode optab_mode;
enum mode_class mclass;
enum insn_code icode;
- rtx insn;
+ rtx_insn *insn;
mclass = GET_MODE_CLASS (mode);
optab_mode = (mclass == MODE_CC) ? CCmode : mode;
@@ -4378,7 +4391,8 @@ prepare_float_lib_cmp (rtx x, rtx y, enum rtx_code comparison,
enum machine_mode orig_mode = GET_MODE (x);
enum machine_mode mode, cmp_mode;
rtx true_rtx, false_rtx;
- rtx value, target, insns, equiv;
+ rtx value, target, equiv;
+ rtx_insn *insns;
rtx libfunc = 0;
bool reversed_p = false;
cmp_mode = targetm.libgcc_cmp_return_mode ();
@@ -4532,7 +4546,8 @@ emit_conditional_move (rtx target, enum rtx_code code, rtx op0, rtx op1,
enum machine_mode cmode, rtx op2, rtx op3,
enum machine_mode mode, int unsignedp)
{
- rtx tem, comparison, last;
+ rtx tem, comparison;
+ rtx_insn *last;
enum insn_code icode;
enum rtx_code reversed;
@@ -4653,7 +4668,8 @@ emit_conditional_add (rtx target, enum rtx_code code, rtx op0, rtx op1,
enum machine_mode cmode, rtx op2, rtx op3,
enum machine_mode mode, int unsignedp)
{
- rtx tem, comparison, last;
+ rtx tem, comparison;
+ rtx_insn *last;
enum insn_code icode;
/* If one operand is constant, make it the second one. Only do this
@@ -4871,7 +4887,7 @@ have_sub2_insn (rtx x, rtx y)
rtx
gen_move_insn (rtx x, rtx y)
{
- rtx seq;
+ rtx_insn *seq;
start_sequence ();
emit_move_insn_1 (x, y);
@@ -5077,7 +5093,7 @@ expand_float (rtx to, rtx from, int unsignedp)
then unconditionally adjust the result. */
if (unsignedp && can_do_signed)
{
- rtx label = gen_label_rtx ();
+ rtx_code_label *label = gen_label_rtx ();
rtx temp;
REAL_VALUE_TYPE offset;
@@ -5101,7 +5117,7 @@ expand_float (rtx to, rtx from, int unsignedp)
< GET_MODE_PRECISION (GET_MODE (from)))
{
rtx temp1;
- rtx neglabel = gen_label_rtx ();
+ rtx_code_label *neglabel = gen_label_rtx ();
/* Don't use TARGET if it isn't a register, is a hard register,
or is the wrong mode. */
@@ -5180,7 +5196,7 @@ expand_float (rtx to, rtx from, int unsignedp)
/* No hardware instruction available; call a library routine. */
{
rtx libfunc;
- rtx insns;
+ rtx_insn *insns;
rtx value;
convert_optab tab = unsignedp ? ufloat_optab : sfloat_optab;
@@ -5246,7 +5262,7 @@ expand_fix (rtx to, rtx from, int unsignedp)
if (icode != CODE_FOR_nothing)
{
- rtx last = get_last_insn ();
+ rtx_insn *last = get_last_insn ();
if (fmode != GET_MODE (from))
from = convert_to_mode (fmode, from, 0);
@@ -5304,7 +5320,9 @@ expand_fix (rtx to, rtx from, int unsignedp)
{
int bitsize;
REAL_VALUE_TYPE offset;
- rtx limit, lab1, lab2, insn;
+ rtx limit;
+ rtx_code_label *lab1, *lab2;
+ rtx_insn *insn;
bitsize = GET_MODE_PRECISION (GET_MODE (to));
real_2expN (&offset, bitsize - 1, fmode);
@@ -5368,7 +5386,7 @@ expand_fix (rtx to, rtx from, int unsignedp)
}
else
{
- rtx insns;
+ rtx_insn *insns;
rtx value;
rtx libfunc;
@@ -5410,7 +5428,8 @@ expand_fixed_convert (rtx to, rtx from, int uintp, int satp)
convert_optab tab;
enum rtx_code this_code;
enum insn_code code;
- rtx insns, value;
+ rtx_insn *insns;
+ rtx value;
rtx libfunc;
if (to_mode == from_mode)
@@ -5473,7 +5492,7 @@ expand_sfix_optab (rtx to, rtx from, convert_optab tab)
icode = convert_optab_handler (tab, imode, fmode);
if (icode != CODE_FOR_nothing)
{
- rtx last = get_last_insn ();
+ rtx_insn *last = get_last_insn ();
if (fmode != GET_MODE (from))
from = convert_to_mode (fmode, from, 0);
@@ -7089,7 +7108,8 @@ static bool
expand_compare_and_swap_loop (rtx mem, rtx old_reg, rtx new_reg, rtx seq)
{
enum machine_mode mode = GET_MODE (mem);
- rtx label, cmp_reg, success, oldval;
+ rtx_code_label *label;
+ rtx cmp_reg, success, oldval;
/* The loop we want to generate looks like
@@ -7169,7 +7189,7 @@ maybe_emit_sync_lock_test_and_set (rtx target, rtx mem, rtx val,
{
enum machine_mode mode = GET_MODE (mem);
enum insn_code icode;
- rtx last_insn = get_last_insn ();
+ rtx_insn *last_insn = get_last_insn ();
icode = optab_handler (sync_lock_test_and_set_optab, mode);
@@ -8083,7 +8103,7 @@ expand_atomic_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code,
/* If nothing else has succeeded, default to a compare and swap loop. */
if (can_compare_and_swap_p (mode, true))
{
- rtx insn;
+ rtx_insn *insn;
rtx t0 = gen_reg_rtx (mode), t1;
start_sequence ();
@@ -8176,7 +8196,7 @@ maybe_legitimize_operand_same_code (enum insn_code icode, unsigned int opno,
if (!(REG_P (addr) && REGNO (addr) > LAST_VIRTUAL_REGISTER)
&& !side_effects_p (addr))
{
- rtx last;
+ rtx_insn *last;
enum machine_mode mode;
last = get_last_insn ();
@@ -8290,7 +8310,7 @@ bool
maybe_legitimize_operands (enum insn_code icode, unsigned int opno,
unsigned int nops, struct expand_operand *ops)
{
- rtx last;
+ rtx_insn *last;
unsigned int i;
last = get_last_insn ();