From fab27f52895115e2986e7bc6a3c376411f847df7 Mon Sep 17 00:00:00 2001 From: Mikhail Maltsev Date: Tue, 19 May 2015 04:24:31 +0000 Subject: 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 --- gcc/var-tracking.c | 43 +++++++------------------------------------ 1 file changed, 7 insertions(+), 36 deletions(-) (limited to 'gcc/var-tracking.c') diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 460f6e7..0db4358 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -6509,13 +6509,7 @@ add_with_sets (rtx_insn *insn, struct cselib_set *sets, int n_sets) 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; @@ -6526,13 +6520,7 @@ add_with_sets (rtx_insn *insn, struct cselib_set *sets, int n_sets) 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)) @@ -6568,13 +6556,7 @@ add_with_sets (rtx_insn *insn, struct cselib_set *sets, int n_sets) 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; @@ -6585,13 +6567,7 @@ add_with_sets (rtx_insn *insn, struct cselib_set *sets, int n_sets) 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]); } } @@ -6982,8 +6958,7 @@ vt_find_locations (void) { 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; @@ -7014,12 +6989,8 @@ vt_find_locations (void) 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); -- cgit v1.1