aboutsummaryrefslogtreecommitdiff
path: root/gcc/reg-stack.c
diff options
context:
space:
mode:
authorMikhail Maltsev <maltsevm@gmail.com>2015-05-19 04:24:31 +0000
committerMikhail Maltsev <miyuki@gcc.gnu.org>2015-05-19 04:24:31 +0000
commitfab27f52895115e2986e7bc6a3c376411f847df7 (patch)
treeeefdc0644e3d1f6b92e84e3b1ced07ac8b856fb6 /gcc/reg-stack.c
parentde7fe0877856955efc5bce5fff364557da958d70 (diff)
downloadgcc-fab27f52895115e2986e7bc6a3c376411f847df7.zip
gcc-fab27f52895115e2986e7bc6a3c376411f847df7.tar.gz
gcc-fab27f52895115e2986e7bc6a3c376411f847df7.tar.bz2
Use std::swap instead of explicit swaps
gcc/ * 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. gcc/c/ * c-typeck.c (build_array_ref): Use std::swap instead of explicit swaps gcc/cp/ * typeck.c (composite_pointer_type): Use std::swap instead of explicit swaps. gcc/c-family/ * c-common.c (shorten_compare): Use std::swap instead of explicit swaps. gcc/fortran/ * 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. From-SVN: r223332
Diffstat (limited to 'gcc/reg-stack.c')
-rw-r--r--gcc/reg-stack.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index c5d52c1..a863700 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -812,7 +812,7 @@ emit_swap_insn (rtx_insn *insn, stack_ptr regstack, rtx reg)
{
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 */
@@ -833,10 +833,7 @@ emit_swap_insn (rtx_insn *insn, stack_ptr regstack, rtx reg)
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. */
@@ -918,7 +915,7 @@ static void
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;
@@ -930,9 +927,7 @@ swap_to_top (rtx_insn *insn, stack_ptr regstack, rtx src1, rtx src2)
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. */
@@ -943,9 +938,7 @@ swap_to_top (rtx_insn *insn, stack_ptr regstack, rtx src1, rtx src2)
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);
@@ -1261,10 +1254,7 @@ compare_for_stack_reg (rtx_insn *insn, stack_ptr regstack, rtx pat_src)
&& 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));
@@ -2139,15 +2129,13 @@ subst_asm_stack_regs (rtx_insn *insn, stack_ptr regstack)
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]);
}
}