From f079167a3064f11a7d8c17ef78389559435bad9d Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 18 Nov 2016 10:04:53 +0000 Subject: Use rtx_mode_t instead of std::make_pair This change makes the code less sensitive to the exact type of the mode, i.e. it forces a conversion where necessary. This becomes important when wrappers like scalar_int_mode and scalar_mode can also be used instead of machine_mode. Using rtx_mode_t also abstracts away the representation. The fact that it's a std::pair rather than a custom class isn't important to users of the interface. gcc/ 2016-11-18 Richard Sandiford Alan Hayward David Sherwood * combine.c (try_combine): Use rtx_mode_t instead of std::make_pair. * dwarf2out.c (mem_loc_descriptor, loc_descriptor): Likewise. (add_const_value_attribute): Likewise. * explow.c (plus_constant): Likewise. * expmed.c (expand_mult, make_tree): Likewise. * expr.c (convert_modes): Likewise. * loop-doloop.c (doloop_optimize): Likewise. * postreload.c (reload_cse_simplify_set): Likewise. * simplify-rtx.c (simplify_const_unary_operation): Likewise. (simplify_binary_operation_1, simplify_const_binary_operation): (simplify_const_relational_operation, simplify_immed_subreg): Likewise. * wide-int.h: Update documentation to recommend rtx_mode_t instead of std::make_pair. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r242586 --- gcc/wide-int.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/wide-int.h') diff --git a/gcc/wide-int.h b/gcc/wide-int.h index f172fae..72f74be 100644 --- a/gcc/wide-int.h +++ b/gcc/wide-int.h @@ -158,10 +158,10 @@ along with GCC; see the file COPYING3. If not see However, a little more syntax is required for rtl constants since they do not have an explicit precision. To make an rtl into a wide_int, you have to pair it with a mode. The canonical way to do - this is with std::make_pair as in: + this is with rtx_mode_t as in: rtx r = ... - wide_int x = std::make_pair (r, mode); + wide_int x = rtx_mode_t (r, mode); Similarly, a wide_int can only be constructed from a host value if the target precision is given explicitly, such as in: -- cgit v1.1