+2015-05-19 Mikhail Maltsev <maltsevm@gmail.com>
+
+ * bb-reorder.c (fix_up_fall_thru_edges): Use std::swap instead of
+ explicit swaps.
+ * dojump.c (do_compare_rtx_and_jump): Likewise.
+ * expmed.c (emit_store_flag_1): Likewise.
+ * fibonacci_heap.h (fibonacci_heap::union_with): Likewise.
+ * final.c (sprint_ul): Use std::reverse for reversing a string.
+ * fold-const.c (extract_muldiv_1): Use std::swap.
+ * genmodes.c (emit_mode_int_n): Likewise.
+ * ifcvt.c (dead_or_predicable): Likewise.
+ * ira-build.c (ira_merge_live_ranges): Likewise.
+ (swap_allocno_copy_ends_if_necessary): Likewise.
+ * ira.c (ira_setup_alts): Likewise.
+ * loop-iv.c (iv_analyze_expr): Likewise.
+ (implies_p): Likewise.
+ (canon_condition): Likewise.
+ * lra-constraints.c (swap_operands): Likewise.
+ * lra-lives.c (lra_merge_live_ranges): Likewise.
+ * omega.c (swap): Remove.
+ (bswap): Remove.
+ (omega_unprotect_1): Use std::swap.
+ (omega_solve_geq): Likewise.
+ * optabs.c (expand_binop_directly): Likewise.
+ (expand_binop): Likewise.
+ (emit_conditional_move): Likewise.
+ (emit_conditional_add): Likewise.
+ * postreload.c (reload_cse_simplify_operands): Likewise.
+ * reg-stack.c (emit_swap_insn): Likewise.
+ (swap_to_top): Likewise.
+ (compare_for_stack_reg): Likewise.
+ (subst_asm_stack_regs): Likewise.
+ * reload.c (find_reloads): Likewise.
+ * reload1.c (gen_reload_chain_without_interm_reg_p): Likewise.
+ * sel-sched.c (invoke_reorder_hooks): Likewise.
+ (create_block_for_bookkeeping): Likewise.
+ * tree-data-ref.c (lambda_matrix_row_exchange): Remove.
+ (lambda_matrix_right_hermite): Use std::swap.
+ * tree-ssa-coalesce.c (sort_coalesce_list): Likewise.
+ * tree-ssa-ifcombine.c (ifcombine_ifandif): Likewise.
+ * tree-ssa-loop-ivopts.c (iv_ca_delta_reverse): Likewise.
+ * tree-ssa-math-opts.c (is_widening_mult_p): Likewise.
+ * tree-ssa-phiopt.c (hoist_adjacent_loads): Likewise.
+ * tree-ssa-reassoc.c (linearize_expr_tree): Likewise.
+ * tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise.
+ * tree-vrp.c (compare_ranges): Likewise.
+ * var-tracking.c (add_with_sets): Likewise.
+ (vt_find_locations): Likewise.
+
2015-05-18 Andreas Tobler <andreast@gcc.gnu.org>
* config/freebsd-spec.h (FBSD_STARTFILE_SPEC): Add the bits to build
edge succ2;
edge fall_thru;
edge cond_jump = NULL;
- edge e;
bool cond_jump_crosses;
int invert_worked;
rtx_insn *old_jump;
fall_thru->flags &= ~EDGE_FALLTHRU;
cond_jump->flags |= EDGE_FALLTHRU;
update_br_prob_note (cur_bb);
- e = fall_thru;
- fall_thru = cond_jump;
- cond_jump = e;
+ std::swap (fall_thru, cond_jump);
cond_jump->flags |= EDGE_CROSSING;
fall_thru->flags &= ~EDGE_CROSSING;
}
+2015-05-19 Mikhail Maltsev <maltsevm@gmail.com>
+
+ * c-common.c (shorten_compare): Use std::swap instead of explicit swaps.
+
2015-05-18 Tom de Vries <tom@codesourcery.com>
* c-common.c (build_va_arg_1): New function.
&& !integer_zerop (primop1) && !real_zerop (primop1)
&& !fixed_zerop (primop1))
{
- tree tem = primop0;
- int temi = unsignedp0;
- primop0 = primop1;
- primop1 = tem;
- tem = op0;
- op0 = op1;
- op1 = tem;
+ std::swap (primop0, primop1);
+ std::swap (op0, op1);
*op0_ptr = op0;
*op1_ptr = op1;
- unsignedp0 = unsignedp1;
- unsignedp1 = temi;
- temi = real1;
- real1 = real2;
- real2 = temi;
+ std::swap (unsignedp0, unsignedp1);
+ std::swap (real1, real2);
switch (code)
{
+2015-05-19 Mikhail Maltsev <maltsevm@gmail.com>
+
+ * c-typeck.c (build_array_ref): Use std::swap instead of explicit
+ swaps
+
2015-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR fortran/44054
/* Allow vector[index] but not index[vector]. */
&& TREE_CODE (TREE_TYPE (array)) != VECTOR_TYPE)
{
- tree temp;
if (TREE_CODE (TREE_TYPE (index)) != ARRAY_TYPE
&& TREE_CODE (TREE_TYPE (index)) != POINTER_TYPE)
{
return error_mark_node;
}
- temp = array;
- array = index;
- index = temp;
+ std::swap (array, index);
swapped = true;
}
+2015-05-19 Mikhail Maltsev <maltsevm@gmail.com>
+
+ * typeck.c (composite_pointer_type): Use std::swap instead of explicit
+ swaps.
+
2015-05-18 Jason Merrill <jason@redhat.com>
* pt.c (retrieve_specialization): Make sure our arguments have
If either type is a pointer to void, make sure it is T1. */
if (TYPE_PTR_P (t2) && VOID_TYPE_P (TREE_TYPE (t2)))
- {
- tree t;
- t = t1;
- t1 = t2;
- t2 = t;
- }
+ std::swap (t1, t2);
/* Now, if T1 is a pointer to void, merge the qualifiers. */
if (TYPE_PTR_P (t1) && VOID_TYPE_P (TREE_TYPE (t1)))
&& ! can_compare_p (code, mode, ccp_jump)
&& can_compare_p (swap_condition (code), mode, ccp_jump))
{
- rtx tmp;
code = swap_condition (code);
- tmp = op0;
- op0 = op1;
- op1 = tmp;
+ std::swap (op0, op1);
}
else if (SCALAR_FLOAT_MODE_P (mode)
&& ! can_compare_p (code, mode, ccp_jump)
machine_mode compare_mode;
enum mode_class mclass;
enum rtx_code scode;
- rtx tem;
if (unsignedp)
code = unsigned_condition (code);
if (swap_commutative_operands_p (op0, op1))
{
- tem = op0;
- op0 = op1;
- op1 = tem;
+ std::swap (op0, op1);
code = swap_condition (code);
}
&& GET_MODE_CLASS (mode) == MODE_INT
&& (!MEM_P (op0) || ! MEM_VOLATILE_P (op0)))
{
+ rtx tem;
if ((code == EQ || code == NE)
&& (op1 == const0_rtx || op1 == constm1_rtx))
{
if (icode != CODE_FOR_nothing)
{
do_pending_stack_adjust ();
- tem = emit_cstore (target, icode, code, mode, compare_mode,
- unsignedp, op0, op1, normalizep, target_mode);
+ rtx tem = emit_cstore (target, icode, code, mode, compare_mode,
+ unsignedp, op0, op1, normalizep, target_mode);
if (tem)
return tem;
{
fibonacci_heap<K,V> *heapa = this;
- fibonacci_node<K,V> *a_root, *b_root, *temp;
+ fibonacci_node<K,V> *a_root, *b_root;
/* If one of the heaps is empty, the union is just the other heap. */
if ((a_root = heapa->m_root) == NULL)
/* Merge them to the next nodes on the opposite chain. */
a_root->m_left->m_right = b_root;
b_root->m_left->m_right = a_root;
- temp = a_root->m_left;
- a_root->m_left = b_root->m_left;
- b_root->m_left = temp;
+ std::swap (a_root->m_left, b_root->m_left);
heapa->m_nodes += heapb->m_nodes;
/* And set the new minimum, if it's changed. */
int
sprint_ul (char *s, unsigned long value)
{
- int len;
- char tmp_c;
- int i;
- int j;
-
- len = sprint_ul_rev (s, value);
+ int len = sprint_ul_rev (s, value);
s[len] = '\0';
- /* Reverse the string. */
- i = 0;
- j = len - 1;
- while (i < j)
- {
- tmp_c = s[i];
- s[i] = s[j];
- s[j] = tmp_c;
- i++; j--;
- }
-
+ std::reverse (s, s + len);
return len;
}
/* If OP1 was not easily negatable, the constant may be OP0. */
if (TREE_CODE (op0) == INTEGER_CST)
{
- tree tem = op0;
- op0 = op1;
- op1 = tem;
- tem = t1;
- t1 = t2;
- t2 = tem;
+ std::swap (op0, op1);
+ std::swap (t1, t2);
}
}
+2015-05-19 Mikhail Maltsev <maltsevm@gmail.com>
+
+ * interface.c (compare_actual_formal): Use std::swap instead of
+ explicit swaps.
+ * trans-array.c (gfc_trans_scalarized_loop_end): Likewise.
+ * trans-intrinsic.c (walk_inline_intrinsic_transpose): Likewise.
+
2015-05-18 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66106
compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
int ranks_must_agree, int is_elemental, locus *where)
{
- gfc_actual_arglist **new_arg, *a, *actual, temp;
+ gfc_actual_arglist **new_arg, *a, *actual;
gfc_formal_arglist *f;
int i, n, na;
unsigned long actual_size, formal_size;
if (na != 0)
{
- temp = *new_arg[0];
- *new_arg[0] = *actual;
- *actual = temp;
-
- a = new_arg[0];
- new_arg[0] = new_arg[na];
- new_arg[na] = a;
+ std::swap (*new_arg[0], *actual);
+ std::swap (new_arg[0], new_arg[na]);
}
for (i = 0; i < n - 1; i++)
loopbody = gfc_finish_block (pbody);
if (reverse_loop)
- {
- tmp = loop->from[n];
- loop->from[n] = loop->to[n];
- loop->to[n] = tmp;
- }
+ std::swap (loop->from[n], loop->to[n]);
/* Initialize the loopvar. */
if (loop->loopvar[n] != loop->from[n])
if (tmp_ss->info->type != GFC_SS_SCALAR
&& tmp_ss->info->type != GFC_SS_REFERENCE)
{
- int tmp_dim;
-
gcc_assert (tmp_ss->dimen == 2);
/* We just invert dimensions. */
- tmp_dim = tmp_ss->dim[0];
- tmp_ss->dim[0] = tmp_ss->dim[1];
- tmp_ss->dim[1] = tmp_dim;
+ std::swap (tmp_ss->dim[0], tmp_ss->dim[1]);
}
/* Stop when tmp_ss points to the last valid element of the chain... */
for (i = 0; i<n_modes - 1; i++)
for (j = i + 1; j < n_modes; j++)
if (mode_sort[i]->int_n > mode_sort[j]->int_n)
- {
- m = mode_sort[i];
- mode_sort[i] = mode_sort[j];
- mode_sort[j] = m;
- }
+ std::swap (mode_sort[i], mode_sort[j]);
for (i = 0; i < n_modes; i ++)
{
redirect_edge_succ (BRANCH_EDGE (test_bb), new_dest);
if (reversep)
{
- gcov_type count, probability;
- count = BRANCH_EDGE (test_bb)->count;
- BRANCH_EDGE (test_bb)->count = FALLTHRU_EDGE (test_bb)->count;
- FALLTHRU_EDGE (test_bb)->count = count;
- probability = BRANCH_EDGE (test_bb)->probability;
- BRANCH_EDGE (test_bb)->probability
- = FALLTHRU_EDGE (test_bb)->probability;
- FALLTHRU_EDGE (test_bb)->probability = probability;
+ std::swap (BRANCH_EDGE (test_bb)->count,
+ FALLTHRU_EDGE (test_bb)->count);
+ std::swap (BRANCH_EDGE (test_bb)->probability,
+ FALLTHRU_EDGE (test_bb)->probability);
update_br_prob_note (test_bb);
}
}
live_range_t
ira_merge_live_ranges (live_range_t r1, live_range_t r2)
{
- live_range_t first, last, temp;
+ live_range_t first, last;
if (r1 == NULL)
return r2;
for (first = last = NULL; r1 != NULL && r2 != NULL;)
{
if (r1->start < r2->start)
- {
- temp = r1;
- r1 = r2;
- r2 = temp;
- }
+ std::swap (r1, r2);
if (r1->start <= r2->finish + 1)
{
/* Intersected ranges: merge r1 and r2 into r1. */
r1->start = r2->start;
if (r1->finish < r2->finish)
r1->finish = r2->finish;
- temp = r2;
+ live_range_t temp = r2;
r2 = r2->next;
ira_finish_live_range (temp);
if (r2 == NULL)
static void
swap_allocno_copy_ends_if_necessary (ira_copy_t cp)
{
- ira_allocno_t temp;
- ira_copy_t temp_cp;
-
if (ALLOCNO_NUM (cp->first) <= ALLOCNO_NUM (cp->second))
return;
- temp = cp->first;
- cp->first = cp->second;
- cp->second = temp;
-
- temp_cp = cp->prev_first_allocno_copy;
- cp->prev_first_allocno_copy = cp->prev_second_allocno_copy;
- cp->prev_second_allocno_copy = temp_cp;
-
- temp_cp = cp->next_first_allocno_copy;
- cp->next_first_allocno_copy = cp->next_second_allocno_copy;
- cp->next_second_allocno_copy = temp_cp;
+ std::swap (cp->first, cp->second);
+ std::swap (cp->prev_first_allocno_copy, cp->prev_second_allocno_copy);
+ std::swap (cp->next_first_allocno_copy, cp->next_second_allocno_copy);
}
/* Create (or update frequency if the copy already exists) and return
int nop, nalt;
bool curr_swapped;
const char *p;
- rtx op;
int commutative = -1;
extract_insn (insn);
{
int c, len;
- op = recog_data.operand[nop];
+ rtx op = recog_data.operand[nop];
p = insn_constraints[nop * recog_data.n_alternatives + nalt];
if (*p == 0 || *p == ',')
continue;
break;
if (curr_swapped)
break;
- op = recog_data.operand[commutative];
- recog_data.operand[commutative] = recog_data.operand[commutative + 1];
- recog_data.operand[commutative + 1] = op;
-
+ std::swap (recog_data.operand[commutative],
+ recog_data.operand[commutative + 1]);
}
}
iv_analyze_expr (rtx_insn *insn, rtx rhs, machine_mode mode,
struct rtx_iv *iv)
{
- rtx mby = NULL_RTX, tmp;
+ rtx mby = NULL_RTX;
rtx op0 = NULL_RTX, op1 = NULL_RTX;
struct rtx_iv iv0, iv1;
enum rtx_code code = GET_CODE (rhs);
op0 = XEXP (rhs, 0);
mby = XEXP (rhs, 1);
if (!CONSTANT_P (mby))
- {
- tmp = op0;
- op0 = mby;
- mby = tmp;
- }
+ std::swap (op0, mby);
if (!CONSTANT_P (mby))
return false;
break;
static bool
implies_p (rtx a, rtx b)
{
- rtx op0, op1, opb0, opb1, r;
+ rtx op0, op1, opb0, opb1;
machine_mode mode;
if (rtx_equal_p (a, b))
|| (GET_CODE (op0) == SUBREG
&& REG_P (SUBREG_REG (op0))))
{
- r = simplify_replace_rtx (b, op0, op1);
+ rtx r = simplify_replace_rtx (b, op0, op1);
if (r == const_true_rtx)
return true;
}
|| (GET_CODE (op1) == SUBREG
&& REG_P (SUBREG_REG (op1))))
{
- r = simplify_replace_rtx (b, op1, op0);
+ rtx r = simplify_replace_rtx (b, op1, op0);
if (r == const_true_rtx)
return true;
}
{
if (GET_CODE (a) == GT)
- {
- r = op0;
- op0 = op1;
- op1 = r;
- }
+ std::swap (op0, op1);
if (GET_CODE (b) == GE)
- {
- r = opb0;
- opb0 = opb1;
- opb1 = r;
- }
+ std::swap (opb0, opb1);
if (SCALAR_INT_MODE_P (mode)
&& rtx_equal_p (op1, opb1)
rtx
canon_condition (rtx cond)
{
- rtx tem;
rtx op0, op1;
enum rtx_code code;
machine_mode mode;
if (swap_commutative_operands_p (op0, op1))
{
code = swap_condition (code);
- tem = op0;
- op0 = op1;
- op1 = tem;
+ std::swap (op0, op1);
}
mode = GET_MODE (op0);
static inline void
swap_operands (int nop)
{
- machine_mode mode = curr_operand_mode[nop];
- curr_operand_mode[nop] = curr_operand_mode[nop + 1];
- curr_operand_mode[nop + 1] = mode;
- mode = original_subreg_reg_mode[nop];
- original_subreg_reg_mode[nop] = original_subreg_reg_mode[nop + 1];
- original_subreg_reg_mode[nop + 1] = mode;
- rtx x = *curr_id->operand_loc[nop];
- *curr_id->operand_loc[nop] = *curr_id->operand_loc[nop + 1];
- *curr_id->operand_loc[nop + 1] = x;
+ std::swap (curr_operand_mode[nop], curr_operand_mode[nop + 1]);
+ std::swap (original_subreg_reg_mode[nop], original_subreg_reg_mode[nop + 1]);
+ std::swap (*curr_id->operand_loc[nop], *curr_id->operand_loc[nop + 1]);
/* Swap the duplicates too. */
lra_update_dup (curr_id, nop);
lra_update_dup (curr_id, nop + 1);
lra_live_range_t
lra_merge_live_ranges (lra_live_range_t r1, lra_live_range_t r2)
{
- lra_live_range_t first, last, temp;
+ lra_live_range_t first, last;
if (r1 == NULL)
return r2;
for (first = last = NULL; r1 != NULL && r2 != NULL;)
{
if (r1->start < r2->start)
- {
- temp = r1;
- r1 = r2;
- r2 = temp;
- }
+ std::swap (r1, r2);
+
if (r1->start == r2->finish + 1)
{
/* Joint ranges: merge r1 and r2 into r1. */
r1->start = r2->start;
- temp = r2;
+ lra_live_range_t temp = r2;
r2 = r2->next;
pool_free (live_range_pool, temp);
}
normalize_omega_problem (pb);
}
-/* Swap values contained in I and J. */
-
-static inline void
-swap (int *i, int *j)
-{
- int tmp;
- tmp = *i;
- *i = *j;
- *j = tmp;
-}
-
-/* Swap values contained in I and J. */
-
-static inline void
-bswap (bool *i, bool *j)
-{
- bool tmp;
- tmp = *i;
- *i = *j;
- *j = tmp;
-}
-
/* Make variable IDX unprotected in PB, by swapping its index at the
PB->safe_vars rank. */
for (e = pb->num_geqs - 1; e >= 0; e--)
{
pb->geqs[e].touched = 1;
- swap (&pb->geqs[e].coef[*idx], &pb->geqs[e].coef[j]);
+ std::swap (pb->geqs[e].coef[*idx], pb->geqs[e].coef[j]);
}
for (e = pb->num_eqs - 1; e >= 0; e--)
- swap (&pb->eqs[e].coef[*idx], &pb->eqs[e].coef[j]);
+ std::swap (pb->eqs[e].coef[*idx], pb->eqs[e].coef[j]);
for (e = pb->num_subs - 1; e >= 0; e--)
- swap (&pb->subs[e].coef[*idx], &pb->subs[e].coef[j]);
+ std::swap (pb->subs[e].coef[*idx], pb->subs[e].coef[j]);
if (unprotect)
- bswap (&unprotect[*idx], &unprotect[j]);
+ std::swap (unprotect[*idx], unprotect[j]);
- swap (&pb->var[*idx], &pb->var[j]);
+ std::swap (pb->var[*idx], pb->var[j]);
pb->forwarding_address[pb->var[*idx]] = *idx;
pb->forwarding_address[pb->var[j]] = j;
(*idx)--;
if (i != n_vars)
{
- int t;
int j = pb->num_vars;
if (dump_file && (dump_flags & TDF_DETAILS))
omega_print_problem (dump_file, pb);
}
- swap (&pb->var[i], &pb->var[j]);
+ std::swap (pb->var[i], pb->var[j]);
for (e = pb->num_geqs - 1; e >= 0; e--)
if (pb->geqs[e].coef[i] != pb->geqs[e].coef[j])
{
pb->geqs[e].touched = 1;
- t = pb->geqs[e].coef[i];
- pb->geqs[e].coef[i] = pb->geqs[e].coef[j];
- pb->geqs[e].coef[j] = t;
+ std::swap (pb->geqs[e].coef[i], pb->geqs[e].coef[j]);
}
for (e = pb->num_subs - 1; e >= 0; e--)
if (pb->subs[e].coef[i] != pb->subs[e].coef[j])
- {
- t = pb->subs[e].coef[i];
- pb->subs[e].coef[i] = pb->subs[e].coef[j];
- pb->subs[e].coef[j] = t;
- }
+ std::swap (pb->subs[e].coef[i], pb->subs[e].coef[j]);
if (dump_file && (dump_flags & TDF_DETAILS))
{
/* Sort array LOWER_BOUND. */
for (j = 0; j < lower_bounds; j++)
{
- int k, smallest = j;
+ int smallest = j;
- for (k = j + 1; k < lower_bounds; k++)
+ for (int k = j + 1; k < lower_bounds; k++)
if (pb->geqs[lower_bound[smallest]].coef[i] >
pb->geqs[lower_bound[k]].coef[i])
smallest = k;
- k = lower_bound[smallest];
- lower_bound[smallest] = lower_bound[j];
- lower_bound[j] = k;
+ std::swap (lower_bound[smallest], lower_bound[j]);
}
if (dump_file && (dump_flags & TDF_DETAILS))
bool commutative_p;
rtx pat;
rtx xop0 = op0, xop1 = op1;
- rtx swap;
/* If it is a commutative operator and the modes would match
if we would swap the operands, we can save the conversions. */
if (commutative_p
&& GET_MODE (xop0) != xmode0 && GET_MODE (xop1) != xmode1
&& GET_MODE (xop0) == xmode1 && GET_MODE (xop1) == xmode1)
- {
- swap = xop0;
- xop0 = xop1;
- xop1 = swap;
- }
+ std::swap (xop0, xop1);
/* If we are optimizing, force expensive constants into a register. */
xop0 = avoid_expensive_constant (xmode0, binoptab, 0, xop0, unsignedp);
Also try to make the last operand a constant. */
if (commutative_p
&& swap_commutative_operands_with_target (target, xop0, xop1))
- {
- swap = xop1;
- xop1 = xop0;
- xop0 = swap;
- }
+ std::swap (xop0, xop1);
/* Now, if insn's predicates don't allow our operands, put them into
pseudo regs. */
Also try to make the last operand a constant. */
if (commutative_optab_p (binoptab)
&& swap_commutative_operands_with_target (target, op0, op1))
- {
- temp = op1;
- op1 = op0;
- op0 = temp;
- }
+ std::swap (op0, op1);
/* These can be done a word at a time. */
if ((binoptab == and_optab || binoptab == ior_optab || binoptab == xor_optab)
machine_mode cmode, rtx op2, rtx op3,
machine_mode mode, int unsignedp)
{
- rtx tem, comparison;
+ rtx comparison;
rtx_insn *last;
enum insn_code icode;
enum rtx_code reversed;
if (swap_commutative_operands_p (op0, op1))
{
- tem = op0;
- op0 = op1;
- op1 = tem;
+ std::swap (op0, op1);
code = swap_condition (code);
}
&& ((reversed = reversed_comparison_code_parts (code, op0, op1, NULL))
!= UNKNOWN))
{
- tem = op2;
- op2 = op3;
- op3 = tem;
+ std::swap (op2, op3);
code = reversed;
}
machine_mode cmode, rtx op2, rtx op3,
machine_mode mode, int unsignedp)
{
- rtx tem, comparison;
+ rtx comparison;
rtx_insn *last;
enum insn_code icode;
if (swap_commutative_operands_p (op0, op1))
{
- tem = op0;
- op0 = op1;
- op1 = tem;
+ std::swap (op0, op1);
code = swap_condition (code);
}
int best = i;
int best_reject = alternative_reject[alternative_order[i]];
int best_nregs = alternative_nregs[alternative_order[i]];
- int tmp;
for (j = i + 1; j < recog_data.n_alternatives; j++)
{
}
}
- tmp = alternative_order[best];
- alternative_order[best] = alternative_order[i];
- alternative_order[i] = tmp;
+ std::swap (alternative_order[best], alternative_order[i]);
}
/* Substitute the operands as determined by op_alt_regno for the best
{
int hard_regno;
rtx swap_rtx;
- int tmp, other_reg; /* swap regno temps */
+ int other_reg; /* swap regno temps */
rtx_insn *i1; /* the stack-reg insn prior to INSN */
rtx i1set = NULL_RTX; /* the SET rtx within I1 */
gcc_assert (hard_regno >= FIRST_STACK_REG);
other_reg = regstack->top - (hard_regno - FIRST_STACK_REG);
-
- tmp = regstack->reg[other_reg];
- regstack->reg[other_reg] = regstack->reg[regstack->top];
- regstack->reg[regstack->top] = tmp;
+ std::swap (regstack->reg[regstack->top], regstack->reg[other_reg]);
/* Find the previous insn involving stack regs, but don't pass a
block boundary. */
swap_to_top (rtx_insn *insn, stack_ptr regstack, rtx src1, rtx src2)
{
struct stack_def temp_stack;
- int regno, j, k, temp;
+ int regno, j, k;
temp_stack = *regstack;
k = temp_stack.top - (regno - FIRST_STACK_REG);
j = temp_stack.top;
- temp = temp_stack.reg[k];
- temp_stack.reg[k] = temp_stack.reg[j];
- temp_stack.reg[j] = temp;
+ std::swap (temp_stack.reg[j], temp_stack.reg[k]);
}
/* Place operand 2 next on the stack. */
k = temp_stack.top - (regno - FIRST_STACK_REG);
j = temp_stack.top - 1;
- temp = temp_stack.reg[k];
- temp_stack.reg[k] = temp_stack.reg[j];
- temp_stack.reg[j] = temp;
+ std::swap (temp_stack.reg[j], temp_stack.reg[k]);
}
change_stack (insn, regstack, &temp_stack, EMIT_BEFORE);
&& get_hard_regnum (regstack, *src2) == FIRST_STACK_REG))
&& swap_rtx_condition (insn))
{
- rtx temp;
- temp = XEXP (pat_src, 0);
- XEXP (pat_src, 0) = XEXP (pat_src, 1);
- XEXP (pat_src, 1) = temp;
+ std::swap (XEXP (pat_src, 0), XEXP (pat_src, 1));
src1 = get_true_reg (&XEXP (pat_src, 0));
src2 = get_true_reg (&XEXP (pat_src, 1));
it and swap it with whatever is already in I's place.
K is where recog_data.operand[i] is now. J is where it
should be. */
- int j, k, temp;
+ int j, k;
k = temp_stack.top - (regno - FIRST_STACK_REG);
j = (temp_stack.top
- (REGNO (recog_data.operand[i]) - FIRST_STACK_REG));
- temp = temp_stack.reg[k];
- temp_stack.reg[k] = temp_stack.reg[j];
- temp_stack.reg[j] = temp;
+ std::swap (temp_stack.reg[j], temp_stack.reg[k]);
}
}
if (swapped)
{
- enum reg_class tclass;
- int t;
-
recog_data.operand[commutative] = substed_operand[commutative + 1];
recog_data.operand[commutative + 1] = substed_operand[commutative];
/* Swap the duplicates too. */
*recog_data.dup_loc[i]
= recog_data.operand[(int) recog_data.dup_num[i]];
- tclass = preferred_class[commutative];
- preferred_class[commutative] = preferred_class[commutative + 1];
- preferred_class[commutative + 1] = tclass;
-
- t = pref_or_nothing[commutative];
- pref_or_nothing[commutative] = pref_or_nothing[commutative + 1];
- pref_or_nothing[commutative + 1] = t;
-
- t = address_reloaded[commutative];
- address_reloaded[commutative] = address_reloaded[commutative + 1];
- address_reloaded[commutative + 1] = t;
+ std::swap (preferred_class[commutative],
+ preferred_class[commutative + 1]);
+ std::swap (pref_or_nothing[commutative],
+ pref_or_nothing[commutative + 1]);
+ std::swap (address_reloaded[commutative],
+ address_reloaded[commutative + 1]);
}
this_earlyclobber = 0;
if (swapped)
{
- enum reg_class tclass;
- int t;
-
/* If the commutative operands have been swapped, swap
them back in order to check the next alternative. */
recog_data.operand[commutative] = substed_operand[commutative];
= recog_data.operand[(int) recog_data.dup_num[i]];
/* Unswap the operand related information as well. */
- tclass = preferred_class[commutative];
- preferred_class[commutative] = preferred_class[commutative + 1];
- preferred_class[commutative + 1] = tclass;
-
- t = pref_or_nothing[commutative];
- pref_or_nothing[commutative] = pref_or_nothing[commutative + 1];
- pref_or_nothing[commutative + 1] = t;
-
- t = address_reloaded[commutative];
- address_reloaded[commutative] = address_reloaded[commutative + 1];
- address_reloaded[commutative + 1] = t;
+ std::swap (preferred_class[commutative],
+ preferred_class[commutative + 1]);
+ std::swap (pref_or_nothing[commutative],
+ pref_or_nothing[commutative + 1]);
+ std::swap (address_reloaded[commutative],
+ address_reloaded[commutative + 1]);
}
}
}
if (goal_alternative_swapped)
{
- rtx tem;
-
- tem = substed_operand[commutative];
- substed_operand[commutative] = substed_operand[commutative + 1];
- substed_operand[commutative + 1] = tem;
- tem = recog_data.operand[commutative];
- recog_data.operand[commutative] = recog_data.operand[commutative + 1];
- recog_data.operand[commutative + 1] = tem;
- tem = *recog_data.operand_loc[commutative];
- *recog_data.operand_loc[commutative]
- = *recog_data.operand_loc[commutative + 1];
- *recog_data.operand_loc[commutative + 1] = tem;
+ std::swap (substed_operand[commutative],
+ substed_operand[commutative + 1]);
+ std::swap (recog_data.operand[commutative],
+ recog_data.operand[commutative + 1]);
+ std::swap (*recog_data.operand_loc[commutative],
+ *recog_data.operand_loc[commutative + 1]);
for (i = 0; i < n_reloads; i++)
{
/* Assume other cases in gen_reload are not possible for
chain reloads or do need an intermediate hard registers. */
bool result = true;
- int regno, n, code;
+ int regno, code;
rtx out, in;
rtx_insn *insn;
rtx_insn *last = get_last_insn ();
/* Make r2 a component of r1. */
if (reg_mentioned_p (rld[r1].in, rld[r2].in))
- {
- n = r1;
- r1 = r2;
- r2 = n;
- }
+ std::swap (r1, r2);
+
gcc_assert (reg_mentioned_p (rld[r2].in, rld[r1].in));
regno = rld[r1].regno >= 0 ? rld[r1].regno : rld[r2].regno;
gcc_assert (regno >= 0);
for (i = 0, n = ready.n_ready; i < n; i++)
if (EXPR_INSN_RTX (vec[i]) != arr[i])
{
- expr_t tmp;
-
for (j = i; j < n; j++)
if (EXPR_INSN_RTX (vec[j]) == arr[i])
break;
gcc_assert (j < n);
- tmp = vec[i];
- vec[i] = vec[j];
- vec[j] = tmp;
+ std::swap (vec[i], vec[j]);
}
}
{
sel_global_bb_info_def gbi;
sel_region_bb_info_def rbi;
- int i;
if (sched_verbose >= 2)
sel_print ("Swapping block ids %i and %i\n",
new_bb->index, succ->index);
- i = new_bb->index;
- new_bb->index = succ->index;
- succ->index = i;
+ std::swap (new_bb->index, succ->index);
SET_BASIC_BLOCK_FOR_FN (cfun, new_bb->index, new_bb);
SET_BASIC_BLOCK_FOR_FN (cfun, succ->index, succ);
sizeof (rbi));
memcpy (SEL_REGION_BB_INFO (succ), &rbi, sizeof (rbi));
- i = BLOCK_TO_BB (new_bb->index);
- BLOCK_TO_BB (new_bb->index) = BLOCK_TO_BB (succ->index);
- BLOCK_TO_BB (succ->index) = i;
+ std::swap (BLOCK_TO_BB (new_bb->index),
+ BLOCK_TO_BB (succ->index));
- i = CONTAINING_RGN (new_bb->index);
- CONTAINING_RGN (new_bb->index) = CONTAINING_RGN (succ->index);
- CONTAINING_RGN (succ->index) = i;
+ std::swap (CONTAINING_RGN (new_bb->index),
+ CONTAINING_RGN (succ->index));
- for (i = 0; i < current_nr_blocks; i++)
+ for (int i = 0; i < current_nr_blocks; i++)
if (BB_TO_BLOCK (i) == succ->index)
BB_TO_BLOCK (i) = new_bb->index;
else if (BB_TO_BLOCK (i) == new_bb->index)
CODE_LABEL_NUMBER (BB_HEAD (new_bb)),
CODE_LABEL_NUMBER (BB_HEAD (succ)));
- i = CODE_LABEL_NUMBER (BB_HEAD (new_bb));
- CODE_LABEL_NUMBER (BB_HEAD (new_bb))
- = CODE_LABEL_NUMBER (BB_HEAD (succ));
- CODE_LABEL_NUMBER (BB_HEAD (succ)) = i;
+ std::swap (CODE_LABEL_NUMBER (BB_HEAD (new_bb)),
+ CODE_LABEL_NUMBER (BB_HEAD (succ)));
}
}
}
mat[r2][i] += const1 * mat[r1][i];
}
-/* Swap rows R1 and R2 in matrix MAT. */
-
-static void
-lambda_matrix_row_exchange (lambda_matrix mat, int r1, int r2)
-{
- lambda_vector row;
-
- row = mat[r1];
- mat[r1] = mat[r2];
- mat[r2] = row;
-}
-
/* Multiply vector VEC1 of length SIZE by a constant CONST1,
and store the result in VEC2. */
factor = sigma * (a / b);
lambda_matrix_row_add (S, n, i, i-1, -factor);
- lambda_matrix_row_exchange (S, i, i-1);
+ std::swap (S[i], S[i-1]);
lambda_matrix_row_add (U, m, i, i-1, -factor);
- lambda_matrix_row_exchange (U, i, i-1);
+ std::swap (U[i], U[i-1]);
}
}
}
if (num == 2)
{
if (cl->sorted[0]->cost > cl->sorted[1]->cost)
- {
- p = cl->sorted[0];
- cl->sorted[0] = cl->sorted[1];
- cl->sorted[1] = p;
- }
+ std::swap (cl->sorted[0], cl->sorted[1]);
return;
}
- /* Only call qsort if there are more than 2 items. */
+ /* Only call qsort if there are more than 2 items.
+ ??? Maybe std::sort will do better, provided that compare_pairs
+ can be inlined. */
if (num > 2)
qsort (cl->sorted, num, sizeof (coalesce_pair_p), compare_pairs);
}
;
else if (bits1 == bits2)
{
- t = name2;
- name2 = bits2;
- bits2 = t;
- t = name1;
- name1 = bits1;
- bits1 = t;
+ std::swap (name2, bits2);
+ std::swap (name1, bits1);
}
else if (name1 == bits2)
- {
- t = name2;
- name2 = bits2;
- bits2 = t;
- }
+ std::swap (name2, bits2);
else if (bits1 == name2)
- {
- t = name1;
- name1 = bits1;
- bits1 = t;
- }
+ std::swap (name1, bits1);
else
return false;
iv_ca_delta_reverse (struct iv_ca_delta *delta)
{
struct iv_ca_delta *act, *next, *prev = NULL;
- struct cost_pair *tmp;
for (act = delta; act; act = next)
{
act->next_change = prev;
prev = act;
- tmp = act->old_cp;
- act->old_cp = act->new_cp;
- act->new_cp = tmp;
+ std::swap (act->old_cp, act->new_cp);
}
return prev;
/* Ensure that the larger of the two operands comes first. */
if (TYPE_PRECISION (*type1_out) < TYPE_PRECISION (*type2_out))
{
- tree tmp;
- tmp = *type1_out;
- *type1_out = *type2_out;
- *type2_out = tmp;
- tmp = *rhs1_out;
- *rhs1_out = *rhs2_out;
- *rhs2_out = tmp;
+ std::swap (*type1_out, *type2_out);
+ std::swap (*rhs1_out, *rhs2_out);
}
return true;
for (gsi = gsi_start_phis (bb3); !gsi_end_p (gsi); gsi_next (&gsi))
{
gphi *phi_stmt = gsi.phi ();
- gimple def1, def2, defswap;
- tree arg1, arg2, ref1, ref2, field1, field2, fieldswap;
+ gimple def1, def2;
+ tree arg1, arg2, ref1, ref2, field1, field2;
tree tree_offset1, tree_offset2, tree_size2, next;
int offset1, offset2, size2;
unsigned align1;
if (next != field1)
continue;
- fieldswap = field1;
- field1 = field2;
- field2 = fieldswap;
- defswap = def1;
- def1 = def2;
- def2 = defswap;
+ std::swap (field1, field2);
+ std::swap (def1, def2);
}
bb_for_def1 = gimple_bb (def1);
if (!binlhsisreassoc)
{
- tree temp;
-
/* If this is not a associative operation like division, give up. */
if (!is_associative)
{
/* We want to make it so the lhs is always the reassociative op,
so swap. */
- temp = binlhs;
- binlhs = binrhs;
- binrhs = temp;
+ std::swap (binlhs, binrhs);
}
else if (binrhsisreassoc)
{
miss threading opportunities. */
if (tree_swap_operands_p (op0, op1, false))
{
- tree tmp;
cond_code = swap_tree_comparison (cond_code);
- tmp = op0;
- op0 = op1;
- op1 = tmp;
+ std::swap (op0, op1);
}
/* Stuff the operator and operands into our dummy conditional
operands around and change the comparison code. */
if (comp == GT_EXPR || comp == GE_EXPR)
{
- value_range_t *tmp;
comp = (comp == GT_EXPR) ? LT_EXPR : LE_EXPR;
- tmp = vr0;
- vr0 = vr1;
- vr1 = tmp;
+ std::swap (vr0, vr1);
}
if (comp == EQ_EXPR)
while (n1 < n2 && mos[n2].type != MO_USE)
n2--;
if (n1 < n2)
- {
- micro_operation sw;
-
- sw = mos[n1];
- mos[n1] = mos[n2];
- mos[n2] = sw;
- }
+ std::swap (mos[n1], mos[n2]);
}
n2 = VTI (bb)->mos.length () - 1;
while (n1 < n2 && mos[n2].type == MO_VAL_LOC)
n2--;
if (n1 < n2)
- {
- micro_operation sw;
-
- sw = mos[n1];
- mos[n1] = mos[n2];
- mos[n2] = sw;
- }
+ std::swap (mos[n1], mos[n2]);
}
if (CALL_P (insn))
while (n1 < n2 && mos[n2].type != MO_VAL_USE)
n2--;
if (n1 < n2)
- {
- micro_operation sw;
-
- sw = mos[n1];
- mos[n1] = mos[n2];
- mos[n2] = sw;
- }
+ std::swap (mos[n1], mos[n2]);
}
n2 = VTI (bb)->mos.length () - 1;
while (n1 < n2 && mos[n2].type != MO_CLOBBER)
n2--;
if (n1 < n2)
- {
- micro_operation sw;
-
- sw = mos[n1];
- mos[n1] = mos[n2];
- mos[n2] = sw;
- }
+ std::swap (mos[n1], mos[n2]);
}
}
{
bb_heap_t *worklist = new bb_heap_t (LONG_MIN);
bb_heap_t *pending = new bb_heap_t (LONG_MIN);
- bb_heap_t *fibheap_swap = NULL;
- sbitmap visited, in_worklist, in_pending, sbitmap_swap;
+ sbitmap visited, in_worklist, in_pending;
basic_block bb;
edge e;
int *bb_order;
while (success && !pending->empty ())
{
- fibheap_swap = pending;
- pending = worklist;
- worklist = fibheap_swap;
- sbitmap_swap = in_pending;
- in_pending = in_worklist;
- in_worklist = sbitmap_swap;
+ std::swap (worklist, pending);
+ std::swap (in_worklist, in_pending);
bitmap_clear (visited);