From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1130) id 125863858C50; Fri, 29 Sep 2023 16:55:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 125863858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696006522; bh=BcNWjl0O9K0VRdlXEo1RLbykGmUoCMmPL7M3RZcDdg8=; h=From:To:Subject:Date:From; b=cKuSMx9nJVXuRIMI06gw044FybMXhE+M6PLi4/tn51UC5Gt2ALUe02dZvwhjWA9Gv a5/oByQ9RTnc2Yrtj0Uvx6Qw1t/0knN7G0v+s7sAye6cUH4T2gIa65bGpl3T2URmdy I65dwS4HTv/bp8AlYcew43b/7uBkpbUynTsyEKnE= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Sandiford To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-4339] Remove poly_int_pod X-Act-Checkin: gcc X-Git-Author: Richard Sandiford X-Git-Refname: refs/heads/trunk X-Git-Oldrev: 94e68ce96c285e479736851f1ad8cc87c8c3ff0c X-Git-Newrev: eaa41a6dc127d8d8a38646aaadc37681691fc311 Message-Id: <20230929165522.125863858C50@sourceware.org> Date: Fri, 29 Sep 2023 16:55:22 +0000 (GMT) List-Id: https://gcc.gnu.org/g:eaa41a6dc127d8d8a38646aaadc37681691fc311 commit r14-4339-geaa41a6dc127d8d8a38646aaadc37681691fc311 Author: Richard Sandiford Date: Fri Sep 29 17:55:12 2023 +0100 Remove poly_int_pod poly_int was written before the switch to C++11 and so couldn't use explicit default constructors. This led to an awkward split between poly_int_pod and poly_int. poly_int simply inherited from poly_int_pod and added constructors, with the argumentless constructor having an empty body. But inheritance meant that poly_int had to repeat the assignment operators from poly_int_pod (again, no C++11, so no "using" to inherit base-class implementations). All that goes away if we switch to using default constructors. The main complication is ensuring that braced initialisation still gives a constexpr, so that static variables can be initialised without runtime code. The two problems here are: (1) When initialising a poly_int with fewer than N coefficients, the other coefficients need to be a zero of the same precision as the explicit coefficients. This was previously done in a for loop using wi::ints_for<...>::zero, but C++11 constexpr constructors can't have function bodies. The patch instead uses a series of delegated initialisers to fill in the implicit coefficients. (2) The initialisation in: void f(int x) { unsigned int foo {x}; } produces the warning: warning: narrowing conversion of 'x' from 'int' to 'unsigned int' [-Wnarrowing] whereas: void f(int x) { unsigned int foo = x; } does not. So switching to direct initialisation of the coeffs array would mean that: poly_uin64_t x = 0; would trigger a warning for using 0 rather than 0u. That seemed overly pedantic, so the patch adds explicit casts to the constructor. The complication is to do that without adding extra code to wide-int versions. The patch uses a new init_cast type for that. gcc/ * poly-int.h (poly_int_pod): Delete. (poly_coeff_traits::init_cast): New type. (poly_int_full, poly_int_hungry, poly_int_fullness): New structures. (poly_int): Replace constructors that take 1 and 2 coefficients with a general one that takes an arbitrary number of coefficients. Delegate initialization to two new private constructors, one of which uses the coefficients as-is and one of which adds an extra zero of the appropriate type (and precision, where applicable). (gt_ggc_mx, gt_pch_nx): Operate on poly_ints rather than poly_int_pods. * poly-int-types.h (poly_uint16_pod, poly_int64_pod, poly_uint64_pod) (poly_offset_int_pod, poly_wide_int_pod, poly_widest_int_pod): Delete. * gengtype.cc (main): Don't register poly_int64_pod. * calls.cc (initialize_argument_information): Use poly_int rather than poly_int_pod. (combine_pending_stack_adjustment_and_call): Likewise. * config/aarch64/aarch64.cc (pure_scalable_type_info): Likewise. * data-streamer.h (bp_unpack_poly_value): Likewise. * dwarf2cfi.cc (struct dw_trace_info): Likewise. (struct queued_reg_save): Likewise. * dwarf2out.h (struct dw_cfa_location): Likewise. * emit-rtl.h (struct incoming_args): Likewise. (struct rtl_data): Likewise. * expr.cc (get_bit_range): Likewise. (get_inner_reference): Likewise. * expr.h (get_bit_range): Likewise. * fold-const.cc (split_address_to_core_and_offset): Likewise. (ptr_difference_const): Likewise. * fold-const.h (ptr_difference_const): Likewise. * function.cc (try_fit_stack_local): Likewise. (instantiate_new_reg): Likewise. * function.h (struct expr_status): Likewise. (struct args_size): Likewise. * genmodes.cc (ZERO_COEFFS): Likewise. (mode_size_inline): Likewise. (mode_nunits_inline): Likewise. (emit_mode_precision): Likewise. (emit_mode_size): Likewise. (emit_mode_nunits): Likewise. * gimple-fold.cc (get_base_constructor): Likewise. * gimple-ssa-store-merging.cc (struct symbolic_number): Likewise. * inchash.h (class hash): Likewise. * ipa-modref-tree.cc (modref_access_node::dump): Likewise. * ipa-modref.cc (modref_access_analysis::merge_call_side_effects): Likewise. * ira-int.h (ira_spilled_reg_stack_slot): Likewise. * lra-eliminations.cc (self_elim_offsets): Likewise. * machmode.h (mode_size, mode_precision, mode_nunits): Likewise. * omp-low.cc (omplow_simd_context): Likewise. * pretty-print.cc (pp_wide_integer): Likewise. * pretty-print.h (pp_wide_integer): Likewise. * reload.cc (struct decomposition): Likewise. * reload.h (struct reload): Likewise. * reload1.cc (spill_stack_slot_width): Likewise. (struct elim_table): Likewise. (offsets_at): Likewise. (init_eliminable_invariants): Likewise. * rtl.h (union rtunion): Likewise. (poly_int_rtx_p): Likewise. (strip_offset): Likewise. (strip_offset_and_add): Likewise. * rtlanal.cc (strip_offset): Likewise. * tree-dfa.cc (get_ref_base_and_extent): Likewise. (get_addr_base_and_unit_offset_1): Likewise. (get_addr_base_and_unit_offset): Likewise. * tree-dfa.h (get_ref_base_and_extent): Likewise. (get_addr_base_and_unit_offset_1): Likewise. (get_addr_base_and_unit_offset): Likewise. * tree-ssa-loop-ivopts.cc (struct iv_use): Likewise. (strip_offset): Likewise. * tree-ssa-sccvn.h (struct vn_reference_op_struct): Likewise. * tree.cc (ptrdiff_tree_p): Likewise. * tree.h (poly_int_tree_p): Likewise. (ptrdiff_tree_p): Likewise. (get_inner_reference): Likewise. gcc/testsuite/ * gcc.dg/plugin/poly-int-tests.h (test_num_coeffs_extra): Use poly_int rather than poly_int_pod. Diff: --- gcc/calls.cc | 4 +- gcc/config/aarch64/aarch64.cc | 2 +- gcc/data-streamer.h | 2 +- gcc/dwarf2cfi.cc | 6 +- gcc/dwarf2out.h | 4 +- gcc/emit-rtl.h | 8 +- gcc/expr.cc | 8 +- gcc/expr.h | 4 +- gcc/fold-const.cc | 4 +- gcc/fold-const.h | 2 +- gcc/function.cc | 4 +- gcc/function.h | 6 +- gcc/gengtype.cc | 1 - gcc/genmodes.cc | 12 +- gcc/gimple-fold.cc | 2 +- gcc/gimple-ssa-store-merging.cc | 2 +- gcc/inchash.h | 4 +- gcc/ipa-modref-tree.cc | 8 +- gcc/ipa-modref.cc | 4 +- gcc/ira-int.h | 2 +- gcc/lra-eliminations.cc | 2 +- gcc/machmode.h | 6 +- gcc/omp-low.cc | 2 +- gcc/poly-int-types.h | 8 - gcc/poly-int.h | 570 +++++++++++---------------- gcc/pretty-print.cc | 8 +- gcc/pretty-print.h | 2 +- gcc/reload.cc | 4 +- gcc/reload.h | 2 +- gcc/reload1.cc | 12 +- gcc/rtl.h | 8 +- gcc/rtlanal.cc | 2 +- gcc/testsuite/gcc.dg/plugin/poly-int-tests.h | 6 +- gcc/tree-dfa.cc | 10 +- gcc/tree-dfa.h | 8 +- gcc/tree-ssa-loop-ivopts.cc | 4 +- gcc/tree-ssa-sccvn.h | 2 +- gcc/tree.cc | 2 +- gcc/tree.h | 8 +- 39 files changed, 326 insertions(+), 429 deletions(-) diff --git a/gcc/calls.cc b/gcc/calls.cc index 1f3a6d5c450..e9e69517997 100644 --- a/gcc/calls.cc +++ b/gcc/calls.cc @@ -1291,7 +1291,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, cumulative_args_t args_so_far, int reg_parm_stack_space, rtx *old_stack_level, - poly_int64_pod *old_pending_adj, + poly_int64 *old_pending_adj, bool *must_preallocate, int *ecf_flags, bool *may_tailcall, bool call_from_thunk_p) { @@ -2298,7 +2298,7 @@ load_register_parameters (struct arg_data *args, int num_actuals, bytes that should be popped after the call. */ static bool -combine_pending_stack_adjustment_and_call (poly_int64_pod *adjustment_out, +combine_pending_stack_adjustment_and_call (poly_int64 *adjustment_out, poly_int64 unadjusted_args_size, struct args_size *args_size, unsigned int preferred_unit_stack_boundary) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index dcded70c981..9fbfc548a89 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -257,7 +257,7 @@ public: machine_mode orig_mode; /* The offset in bytes of the piece from the start of the type. */ - poly_uint64_pod offset; + poly_uint64 offset; }; /* Divides types analyzed as IS_PST into individual pieces. The pieces diff --git a/gcc/data-streamer.h b/gcc/data-streamer.h index 7e69eb9992b..c2b9a8d8b2c 100644 --- a/gcc/data-streamer.h +++ b/gcc/data-streamer.h @@ -199,7 +199,7 @@ bp_unpack_value (struct bitpack_d *bp, unsigned nbits) inline poly_int bp_unpack_poly_value (struct bitpack_d *bp, unsigned nbits) { - poly_int_pod x; + poly_int x; for (int i = 0; i < NUM_POLY_INT_COEFFS; ++i) x.coeffs[i] = bp_unpack_value (bp, nbits); return x; diff --git a/gcc/dwarf2cfi.cc b/gcc/dwarf2cfi.cc index f1777c0a4cf..d52088b3e72 100644 --- a/gcc/dwarf2cfi.cc +++ b/gcc/dwarf2cfi.cc @@ -112,8 +112,8 @@ struct dw_trace_info while scanning insns. However, the args_size value is irrelevant at any point except can_throw_internal_p insns. Therefore the "delay" sizes the values that must actually be emitted for this trace. */ - poly_int64_pod beg_true_args_size, end_true_args_size; - poly_int64_pod beg_delay_args_size, end_delay_args_size; + poly_int64 beg_true_args_size, end_true_args_size; + poly_int64 beg_delay_args_size, end_delay_args_size; /* The first EH insn in the trace, where beg_delay_args_size must be set. */ rtx_insn *eh_head; @@ -219,7 +219,7 @@ static dw_cfa_location *cur_cfa; struct queued_reg_save { rtx reg; rtx saved_reg; - poly_int64_pod cfa_offset; + poly_int64 cfa_offset; }; diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h index 61a996050ff..05ae0d7f34e 100644 --- a/gcc/dwarf2out.h +++ b/gcc/dwarf2out.h @@ -158,8 +158,8 @@ struct GTY(()) cfa_reg { Instead of passing around REG and OFFSET, we pass a copy of this structure. */ struct GTY(()) dw_cfa_location { - poly_int64_pod offset; - poly_int64_pod base_offset; + poly_int64 offset; + poly_int64 base_offset; /* REG is in DWARF_FRAME_REGNUM space, *not* normal REGNO space. */ struct cfa_reg reg; BOOL_BITFIELD indirect : 1; /* 1 if CFA is accessed via a dereference. */ diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h index af62f21f1d5..c11a6f3eb62 100644 --- a/gcc/emit-rtl.h +++ b/gcc/emit-rtl.h @@ -30,12 +30,12 @@ struct GTY(()) incoming_args { /* Number of bytes of args popped by function being compiled on its return. Zero if no bytes are to be popped. May affect compilation of return insn or of function epilogue. */ - poly_int64_pod pops_args; + poly_int64 pops_args; /* If function's args have a fixed size, this is that size, in bytes. Otherwise, it is -1. May affect compilation of return insn or of function epilogue. */ - poly_int64_pod size; + poly_int64 size; /* # bytes the prologue should push and pretend that the caller pushed them. The prologue must do this, but only if parms can be passed in @@ -80,7 +80,7 @@ struct GTY(()) rtl_data { /* # of bytes of outgoing arguments. If ACCUMULATE_OUTGOING_ARGS is defined, the needed space is pushed by the prologue. */ - poly_int64_pod outgoing_args_size; + poly_int64 outgoing_args_size; /* If nonzero, an RTL expression for the location at which the current function returns its result. If the current function returns its @@ -139,7 +139,7 @@ struct GTY(()) rtl_data { /* Offset to end of allocated area of stack frame. If stack grows down, this is the address of the last stack slot allocated. If stack grows up, this is the address for the next slot. */ - poly_int64_pod x_frame_offset; + poly_int64 x_frame_offset; /* Insn after which register parms and SAVE_EXPRs are born, if nonopt. */ rtx_insn *x_parm_birth_insn; diff --git a/gcc/expr.cc b/gcc/expr.cc index 2c9930ec674..4220cbd9f8f 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -5438,8 +5438,8 @@ optimize_bitfield_assignment_op (poly_uint64 pbitsize, *BITSTART and *BITEND. */ void -get_bit_range (poly_uint64_pod *bitstart, poly_uint64_pod *bitend, tree exp, - poly_int64_pod *bitpos, tree *offset) +get_bit_range (poly_uint64 *bitstart, poly_uint64 *bitend, tree exp, + poly_int64 *bitpos, tree *offset) { poly_int64 bitoffset; tree field, repr; @@ -7881,8 +7881,8 @@ store_field (rtx target, poly_int64 bitsize, poly_int64 bitpos, this case, but the address of the object can be found. */ tree -get_inner_reference (tree exp, poly_int64_pod *pbitsize, - poly_int64_pod *pbitpos, tree *poffset, +get_inner_reference (tree exp, poly_int64 *pbitsize, + poly_int64 *pbitpos, tree *poffset, machine_mode *pmode, int *punsignedp, int *preversep, int *pvolatilep) { diff --git a/gcc/expr.h b/gcc/expr.h index 11bff531862..2a172867fdb 100644 --- a/gcc/expr.h +++ b/gcc/expr.h @@ -275,8 +275,8 @@ extern bool emit_push_insn (rtx, machine_mode, tree, rtx, unsigned int, int, rtx, poly_int64, rtx, rtx, int, rtx, bool); /* Extract the accessible bit-range from a COMPONENT_REF. */ -extern void get_bit_range (poly_uint64_pod *, poly_uint64_pod *, tree, - poly_int64_pod *, tree *); +extern void get_bit_range (poly_uint64 *, poly_uint64 *, tree, + poly_int64 *, tree *); /* Expand an assignment that stores the value of FROM into TO. */ extern void expand_assignment (tree, tree, bool); diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index c5ac82200c8..4f8561509ff 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -16564,7 +16564,7 @@ round_down_loc (location_t loc, tree value, int divisor) static tree split_address_to_core_and_offset (tree exp, - poly_int64_pod *pbitpos, tree *poffset) + poly_int64 *pbitpos, tree *poffset) { tree core; machine_mode mode; @@ -16614,7 +16614,7 @@ split_address_to_core_and_offset (tree exp, otherwise. If they do, E1 - E2 is stored in *DIFF. */ bool -ptr_difference_const (tree e1, tree e2, poly_int64_pod *diff) +ptr_difference_const (tree e1, tree e2, poly_int64 *diff) { tree core1, core2; poly_int64 bitpos1, bitpos2; diff --git a/gcc/fold-const.h b/gcc/fold-const.h index 3d08528a20c..50f901d6e1f 100644 --- a/gcc/fold-const.h +++ b/gcc/fold-const.h @@ -151,7 +151,7 @@ extern tree div_if_zero_remainder (const_tree, const_tree); extern bool tree_swap_operands_p (const_tree, const_tree); extern enum tree_code swap_tree_comparison (enum tree_code); -extern bool ptr_difference_const (tree, tree, poly_int64_pod *); +extern bool ptr_difference_const (tree, tree, poly_int64 *); extern enum tree_code invert_tree_comparison (enum tree_code, bool); extern bool inverse_conditions_p (const_tree, const_tree); diff --git a/gcc/function.cc b/gcc/function.cc index e92384a8907..336af28fb22 100644 --- a/gcc/function.cc +++ b/gcc/function.cc @@ -300,7 +300,7 @@ get_stack_local_alignment (tree type, machine_mode mode) static bool try_fit_stack_local (poly_int64 start, poly_int64 length, poly_int64 size, unsigned int alignment, - poly_int64_pod *poffset) + poly_int64 *poffset) { poly_int64 this_frame_offset; int frame_off, frame_alignment, frame_phase; @@ -1431,7 +1431,7 @@ static poly_int64 cfa_offset; offset indirectly through the pointer. Otherwise, return 0. */ static rtx -instantiate_new_reg (rtx x, poly_int64_pod *poffset) +instantiate_new_reg (rtx x, poly_int64 *poffset) { rtx new_rtx; poly_int64 offset; diff --git a/gcc/function.h b/gcc/function.h index e290ff5e59f..5caf1e153ea 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -94,7 +94,7 @@ extern GTY ((length ("crtl->emit.x_reg_rtx_no"))) rtx * regno_reg_rtx; struct GTY(()) expr_status { /* Number of units that we should eventually pop off the stack. These are the arguments to function calls that have already returned. */ - poly_int64_pod x_pending_stack_adjust; + poly_int64 x_pending_stack_adjust; /* Under some ABIs, it is the caller's responsibility to pop arguments pushed for function calls. A naive implementation would simply pop @@ -117,7 +117,7 @@ struct GTY(()) expr_status { boundary can be momentarily unaligned while pushing the arguments. Record the delta since last aligned boundary here in order to get stack alignment in the nested function calls working right. */ - poly_int64_pod x_stack_pointer_delta; + poly_int64 x_stack_pointer_delta; /* Nonzero means __builtin_saveregs has already been done in this function. The value is the pseudoreg containing the value __builtin_saveregs @@ -537,7 +537,7 @@ extern struct machine_function * (*init_machine_status) (void); struct args_size { - poly_int64_pod constant; + poly_int64 constant; tree var; }; diff --git a/gcc/gengtype.cc b/gcc/gengtype.cc index 3db0a9b0769..517d84e4ba2 100644 --- a/gcc/gengtype.cc +++ b/gcc/gengtype.cc @@ -5234,7 +5234,6 @@ main (int argc, char **argv) POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos)); POS_HERE (do_scalar_typedef ("FIXED_VALUE_TYPE", &pos)); POS_HERE (do_scalar_typedef ("double_int", &pos)); - POS_HERE (do_scalar_typedef ("poly_int64_pod", &pos)); POS_HERE (do_scalar_typedef ("offset_int", &pos)); POS_HERE (do_scalar_typedef ("widest_int", &pos)); POS_HERE (do_scalar_typedef ("int64_t", &pos)); diff --git a/gcc/genmodes.cc b/gcc/genmodes.cc index 55ac2adb559..5446a3ee7ec 100644 --- a/gcc/genmodes.cc +++ b/gcc/genmodes.cc @@ -980,7 +980,7 @@ calc_wider_mode (void) } } -/* Text to add to the constant part of a poly_int_pod initializer in +/* Text to add to the constant part of a poly_int initializer in order to fill out te whole structure. */ #if NUM_POLY_INT_COEFFS == 1 #define ZERO_COEFFS "" @@ -1080,7 +1080,7 @@ extern __inline__ __attribute__((__always_inline__, __gnu_inline__))\n\ poly_uint16\n\ mode_size_inline (machine_mode mode)\n\ {\n\ - extern %spoly_uint16_pod mode_size[NUM_MACHINE_MODES];\n\ + extern %spoly_uint16 mode_size[NUM_MACHINE_MODES];\n\ gcc_assert (mode >= 0 && mode < NUM_MACHINE_MODES);\n\ switch (mode)\n\ {\n", adj_nunits || adj_bytesize ? "" : "const "); @@ -1114,7 +1114,7 @@ extern __inline__ __attribute__((__always_inline__, __gnu_inline__))\n\ poly_uint16\n\ mode_nunits_inline (machine_mode mode)\n\ {\n\ - extern %spoly_uint16_pod mode_nunits[NUM_MACHINE_MODES];\n\ + extern %spoly_uint16 mode_nunits[NUM_MACHINE_MODES];\n\ switch (mode)\n\ {\n", adj_nunits ? "" : "const "); @@ -1480,7 +1480,7 @@ emit_mode_precision (void) int c; struct mode_data *m; - print_maybe_const_decl ("%spoly_uint16_pod", "mode_precision", + print_maybe_const_decl ("%spoly_uint16", "mode_precision", "NUM_MACHINE_MODES", adj_nunits); for_all_modes (c, m) @@ -1499,7 +1499,7 @@ emit_mode_size (void) int c; struct mode_data *m; - print_maybe_const_decl ("%spoly_uint16_pod", "mode_size", + print_maybe_const_decl ("%spoly_uint16", "mode_size", "NUM_MACHINE_MODES", adj_nunits || adj_bytesize); for_all_modes (c, m) @@ -1514,7 +1514,7 @@ emit_mode_nunits (void) int c; struct mode_data *m; - print_maybe_const_decl ("%spoly_uint16_pod", "mode_nunits", + print_maybe_const_decl ("%spoly_uint16", "mode_nunits", "NUM_MACHINE_MODES", adj_nunits); for_all_modes (c, m) diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index 04d9faca8ff..dc89975270c 100644 --- a/gcc/gimple-fold.cc +++ b/gcc/gimple-fold.cc @@ -7857,7 +7857,7 @@ gimple_fold_stmt_to_constant (gimple *stmt, tree (*valueize) (tree)) is not explicitly available, but it is known to be zero such as 'static const int a;'. */ static tree -get_base_constructor (tree base, poly_int64_pod *bit_offset, +get_base_constructor (tree base, poly_int64 *bit_offset, tree (*valueize)(tree)) { poly_int64 bit_offset2, size, max_size; diff --git a/gcc/gimple-ssa-store-merging.cc b/gcc/gimple-ssa-store-merging.cc index 542958dd44f..fc6ce4b7084 100644 --- a/gcc/gimple-ssa-store-merging.cc +++ b/gcc/gimple-ssa-store-merging.cc @@ -227,7 +227,7 @@ struct symbolic_number { tree type; tree base_addr; tree offset; - poly_int64_pod bytepos; + poly_int64 bytepos; tree src; tree alias_set; tree vuse; diff --git a/gcc/inchash.h b/gcc/inchash.h index 41ae153d1c5..dc594da7eae 100644 --- a/gcc/inchash.h +++ b/gcc/inchash.h @@ -59,7 +59,7 @@ class hash /* Add polynomial value V, treating each element as an unsigned int. */ template - void add_poly_int (const poly_int_pod &v) + void add_poly_int (const poly_int &v) { for (unsigned int i = 0; i < N; ++i) add_int (v.coeffs[i]); @@ -73,7 +73,7 @@ class hash /* Add polynomial value V, treating each element as a HOST_WIDE_INT. */ template - void add_poly_hwi (const poly_int_pod &v) + void add_poly_hwi (const poly_int &v) { for (unsigned int i = 0; i < N; ++i) add_hwi (v.coeffs[i]); diff --git a/gcc/ipa-modref-tree.cc b/gcc/ipa-modref-tree.cc index de89d879bf4..36bc803f7e5 100644 --- a/gcc/ipa-modref-tree.cc +++ b/gcc/ipa-modref-tree.cc @@ -653,17 +653,17 @@ modref_access_node::dump (FILE *out) if (parm_offset_known) { fprintf (out, " param offset:"); - print_dec ((poly_int64_pod)parm_offset, out, SIGNED); + print_dec ((poly_int64)parm_offset, out, SIGNED); } } if (range_info_useful_p ()) { fprintf (out, " offset:"); - print_dec ((poly_int64_pod)offset, out, SIGNED); + print_dec ((poly_int64)offset, out, SIGNED); fprintf (out, " size:"); - print_dec ((poly_int64_pod)size, out, SIGNED); + print_dec ((poly_int64)size, out, SIGNED); fprintf (out, " max_size:"); - print_dec ((poly_int64_pod)max_size, out, SIGNED); + print_dec ((poly_int64)max_size, out, SIGNED); if (adjustments) fprintf (out, " adjusted %i times", adjustments); } diff --git a/gcc/ipa-modref.cc b/gcc/ipa-modref.cc index 278b2dbd828..c04f9f44c06 100644 --- a/gcc/ipa-modref.cc +++ b/gcc/ipa-modref.cc @@ -1331,7 +1331,7 @@ modref_access_analysis::merge_call_side_effects if (parm_map[i].parm_offset_known) { fprintf (dump_file, " offset:"); - print_dec ((poly_int64_pod)parm_map[i].parm_offset, + print_dec ((poly_int64)parm_map[i].parm_offset, dump_file, SIGNED); } } @@ -1347,7 +1347,7 @@ modref_access_analysis::merge_call_side_effects if (chain_map.parm_offset_known) { fprintf (dump_file, " offset:"); - print_dec ((poly_int64_pod)chain_map.parm_offset, + print_dec ((poly_int64)chain_map.parm_offset, dump_file, SIGNED); } } diff --git a/gcc/ira-int.h b/gcc/ira-int.h index e7460cfd906..0685e1f4e8d 100644 --- a/gcc/ira-int.h +++ b/gcc/ira-int.h @@ -619,7 +619,7 @@ public: /* RTL representation of the stack slot. */ rtx mem; /* Size of the stack slot. */ - poly_uint64_pod width; + poly_uint64 width; }; /* The number of elements in the following array. */ diff --git a/gcc/lra-eliminations.cc b/gcc/lra-eliminations.cc index 9ff4774cf5d..f3b75e08390 100644 --- a/gcc/lra-eliminations.cc +++ b/gcc/lra-eliminations.cc @@ -166,7 +166,7 @@ static class lra_elim_table self_elim_table; /* Offsets should be used to restore original offsets for eliminable hard register which just became not eliminable. Zero, otherwise. */ -static poly_int64_pod self_elim_offsets[FIRST_PSEUDO_REGISTER]; +static poly_int64 self_elim_offsets[FIRST_PSEUDO_REGISTER]; /* Map: hard regno -> RTL presentation. RTL presentations of all potentially eliminable hard registers are stored in the map. */ diff --git a/gcc/machmode.h b/gcc/machmode.h index a22df60dc20..efdb6e5d54b 100644 --- a/gcc/machmode.h +++ b/gcc/machmode.h @@ -22,10 +22,10 @@ along with GCC; see the file COPYING3. If not see typedef opt_mode opt_machine_mode; -extern CONST_MODE_SIZE poly_uint16_pod mode_size[NUM_MACHINE_MODES]; -extern CONST_MODE_PRECISION poly_uint16_pod mode_precision[NUM_MACHINE_MODES]; +extern CONST_MODE_SIZE poly_uint16 mode_size[NUM_MACHINE_MODES]; +extern CONST_MODE_PRECISION poly_uint16 mode_precision[NUM_MACHINE_MODES]; extern const unsigned short mode_inner[NUM_MACHINE_MODES]; -extern CONST_MODE_NUNITS poly_uint16_pod mode_nunits[NUM_MACHINE_MODES]; +extern CONST_MODE_NUNITS poly_uint16 mode_nunits[NUM_MACHINE_MODES]; extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES]; extern const unsigned short mode_unit_precision[NUM_MACHINE_MODES]; extern const unsigned short mode_next[NUM_MACHINE_MODES]; diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index b0c3ef7a9cc..91ef74f1f6a 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -4547,7 +4547,7 @@ public: tree lastlane; vec simt_eargs; gimple_seq simt_dlist; - poly_uint64_pod max_vf; + poly_uint64 max_vf; bool is_simt; }; diff --git a/gcc/poly-int-types.h b/gcc/poly-int-types.h index 07e5da05671..6a41e7baf80 100644 --- a/gcc/poly-int-types.h +++ b/gcc/poly-int-types.h @@ -20,14 +20,6 @@ along with GCC; see the file COPYING3. If not see #ifndef HAVE_POLY_INT_TYPES_H #define HAVE_POLY_INT_TYPES_H -typedef poly_int_pod poly_uint16_pod; -typedef poly_int_pod poly_int64_pod; -typedef poly_int_pod poly_uint64_pod; -typedef poly_int_pod poly_offset_int_pod; -typedef poly_int_pod poly_wide_int_pod; -typedef poly_int_pod poly_widest_int_pod; - typedef poly_int poly_uint16; typedef poly_int poly_int64; typedef poly_int poly_uint64; diff --git a/gcc/poly-int.h b/gcc/poly-int.h index 7bff5e5ad26..3146ba3fdb5 100644 --- a/gcc/poly-int.h +++ b/gcc/poly-int.h @@ -29,7 +29,6 @@ along with GCC; see the file COPYING3. If not see #ifndef HAVE_POLY_INT_H #define HAVE_POLY_INT_H -template struct poly_int_pod; template class poly_int; /* poly_coeff_traiits describes the properties of a poly_int @@ -58,7 +57,11 @@ template class poly_int; - poly_coeff_traits::result is a type that can hold results of operations on T. This is different from T itself in cases where T - is the result of an accessor like wi::to_offset. */ + is the result of an accessor like wi::to_offset. + + - poly_coeff_traits::init_cast::type is the type to which + an argument of type Arg should be casted before being used to + initialize a coefficient of type T. */ template::precision_type> struct poly_coeff_traits; @@ -74,6 +77,9 @@ struct poly_coeff_traits + ((T (1) << (precision - 2)) - 1)) : T (-1)); static const int rank = sizeof (T) * 2 + !signedness; + + template + struct init_cast { using type = T; }; }; template @@ -84,6 +90,9 @@ struct poly_coeff_traits static const int signedness = -1; static const int precision = WIDE_INT_MAX_PRECISION; static const int rank = INT_MAX; + + template + struct init_cast { using type = const Arg &; }; }; template @@ -95,6 +104,9 @@ struct poly_coeff_traits static const int signedness = 1; static const int precision = wi::int_traits::precision; static const int rank = precision * 2 / CHAR_BIT; + + template + struct init_cast { using type = const Arg &; }; }; /* Information about a pair of coefficient types. */ @@ -172,17 +184,13 @@ struct poly_int_traits typedef typename poly_coeff_traits::int_type int_type; }; template -struct poly_int_traits > +struct poly_int_traits > { static const bool is_poly = true; static const unsigned int num_coeffs = N; typedef C coeff_type; typedef typename poly_coeff_traits::int_type int_type; }; -template -struct poly_int_traits > : poly_int_traits > -{ -}; /* SFINAE class that makes T2 available as "type" if T1 is a non-polynomial type. */ @@ -332,31 +340,55 @@ struct poly_result ? (void) ((RES).coeffs[I] = VALUE) \ : (void) ((RES).coeffs[I].~C (), new (&(RES).coeffs[I]) C (VALUE))) -/* A base POD class for polynomial integers. The polynomial has N - coefficients of type C. */ +/* poly_int_full and poly_int_hungry are used internally within poly_int + for delegated initializers. poly_int_full indicates that a parameter + pack has enough elements to initialize every coefficient. poly_int_hungry + indicates that at least one extra zero must be added. */ +struct poly_int_full {}; +struct poly_int_hungry {}; + +/* poly_int_fullness::type is poly_int_full when B is true and + poly_int_hungry when B is false. */ +template struct poly_int_fullness; +template<> struct poly_int_fullness { using type = poly_int_hungry; }; +template<> struct poly_int_fullness { using type = poly_int_full; }; + +/* A class containing polynomial integers. The polynomial has N coefficients + of type C, and N - 1 indeterminates. */ template -struct poly_int_pod +struct poly_int { public: + poly_int () = default; + poly_int (const poly_int &) = default; + + template + poly_int (const poly_int &); + + template + constexpr poly_int (const Cs &...); + + poly_int &operator = (const poly_int &) = default; + template - poly_int_pod &operator = (const poly_int_pod &); + poly_int &operator = (const poly_int &); template - typename if_nonpoly::type &operator = (const Ca &); + typename if_nonpoly::type &operator = (const Ca &); template - poly_int_pod &operator += (const poly_int_pod &); + poly_int &operator += (const poly_int &); template - typename if_nonpoly::type &operator += (const Ca &); + typename if_nonpoly::type &operator += (const Ca &); template - poly_int_pod &operator -= (const poly_int_pod &); + poly_int &operator -= (const poly_int &); template - typename if_nonpoly::type &operator -= (const Ca &); + typename if_nonpoly::type &operator -= (const Ca &); template - typename if_nonpoly::type &operator *= (const Ca &); + typename if_nonpoly::type &operator *= (const Ca &); - poly_int_pod &operator <<= (unsigned int); + poly_int &operator <<= (unsigned int); bool is_constant () const; @@ -366,13 +398,13 @@ public: C to_constant () const; template - static poly_int from (const poly_int_pod &, unsigned int, + static poly_int from (const poly_int &, unsigned int, signop); template - static poly_int from (const poly_int_pod &, signop); + static poly_int from (const poly_int &, signop); - bool to_shwi (poly_int_pod *) const; - bool to_uhwi (poly_int_pod *) const; + bool to_shwi (poly_int *) const; + bool to_uhwi (poly_int *) const; poly_int force_shwi () const; poly_int force_uhwi () const; @@ -381,12 +413,50 @@ public: #endif C coeffs[N]; + +private: + template + constexpr poly_int (poly_int_full, const Cs &...); + + template + constexpr poly_int (poly_int_hungry, const C0 &, const Cs &...); }; template template -inline poly_int_pod& -poly_int_pod::operator = (const poly_int_pod &a) +inline +poly_int::poly_int (const poly_int &a) +{ + for (unsigned int i = 0; i < N; i++) + POLY_SET_COEFF (C, *this, i, a.coeffs[i]); +} + +template +template +inline constexpr +poly_int::poly_int (const Cs &... cs) + : poly_int (typename poly_int_fullness= N>::type (), + cs...) {} + +/* Initialize with c0, cs..., and some trailing zeros. */ +template +template +inline constexpr +poly_int::poly_int (poly_int_hungry, const C0 &c0, const Cs &... cs) + : poly_int (c0, cs..., wi::ints_for::zero (c0)) {} + +/* Initialize with cs... directly, casting where necessary. */ +template +template +inline constexpr +poly_int::poly_int (poly_int_full, const Cs &... cs) + : coeffs { (typename poly_coeff_traits:: + template init_cast::type (cs))... } {} + +template +template +inline poly_int& +poly_int::operator = (const poly_int &a) { for (unsigned int i = 0; i < N; i++) POLY_SET_COEFF (C, *this, i, a.coeffs[i]); @@ -395,8 +465,8 @@ poly_int_pod::operator = (const poly_int_pod &a) template template -inline typename if_nonpoly >::type & -poly_int_pod::operator = (const Ca &a) +inline typename if_nonpoly >::type & +poly_int::operator = (const Ca &a) { POLY_SET_COEFF (C, *this, 0, a); if (N >= 2) @@ -407,8 +477,8 @@ poly_int_pod::operator = (const Ca &a) template template -inline poly_int_pod& -poly_int_pod::operator += (const poly_int_pod &a) +inline poly_int& +poly_int::operator += (const poly_int &a) { for (unsigned int i = 0; i < N; i++) this->coeffs[i] += a.coeffs[i]; @@ -417,8 +487,8 @@ poly_int_pod::operator += (const poly_int_pod &a) template template -inline typename if_nonpoly >::type & -poly_int_pod::operator += (const Ca &a) +inline typename if_nonpoly >::type & +poly_int::operator += (const Ca &a) { this->coeffs[0] += a; return *this; @@ -426,8 +496,8 @@ poly_int_pod::operator += (const Ca &a) template template -inline poly_int_pod& -poly_int_pod::operator -= (const poly_int_pod &a) +inline poly_int& +poly_int::operator -= (const poly_int &a) { for (unsigned int i = 0; i < N; i++) this->coeffs[i] -= a.coeffs[i]; @@ -436,8 +506,8 @@ poly_int_pod::operator -= (const poly_int_pod &a) template template -inline typename if_nonpoly >::type & -poly_int_pod::operator -= (const Ca &a) +inline typename if_nonpoly >::type & +poly_int::operator -= (const Ca &a) { this->coeffs[0] -= a; return *this; @@ -445,8 +515,8 @@ poly_int_pod::operator -= (const Ca &a) template template -inline typename if_nonpoly >::type & -poly_int_pod::operator *= (const Ca &a) +inline typename if_nonpoly >::type & +poly_int::operator *= (const Ca &a) { for (unsigned int i = 0; i < N; i++) this->coeffs[i] *= a; @@ -454,8 +524,8 @@ poly_int_pod::operator *= (const Ca &a) } template -inline poly_int_pod& -poly_int_pod::operator <<= (unsigned int a) +inline poly_int& +poly_int::operator <<= (unsigned int a) { for (unsigned int i = 0; i < N; i++) this->coeffs[i] <<= a; @@ -466,7 +536,7 @@ poly_int_pod::operator <<= (unsigned int a) template inline bool -poly_int_pod::is_constant () const +poly_int::is_constant () const { if (N >= 2) for (unsigned int i = 1; i < N; i++) @@ -481,7 +551,7 @@ poly_int_pod::is_constant () const template template inline typename if_lossless::type -poly_int_pod::is_constant (T *const_value) const +poly_int::is_constant (T *const_value) const { if (is_constant ()) { @@ -499,7 +569,7 @@ poly_int_pod::is_constant (T *const_value) const template inline C -poly_int_pod::to_constant () const +poly_int::to_constant () const { gcc_checking_assert (is_constant ()); return this->coeffs[0]; @@ -512,8 +582,8 @@ poly_int_pod::to_constant () const template template inline poly_int -poly_int_pod::from (const poly_int_pod &a, - unsigned int bitsize, signop sgn) +poly_int::from (const poly_int &a, unsigned int bitsize, + signop sgn) { poly_int r; for (unsigned int i = 0; i < N; i++) @@ -527,7 +597,7 @@ poly_int_pod::from (const poly_int_pod &a, template template inline poly_int -poly_int_pod::from (const poly_int_pod &a, signop sgn) +poly_int::from (const poly_int &a, signop sgn) { poly_int r; for (unsigned int i = 0; i < N; i++) @@ -541,7 +611,7 @@ poly_int_pod::from (const poly_int_pod &a, signop sgn) template inline bool -poly_int_pod::to_shwi (poly_int_pod *r) const +poly_int::to_shwi (poly_int *r) const { for (unsigned int i = 0; i < N; i++) if (!wi::fits_shwi_p (this->coeffs[i])) @@ -558,7 +628,7 @@ poly_int_pod::to_shwi (poly_int_pod *r) const template inline bool -poly_int_pod::to_uhwi (poly_int_pod *r) const +poly_int::to_uhwi (poly_int *r) const { for (unsigned int i = 0; i < N; i++) if (!wi::fits_uhwi_p (this->coeffs[i])) @@ -573,9 +643,9 @@ poly_int_pod::to_uhwi (poly_int_pod *r) const template inline poly_int -poly_int_pod::force_shwi () const +poly_int::force_shwi () const { - poly_int_pod r; + poly_int r; for (unsigned int i = 0; i < N; i++) r.coeffs[i] = this->coeffs[i].to_shwi (); return r; @@ -586,9 +656,9 @@ poly_int_pod::force_shwi () const template inline poly_int -poly_int_pod::force_uhwi () const +poly_int::force_uhwi () const { - poly_int_pod r; + poly_int r; for (unsigned int i = 0; i < N; i++) r.coeffs[i] = this->coeffs[i].to_uhwi (); return r; @@ -599,170 +669,13 @@ poly_int_pod::force_uhwi () const template inline -poly_int_pod::operator C () const +poly_int::operator C () const { gcc_checking_assert (this->is_constant ()); return this->coeffs[0]; } #endif -/* The main class for polynomial integers. The class provides - constructors that are necessarily missing from the POD base. */ -template -class poly_int : public poly_int_pod -{ -public: - poly_int () {} - - template - poly_int (const poly_int &); - template - poly_int (const poly_int_pod &); - template - poly_int (const C0 &); - template - poly_int (const C0 &, const C1 &); - - template - poly_int &operator = (const poly_int_pod &); - template - typename if_nonpoly::type &operator = (const Ca &); - - template - poly_int &operator += (const poly_int_pod &); - template - typename if_nonpoly::type &operator += (const Ca &); - - template - poly_int &operator -= (const poly_int_pod &); - template - typename if_nonpoly::type &operator -= (const Ca &); - - template - typename if_nonpoly::type &operator *= (const Ca &); - - poly_int &operator <<= (unsigned int); -}; - -template -template -inline -poly_int::poly_int (const poly_int &a) -{ - for (unsigned int i = 0; i < N; i++) - POLY_SET_COEFF (C, *this, i, a.coeffs[i]); -} - -template -template -inline -poly_int::poly_int (const poly_int_pod &a) -{ - for (unsigned int i = 0; i < N; i++) - POLY_SET_COEFF (C, *this, i, a.coeffs[i]); -} - -template -template -inline -poly_int::poly_int (const C0 &c0) -{ - POLY_SET_COEFF (C, *this, 0, c0); - for (unsigned int i = 1; i < N; i++) - POLY_SET_COEFF (C, *this, i, wi::ints_for::zero (this->coeffs[0])); -} - -template -template -inline -poly_int::poly_int (const C0 &c0, const C1 &c1) -{ - STATIC_ASSERT (N >= 2); - POLY_SET_COEFF (C, *this, 0, c0); - POLY_SET_COEFF (C, *this, 1, c1); - for (unsigned int i = 2; i < N; i++) - POLY_SET_COEFF (C, *this, i, wi::ints_for::zero (this->coeffs[0])); -} - -template -template -inline poly_int& -poly_int::operator = (const poly_int_pod &a) -{ - for (unsigned int i = 0; i < N; i++) - this->coeffs[i] = a.coeffs[i]; - return *this; -} - -template -template -inline typename if_nonpoly >::type & -poly_int::operator = (const Ca &a) -{ - this->coeffs[0] = a; - if (N >= 2) - for (unsigned int i = 1; i < N; i++) - this->coeffs[i] = wi::ints_for::zero (this->coeffs[0]); - return *this; -} - -template -template -inline poly_int& -poly_int::operator += (const poly_int_pod &a) -{ - for (unsigned int i = 0; i < N; i++) - this->coeffs[i] += a.coeffs[i]; - return *this; -} - -template -template -inline typename if_nonpoly >::type & -poly_int::operator += (const Ca &a) -{ - this->coeffs[0] += a; - return *this; -} - -template -template -inline poly_int& -poly_int::operator -= (const poly_int_pod &a) -{ - for (unsigned int i = 0; i < N; i++) - this->coeffs[i] -= a.coeffs[i]; - return *this; -} - -template -template -inline typename if_nonpoly >::type & -poly_int::operator -= (const Ca &a) -{ - this->coeffs[0] -= a; - return *this; -} - -template -template -inline typename if_nonpoly >::type & -poly_int::operator *= (const Ca &a) -{ - for (unsigned int i = 0; i < N; i++) - this->coeffs[i] *= a; - return *this; -} - -template -inline poly_int& -poly_int::operator <<= (unsigned int a) -{ - for (unsigned int i = 0; i < N; i++) - this->coeffs[i] <<= a; - return *this; -} - /* Return true if every coefficient of A is in the inclusive range [B, C]. */ template @@ -774,7 +687,7 @@ coeffs_in_range_p (const Ca &a, const Cb &b, const Cc &c) template inline typename if_nonpoly::type -coeffs_in_range_p (const poly_int_pod &a, const Cb &b, const Cc &c) +coeffs_in_range_p (const poly_int &a, const Cb &b, const Cc &c) { for (unsigned int i = 0; i < N; i++) if (a.coeffs[i] < b || a.coeffs[i] > c) @@ -787,7 +700,7 @@ namespace wi { template inline poly_int -shwi (const poly_int_pod &a, unsigned int precision) +shwi (const poly_int &a, unsigned int precision) { poly_int r; for (unsigned int i = 0; i < N; i++) @@ -799,7 +712,7 @@ shwi (const poly_int_pod &a, unsigned int precision) template inline poly_int -uhwi (const poly_int_pod &a, unsigned int precision) +uhwi (const poly_int &a, unsigned int precision) { poly_int r; for (unsigned int i = 0; i < N; i++) @@ -811,7 +724,7 @@ uhwi (const poly_int_pod &a, unsigned int precision) template inline POLY_POLY_RESULT (N, Ca, Ca) -sext (const poly_int_pod &a, unsigned int precision) +sext (const poly_int &a, unsigned int precision) { typedef POLY_POLY_COEFF (Ca, Ca) C; poly_int r; @@ -824,7 +737,7 @@ sext (const poly_int_pod &a, unsigned int precision) template inline POLY_POLY_RESULT (N, Ca, Ca) -zext (const poly_int_pod &a, unsigned int precision) +zext (const poly_int &a, unsigned int precision) { typedef POLY_POLY_COEFF (Ca, Ca) C; poly_int r; @@ -836,7 +749,7 @@ zext (const poly_int_pod &a, unsigned int precision) template inline POLY_POLY_RESULT (N, Ca, Cb) -operator + (const poly_int_pod &a, const poly_int_pod &b) +operator + (const poly_int &a, const poly_int &b) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_POLY_COEFF (Ca, Cb) C; @@ -848,7 +761,7 @@ operator + (const poly_int_pod &a, const poly_int_pod &b) template inline POLY_CONST_RESULT (N, Ca, Cb) -operator + (const poly_int_pod &a, const Cb &b) +operator + (const poly_int &a, const Cb &b) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_CONST_COEFF (Ca, Cb) C; @@ -862,7 +775,7 @@ operator + (const poly_int_pod &a, const Cb &b) template inline CONST_POLY_RESULT (N, Ca, Cb) -operator + (const Ca &a, const poly_int_pod &b) +operator + (const Ca &a, const poly_int &b) { typedef POLY_CAST (Cb, Ca) NCb; typedef CONST_POLY_COEFF (Ca, Cb) C; @@ -879,7 +792,7 @@ namespace wi { template inline poly_int -add (const poly_int_pod &a, const poly_int_pod &b) +add (const poly_int &a, const poly_int &b) { typedef WI_BINARY_RESULT (Ca, Cb) C; poly_int r; @@ -890,7 +803,7 @@ add (const poly_int_pod &a, const poly_int_pod &b) template inline poly_int -add (const poly_int_pod &a, const Cb &b) +add (const poly_int &a, const Cb &b) { typedef WI_BINARY_RESULT (Ca, Cb) C; poly_int r; @@ -903,7 +816,7 @@ add (const poly_int_pod &a, const Cb &b) template inline poly_int -add (const Ca &a, const poly_int_pod &b) +add (const Ca &a, const poly_int &b) { typedef WI_BINARY_RESULT (Ca, Cb) C; poly_int r; @@ -916,7 +829,7 @@ add (const Ca &a, const poly_int_pod &b) template inline poly_int -add (const poly_int_pod &a, const poly_int_pod &b, +add (const poly_int &a, const poly_int &b, signop sgn, wi::overflow_type *overflow) { typedef WI_BINARY_RESULT (Ca, Cb) C; @@ -935,7 +848,7 @@ add (const poly_int_pod &a, const poly_int_pod &b, template inline POLY_POLY_RESULT (N, Ca, Cb) -operator - (const poly_int_pod &a, const poly_int_pod &b) +operator - (const poly_int &a, const poly_int &b) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_POLY_COEFF (Ca, Cb) C; @@ -947,7 +860,7 @@ operator - (const poly_int_pod &a, const poly_int_pod &b) template inline POLY_CONST_RESULT (N, Ca, Cb) -operator - (const poly_int_pod &a, const Cb &b) +operator - (const poly_int &a, const Cb &b) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_CONST_COEFF (Ca, Cb) C; @@ -961,7 +874,7 @@ operator - (const poly_int_pod &a, const Cb &b) template inline CONST_POLY_RESULT (N, Ca, Cb) -operator - (const Ca &a, const poly_int_pod &b) +operator - (const Ca &a, const poly_int &b) { typedef POLY_CAST (Cb, Ca) NCb; typedef CONST_POLY_COEFF (Ca, Cb) C; @@ -978,7 +891,7 @@ namespace wi { template inline poly_int -sub (const poly_int_pod &a, const poly_int_pod &b) +sub (const poly_int &a, const poly_int &b) { typedef WI_BINARY_RESULT (Ca, Cb) C; poly_int r; @@ -989,7 +902,7 @@ sub (const poly_int_pod &a, const poly_int_pod &b) template inline poly_int -sub (const poly_int_pod &a, const Cb &b) +sub (const poly_int &a, const Cb &b) { typedef WI_BINARY_RESULT (Ca, Cb) C; poly_int r; @@ -1002,7 +915,7 @@ sub (const poly_int_pod &a, const Cb &b) template inline poly_int -sub (const Ca &a, const poly_int_pod &b) +sub (const Ca &a, const poly_int &b) { typedef WI_BINARY_RESULT (Ca, Cb) C; poly_int r; @@ -1015,7 +928,7 @@ sub (const Ca &a, const poly_int_pod &b) template inline poly_int -sub (const poly_int_pod &a, const poly_int_pod &b, +sub (const poly_int &a, const poly_int &b, signop sgn, wi::overflow_type *overflow) { typedef WI_BINARY_RESULT (Ca, Cb) C; @@ -1034,7 +947,7 @@ sub (const poly_int_pod &a, const poly_int_pod &b, template inline POLY_POLY_RESULT (N, Ca, Ca) -operator - (const poly_int_pod &a) +operator - (const poly_int &a) { typedef POLY_CAST (Ca, Ca) NCa; typedef POLY_POLY_COEFF (Ca, Ca) C; @@ -1049,7 +962,7 @@ namespace wi { template inline poly_int -neg (const poly_int_pod &a) +neg (const poly_int &a) { typedef WI_UNARY_RESULT (Ca) C; poly_int r; @@ -1060,7 +973,7 @@ neg (const poly_int_pod &a) template inline poly_int -neg (const poly_int_pod &a, wi::overflow_type *overflow) +neg (const poly_int &a, wi::overflow_type *overflow) { typedef WI_UNARY_RESULT (Ca) C; poly_int r; @@ -1077,7 +990,7 @@ neg (const poly_int_pod &a, wi::overflow_type *overflow) template inline POLY_POLY_RESULT (N, Ca, Ca) -operator ~ (const poly_int_pod &a) +operator ~ (const poly_int &a) { if (N >= 2) return -1 - a; @@ -1086,7 +999,7 @@ operator ~ (const poly_int_pod &a) template inline POLY_CONST_RESULT (N, Ca, Cb) -operator * (const poly_int_pod &a, const Cb &b) +operator * (const poly_int &a, const Cb &b) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_CONST_COEFF (Ca, Cb) C; @@ -1098,7 +1011,7 @@ operator * (const poly_int_pod &a, const Cb &b) template inline CONST_POLY_RESULT (N, Ca, Cb) -operator * (const Ca &a, const poly_int_pod &b) +operator * (const Ca &a, const poly_int &b) { typedef POLY_CAST (Ca, Cb) NCa; typedef CONST_POLY_COEFF (Ca, Cb) C; @@ -1113,7 +1026,7 @@ namespace wi { template inline poly_int -mul (const poly_int_pod &a, const Cb &b) +mul (const poly_int &a, const Cb &b) { typedef WI_BINARY_RESULT (Ca, Cb) C; poly_int r; @@ -1124,7 +1037,7 @@ mul (const poly_int_pod &a, const Cb &b) template inline poly_int -mul (const Ca &a, const poly_int_pod &b) +mul (const Ca &a, const poly_int &b) { typedef WI_BINARY_RESULT (Ca, Cb) C; poly_int r; @@ -1135,7 +1048,7 @@ mul (const Ca &a, const poly_int_pod &b) template inline poly_int -mul (const poly_int_pod &a, const Cb &b, +mul (const poly_int &a, const Cb &b, signop sgn, wi::overflow_type *overflow) { typedef WI_BINARY_RESULT (Ca, Cb) C; @@ -1153,7 +1066,7 @@ mul (const poly_int_pod &a, const Cb &b, template inline POLY_POLY_RESULT (N, Ca, Ca) -operator << (const poly_int_pod &a, const Cb &b) +operator << (const poly_int &a, const Cb &b) { typedef POLY_CAST (Ca, Ca) NCa; typedef POLY_POLY_COEFF (Ca, Ca) C; @@ -1168,7 +1081,7 @@ namespace wi { template inline poly_int -lshift (const poly_int_pod &a, const Cb &b) +lshift (const poly_int &a, const Cb &b) { typedef WI_BINARY_RESULT (Ca, Ca) C; poly_int r; @@ -1184,7 +1097,7 @@ template inline poly_int sext_hwi (const poly_int &a, unsigned int precision) { - poly_int_pod r; + poly_int r; for (unsigned int i = 0; i < N; i++) r.coeffs[i] = sext_hwi (a.coeffs[i], precision); return r; @@ -1236,7 +1149,7 @@ maybe_eq_2 (const Ca &a0, const Ca &a1, const Cb &b) template inline bool -maybe_eq (const poly_int_pod &a, const poly_int_pod &b) +maybe_eq (const poly_int &a, const poly_int &b) { STATIC_ASSERT (N <= 2); if (N == 2) @@ -1246,7 +1159,7 @@ maybe_eq (const poly_int_pod &a, const poly_int_pod &b) template inline typename if_nonpoly::type -maybe_eq (const poly_int_pod &a, const Cb &b) +maybe_eq (const poly_int &a, const Cb &b) { STATIC_ASSERT (N <= 2); if (N == 2) @@ -1256,7 +1169,7 @@ maybe_eq (const poly_int_pod &a, const Cb &b) template inline typename if_nonpoly::type -maybe_eq (const Ca &a, const poly_int_pod &b) +maybe_eq (const Ca &a, const poly_int &b) { STATIC_ASSERT (N <= 2); if (N == 2) @@ -1275,7 +1188,7 @@ maybe_eq (const Ca &a, const Cb &b) template inline bool -maybe_ne (const poly_int_pod &a, const poly_int_pod &b) +maybe_ne (const poly_int &a, const poly_int &b) { if (N >= 2) for (unsigned int i = 1; i < N; i++) @@ -1286,7 +1199,7 @@ maybe_ne (const poly_int_pod &a, const poly_int_pod &b) template inline typename if_nonpoly::type -maybe_ne (const poly_int_pod &a, const Cb &b) +maybe_ne (const poly_int &a, const Cb &b) { if (N >= 2) for (unsigned int i = 1; i < N; i++) @@ -1297,7 +1210,7 @@ maybe_ne (const poly_int_pod &a, const Cb &b) template inline typename if_nonpoly::type -maybe_ne (const Ca &a, const poly_int_pod &b) +maybe_ne (const Ca &a, const poly_int &b) { if (N >= 2) for (unsigned int i = 1; i < N; i++) @@ -1324,7 +1237,7 @@ maybe_ne (const Ca &a, const Cb &b) template inline bool -maybe_le (const poly_int_pod &a, const poly_int_pod &b) +maybe_le (const poly_int &a, const poly_int &b) { if (N >= 2) for (unsigned int i = 1; i < N; i++) @@ -1335,7 +1248,7 @@ maybe_le (const poly_int_pod &a, const poly_int_pod &b) template inline typename if_nonpoly::type -maybe_le (const poly_int_pod &a, const Cb &b) +maybe_le (const poly_int &a, const Cb &b) { if (N >= 2) for (unsigned int i = 1; i < N; i++) @@ -1346,7 +1259,7 @@ maybe_le (const poly_int_pod &a, const Cb &b) template inline typename if_nonpoly::type -maybe_le (const Ca &a, const poly_int_pod &b) +maybe_le (const Ca &a, const poly_int &b) { if (N >= 2) for (unsigned int i = 1; i < N; i++) @@ -1366,7 +1279,7 @@ maybe_le (const Ca &a, const Cb &b) template inline bool -maybe_lt (const poly_int_pod &a, const poly_int_pod &b) +maybe_lt (const poly_int &a, const poly_int &b) { if (N >= 2) for (unsigned int i = 1; i < N; i++) @@ -1377,7 +1290,7 @@ maybe_lt (const poly_int_pod &a, const poly_int_pod &b) template inline typename if_nonpoly::type -maybe_lt (const poly_int_pod &a, const Cb &b) +maybe_lt (const poly_int &a, const Cb &b) { if (N >= 2) for (unsigned int i = 1; i < N; i++) @@ -1388,7 +1301,7 @@ maybe_lt (const poly_int_pod &a, const Cb &b) template inline typename if_nonpoly::type -maybe_lt (const Ca &a, const poly_int_pod &b) +maybe_lt (const Ca &a, const poly_int &b) { if (N >= 2) for (unsigned int i = 1; i < N; i++) @@ -1442,7 +1355,7 @@ ordered_p (const T1 &a, const T2 &b) template inline POLY_POLY_RESULT (N, Ca, Cb) -ordered_min (const poly_int_pod &a, const poly_int_pod &b) +ordered_min (const poly_int &a, const poly_int &b) { if (known_le (a, b)) return a; @@ -1456,7 +1369,7 @@ ordered_min (const poly_int_pod &a, const poly_int_pod &b) template inline CONST_POLY_RESULT (N, Ca, Cb) -ordered_min (const Ca &a, const poly_int_pod &b) +ordered_min (const Ca &a, const poly_int &b) { if (known_le (a, b)) return a; @@ -1470,7 +1383,7 @@ ordered_min (const Ca &a, const poly_int_pod &b) template inline POLY_CONST_RESULT (N, Ca, Cb) -ordered_min (const poly_int_pod &a, const Cb &b) +ordered_min (const poly_int &a, const Cb &b) { if (known_le (a, b)) return a; @@ -1490,7 +1403,7 @@ ordered_min (const poly_int_pod &a, const Cb &b) template inline POLY_POLY_RESULT (N, Ca, Cb) -ordered_max (const poly_int_pod &a, const poly_int_pod &b) +ordered_max (const poly_int &a, const poly_int &b) { if (known_le (a, b)) return b; @@ -1504,7 +1417,7 @@ ordered_max (const poly_int_pod &a, const poly_int_pod &b) template inline CONST_POLY_RESULT (N, Ca, Cb) -ordered_max (const Ca &a, const poly_int_pod &b) +ordered_max (const Ca &a, const poly_int &b) { if (known_le (a, b)) return b; @@ -1518,7 +1431,7 @@ ordered_max (const Ca &a, const poly_int_pod &b) template inline POLY_CONST_RESULT (N, Ca, Cb) -ordered_max (const poly_int_pod &a, const Cb &b) +ordered_max (const poly_int &a, const Cb &b) { if (known_le (a, b)) return b; @@ -1535,7 +1448,7 @@ ordered_max (const poly_int_pod &a, const Cb &b) template inline Ca -constant_lower_bound (const poly_int_pod &a) +constant_lower_bound (const poly_int &a) { gcc_checking_assert (known_ge (a, POLY_INT_TYPE (Ca) (0))); return a.coeffs[0]; @@ -1545,7 +1458,7 @@ constant_lower_bound (const poly_int_pod &a) template inline POLY_CONST_COEFF (Ca, Cb) -constant_lower_bound_with_limit (const poly_int_pod &a, const Cb &b) +constant_lower_bound_with_limit (const poly_int &a, const Cb &b) { if (known_ge (a, b)) return a.coeffs[0]; @@ -1557,7 +1470,7 @@ constant_lower_bound_with_limit (const poly_int_pod &a, const Cb &b) template inline POLY_CONST_COEFF (Ca, Cb) -constant_upper_bound_with_limit (const poly_int_pod &a, const Cb &b) +constant_upper_bound_with_limit (const poly_int &a, const Cb &b) { if (known_le (a, b)) return a.coeffs[0]; @@ -1570,7 +1483,7 @@ constant_upper_bound_with_limit (const poly_int_pod &a, const Cb &b) template inline POLY_CONST_RESULT (N, Ca, Cb) -lower_bound (const poly_int_pod &a, const Cb &b) +lower_bound (const poly_int &a, const Cb &b) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_CAST (Cb, Ca) NCb; @@ -1587,14 +1500,14 @@ lower_bound (const poly_int_pod &a, const Cb &b) template inline CONST_POLY_RESULT (N, Ca, Cb) -lower_bound (const Ca &a, const poly_int_pod &b) +lower_bound (const Ca &a, const poly_int &b) { return lower_bound (b, a); } template inline POLY_POLY_RESULT (N, Ca, Cb) -lower_bound (const poly_int_pod &a, const poly_int_pod &b) +lower_bound (const poly_int &a, const poly_int &b) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_CAST (Cb, Ca) NCb; @@ -1619,7 +1532,7 @@ lower_bound (const Ca &a, const Cb &b) template inline POLY_CONST_RESULT (N, Ca, Cb) -upper_bound (const poly_int_pod &a, const Cb &b) +upper_bound (const poly_int &a, const Cb &b) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_CAST (Cb, Ca) NCb; @@ -1636,14 +1549,14 @@ upper_bound (const poly_int_pod &a, const Cb &b) template inline CONST_POLY_RESULT (N, Ca, Cb) -upper_bound (const Ca &a, const poly_int_pod &b) +upper_bound (const Ca &a, const poly_int &b) { return upper_bound (b, a); } template inline POLY_POLY_RESULT (N, Ca, Cb) -upper_bound (const poly_int_pod &a, const poly_int_pod &b) +upper_bound (const poly_int &a, const poly_int &b) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_CAST (Cb, Ca) NCb; @@ -1660,7 +1573,7 @@ upper_bound (const poly_int_pod &a, const poly_int_pod &b) template inline POLY_BINARY_COEFF (Ca, Ca) -coeff_gcd (const poly_int_pod &a) +coeff_gcd (const poly_int &a) { /* Find the first nonzero coefficient, stopping at 0 whatever happens. */ unsigned int i; @@ -1681,7 +1594,7 @@ coeff_gcd (const poly_int_pod &a) template POLY_CONST_RESULT (N, Ca, Cb) -common_multiple (const poly_int_pod &a, Cb b) +common_multiple (const poly_int &a, Cb b) { POLY_BINARY_COEFF (Ca, Ca) xgcd = coeff_gcd (a); return a * (least_common_multiple (xgcd, b) / xgcd); @@ -1689,7 +1602,7 @@ common_multiple (const poly_int_pod &a, Cb b) template inline CONST_POLY_RESULT (N, Ca, Cb) -common_multiple (const Ca &a, const poly_int_pod &b) +common_multiple (const Ca &a, const poly_int &b) { return common_multiple (b, a); } @@ -1704,8 +1617,7 @@ common_multiple (const Ca &a, const poly_int_pod &b) template POLY_POLY_RESULT (N, Ca, Cb) -force_common_multiple (const poly_int_pod &a, - const poly_int_pod &b) +force_common_multiple (const poly_int &a, const poly_int &b) { if (b.is_constant ()) return common_multiple (a, b.coeffs[0]); @@ -1743,8 +1655,7 @@ force_common_multiple (const poly_int_pod &a, template inline int -compare_sizes_for_sort (const poly_int_pod &a, - const poly_int_pod &b) +compare_sizes_for_sort (const poly_int &a, const poly_int &b) { for (unsigned int i = N; i-- > 0; ) if (a.coeffs[i] != b.coeffs[i]) @@ -1756,7 +1667,7 @@ compare_sizes_for_sort (const poly_int_pod &a, template inline bool -can_align_p (const poly_int_pod &value, Cb align) +can_align_p (const poly_int &value, Cb align) { for (unsigned int i = 1; i < N; i++) if ((value.coeffs[i] & (align - 1)) != 0) @@ -1769,8 +1680,8 @@ can_align_p (const poly_int_pod &value, Cb align) template inline bool -can_align_up (const poly_int_pod &value, Cb align, - poly_int_pod *aligned) +can_align_up (const poly_int &value, Cb align, + poly_int *aligned) { if (!can_align_p (value, align)) return false; @@ -1783,8 +1694,8 @@ can_align_up (const poly_int_pod &value, Cb align, template inline bool -can_align_down (const poly_int_pod &value, Cb align, - poly_int_pod *aligned) +can_align_down (const poly_int &value, Cb align, + poly_int *aligned) { if (!can_align_p (value, align)) return false; @@ -1798,8 +1709,8 @@ can_align_down (const poly_int_pod &value, Cb align, template inline bool -known_equal_after_align_up (const poly_int_pod &a, - const poly_int_pod &b, +known_equal_after_align_up (const poly_int &a, + const poly_int &b, Cc align) { poly_int aligned_a; @@ -1815,8 +1726,8 @@ known_equal_after_align_up (const poly_int_pod &a, template inline bool -known_equal_after_align_down (const poly_int_pod &a, - const poly_int_pod &b, +known_equal_after_align_down (const poly_int &a, + const poly_int &b, Cc align) { poly_int aligned_a; @@ -1835,7 +1746,7 @@ known_equal_after_align_down (const poly_int_pod &a, template inline poly_int -force_align_up (const poly_int_pod &value, Cb align) +force_align_up (const poly_int &value, Cb align) { gcc_checking_assert (can_align_p (value, align)); return value + (-value.coeffs[0] & (align - 1)); @@ -1850,7 +1761,7 @@ force_align_up (const poly_int_pod &value, Cb align) template inline poly_int -force_align_down (const poly_int_pod &value, Cb align) +force_align_down (const poly_int &value, Cb align) { gcc_checking_assert (can_align_p (value, align)); return value - (value.coeffs[0] & (align - 1)); @@ -1862,7 +1773,7 @@ force_align_down (const poly_int_pod &value, Cb align) template inline poly_int -aligned_lower_bound (const poly_int_pod &value, Cb align) +aligned_lower_bound (const poly_int &value, Cb align) { poly_int r; for (unsigned int i = 0; i < N; i++) @@ -1879,7 +1790,7 @@ aligned_lower_bound (const poly_int_pod &value, Cb align) template inline poly_int -aligned_upper_bound (const poly_int_pod &value, Cb align) +aligned_upper_bound (const poly_int &value, Cb align) { poly_int r; for (unsigned int i = 0; i < N; i++) @@ -1898,7 +1809,7 @@ aligned_upper_bound (const poly_int_pod &value, Cb align) template inline poly_int -force_align_down_and_div (const poly_int_pod &value, Cb align) +force_align_down_and_div (const poly_int &value, Cb align) { gcc_checking_assert (can_align_p (value, align)); @@ -1922,7 +1833,7 @@ force_align_down_and_div (const poly_int_pod &value, Cb align) template inline poly_int -force_align_up_and_div (const poly_int_pod &value, Cb align) +force_align_up_and_div (const poly_int &value, Cb align) { gcc_checking_assert (can_align_p (value, align)); @@ -1942,7 +1853,7 @@ force_align_up_and_div (const poly_int_pod &value, Cb align) template inline bool -known_misalignment (const poly_int_pod &value, Cb align, Cm *misalign) +known_misalignment (const poly_int &value, Cb align, Cm *misalign) { gcc_checking_assert (align != 0); if (!can_align_p (value, align)) @@ -1957,7 +1868,7 @@ known_misalignment (const poly_int_pod &value, Cb align, Cm *misalign) template inline POLY_BINARY_COEFF (Ca, Ca) -force_get_misalignment (const poly_int_pod &a, Cb align) +force_get_misalignment (const poly_int &a, Cb align) { gcc_checking_assert (can_align_p (a, align)); return a.coeffs[0] & (align - 1); @@ -1968,7 +1879,7 @@ force_get_misalignment (const poly_int_pod &a, Cb align) template inline POLY_BINARY_COEFF (Ca, Ca) -known_alignment (const poly_int_pod &a) +known_alignment (const poly_int &a) { typedef POLY_BINARY_COEFF (Ca, Ca) C; C r = a.coeffs[0]; @@ -1982,7 +1893,7 @@ known_alignment (const poly_int_pod &a) template inline typename if_nonpoly::type -can_ior_p (const poly_int_pod &a, Cb b, Cr *result) +can_ior_p (const poly_int &a, Cb b, Cr *result) { /* Coefficients 1 and above must be a multiple of something greater than B. */ @@ -2001,7 +1912,7 @@ can_ior_p (const poly_int_pod &a, Cb b, Cr *result) template inline typename if_nonpoly::type -constant_multiple_p (const poly_int_pod &a, Cb b, Cm *multiple) +constant_multiple_p (const poly_int &a, Cb b, Cm *multiple) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_CAST (Cb, Ca) NCb; @@ -2016,7 +1927,7 @@ constant_multiple_p (const poly_int_pod &a, Cb b, Cm *multiple) template inline typename if_nonpoly::type -constant_multiple_p (Ca a, const poly_int_pod &b, Cm *multiple) +constant_multiple_p (Ca a, const poly_int &b, Cm *multiple) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_CAST (Cb, Ca) NCb; @@ -2033,8 +1944,8 @@ constant_multiple_p (Ca a, const poly_int_pod &b, Cm *multiple) template inline bool -constant_multiple_p (const poly_int_pod &a, - const poly_int_pod &b, Cm *multiple) +constant_multiple_p (const poly_int &a, + const poly_int &b, Cm *multiple) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_CAST (Cb, Ca) NCb; @@ -2061,7 +1972,7 @@ constant_multiple_p (const poly_int_pod &a, template inline typename if_nonpoly::type -constant_multiple_p (const poly_int_pod &a, Cb b) +constant_multiple_p (const poly_int &a, Cb b) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_CAST (Cb, Ca) NCb; @@ -2075,7 +1986,7 @@ constant_multiple_p (const poly_int_pod &a, Cb b) template inline typename if_nonpoly::type -constant_multiple_p (Ca a, const poly_int_pod &b) +constant_multiple_p (Ca a, const poly_int &b) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_CAST (Cb, Ca) NCb; @@ -2091,8 +2002,7 @@ constant_multiple_p (Ca a, const poly_int_pod &b) template inline bool -constant_multiple_p (const poly_int_pod &a, - const poly_int_pod &b) +constant_multiple_p (const poly_int &a, const poly_int &b) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_CAST (Cb, Ca) NCb; @@ -2127,7 +2037,7 @@ multiple_p (Ca a, Cb b) template inline typename if_nonpoly::type -multiple_p (const poly_int_pod &a, Cb b) +multiple_p (const poly_int &a, Cb b) { for (unsigned int i = 0; i < N; ++i) if (a.coeffs[i] % b != 0) @@ -2139,7 +2049,7 @@ multiple_p (const poly_int_pod &a, Cb b) template inline typename if_nonpoly::type -multiple_p (Ca a, const poly_int_pod &b) +multiple_p (Ca a, const poly_int &b) { typedef POLY_INT_TYPE (Ca) int_type; @@ -2153,7 +2063,7 @@ multiple_p (Ca a, const poly_int_pod &b) template inline bool -multiple_p (const poly_int_pod &a, const poly_int_pod &b) +multiple_p (const poly_int &a, const poly_int &b) { if (b.is_constant ()) return multiple_p (a, b.coeffs[0]); @@ -2179,7 +2089,7 @@ multiple_p (Ca a, Cb b, Cm *multiple) template inline typename if_nonpoly::type -multiple_p (const poly_int_pod &a, Cb b, poly_int_pod *multiple) +multiple_p (const poly_int &a, Cb b, poly_int *multiple) { if (!multiple_p (a, b)) return false; @@ -2193,7 +2103,7 @@ multiple_p (const poly_int_pod &a, Cb b, poly_int_pod *multiple) template inline typename if_nonpoly::type -multiple_p (Ca a, const poly_int_pod &b, Cm *multiple) +multiple_p (Ca a, const poly_int &b, Cm *multiple) { typedef POLY_CAST (Ca, Cb) NCa; @@ -2211,8 +2121,8 @@ multiple_p (Ca a, const poly_int_pod &b, Cm *multiple) template inline bool -multiple_p (const poly_int_pod &a, const poly_int_pod &b, - poly_int_pod *multiple) +multiple_p (const poly_int &a, const poly_int &b, + poly_int *multiple) { if (b.is_constant ()) return multiple_p (a, b.coeffs[0], multiple); @@ -2223,7 +2133,7 @@ multiple_p (const poly_int_pod &a, const poly_int_pod &b, template inline POLY_CONST_RESULT (N, Ca, Cb) -exact_div (const poly_int_pod &a, Cb b) +exact_div (const poly_int &a, Cb b) { typedef POLY_CONST_COEFF (Ca, Cb) C; poly_int r; @@ -2239,7 +2149,7 @@ exact_div (const poly_int_pod &a, Cb b) template inline POLY_POLY_RESULT (N, Ca, Cb) -exact_div (const poly_int_pod &a, const poly_int_pod &b) +exact_div (const poly_int &a, const poly_int &b) { if (b.is_constant ()) return exact_div (a, b.coeffs[0]); @@ -2270,7 +2180,7 @@ exact_div (const poly_int_pod &a, const poly_int_pod &b) template inline typename if_nonpoly2::type -can_div_trunc_p (const poly_int_pod &a, Cb b, Cq *quotient) +can_div_trunc_p (const poly_int &a, Cb b, Cq *quotient) { typedef POLY_CAST (Ca, Cb) NCa; typedef POLY_CAST (Cb, Ca) NCb; @@ -2286,8 +2196,7 @@ can_div_trunc_p (const poly_int_pod &a, Cb b, Cq *quotient) template inline typename if_nonpoly::type -can_div_trunc_p (const poly_int_pod &a, - const poly_int_pod &b, +can_div_trunc_p (const poly_int &a, const poly_int &b, Cq *quotient) { /* We can calculate Q from the case in which the indeterminates @@ -2397,8 +2306,7 @@ can_div_trunc_p (const poly_int_pod &a, template inline typename if_nonpoly::type -can_div_trunc_p (const poly_int_pod &a, - const poly_int_pod &b, +can_div_trunc_p (const poly_int &a, const poly_int &b, Cq *quotient, Cr *remainder) { if (!can_div_trunc_p (a, b, quotient)) @@ -2417,8 +2325,8 @@ can_div_trunc_p (const poly_int_pod &a, template inline typename if_nonpoly::type -can_div_trunc_p (const poly_int_pod &a, Cb b, - poly_int_pod *quotient) +can_div_trunc_p (const poly_int &a, Cb b, + poly_int *quotient) { /* The remainder must be constant. */ for (unsigned int i = 1; i < N; ++i) @@ -2433,8 +2341,8 @@ can_div_trunc_p (const poly_int_pod &a, Cb b, template inline typename if_nonpoly::type -can_div_trunc_p (const poly_int_pod &a, Cb b, - poly_int_pod *quotient, Cr *remainder) +can_div_trunc_p (const poly_int &a, Cb b, + poly_int *quotient, Cr *remainder) { if (!can_div_trunc_p (a, b, quotient)) return false; @@ -2450,9 +2358,8 @@ can_div_trunc_p (const poly_int_pod &a, Cb b, template inline bool -can_div_trunc_p (const poly_int_pod &a, - const poly_int_pod &b, - poly_int_pod *quotient) +can_div_trunc_p (const poly_int &a, const poly_int &b, + poly_int *quotient) { if (b.is_constant ()) return can_div_trunc_p (a, b.coeffs[0], quotient); @@ -2473,8 +2380,7 @@ can_div_trunc_p (const poly_int_pod &a, template inline typename if_nonpoly::type -can_div_away_from_zero_p (const poly_int_pod &a, - const poly_int_pod &b, +can_div_away_from_zero_p (const poly_int &a, const poly_int &b, Cq *quotient) { if (!can_div_trunc_p (a, b, quotient)) @@ -2489,7 +2395,7 @@ can_div_away_from_zero_p (const poly_int_pod &a, template void -print_dec (const poly_int_pod &value, FILE *file, signop sgn) +print_dec (const poly_int &value, FILE *file, signop sgn) { if (value.is_constant ()) print_dec (value.coeffs[0], file, sgn); @@ -2509,7 +2415,7 @@ print_dec (const poly_int_pod &value, FILE *file, signop sgn) template void -print_dec (const poly_int_pod &value, FILE *file) +print_dec (const poly_int &value, FILE *file) { STATIC_ASSERT (poly_coeff_traits::signedness >= 0); print_dec (value, file, @@ -2520,7 +2426,7 @@ print_dec (const poly_int_pod &value, FILE *file) template void -print_hex (const poly_int_pod &value, FILE *file) +print_hex (const poly_int &value, FILE *file) { if (value.is_constant ()) print_hex (value.coeffs[0], file); @@ -2570,7 +2476,7 @@ struct poly_span_traits template static poly_int - cast (const poly_int_pod &x) { return x; } + cast (const poly_int &x) { return x; } }; /* Return true if SIZE represents a known size, assuming that all-ones @@ -2709,8 +2615,8 @@ endpoint_representable_p (const T &pos, const T &size) template inline bool -endpoint_representable_p (const poly_int_pod &pos, - const poly_int_pod &size) +endpoint_representable_p (const poly_int &pos, + const poly_int &size) { if (known_size_p (size)) for (unsigned int i = 0; i < N; ++i) @@ -2721,19 +2627,19 @@ endpoint_representable_p (const poly_int_pod &pos, template void -gt_ggc_mx (poly_int_pod *) +gt_ggc_mx (poly_int *) { } template void -gt_pch_nx (poly_int_pod *) +gt_pch_nx (poly_int *) { } template void -gt_pch_nx (poly_int_pod *, gt_pointer_operator, void *) +gt_pch_nx (poly_int *, gt_pointer_operator, void *) { } diff --git a/gcc/pretty-print.cc b/gcc/pretty-print.cc index 3d789a23812..ee01d895d61 100644 --- a/gcc/pretty-print.cc +++ b/gcc/pretty-print.cc @@ -811,7 +811,7 @@ pp_clear_state (pretty_printer *pp) /* Print X to PP in decimal. */ template void -pp_wide_integer (pretty_printer *pp, const poly_int_pod &x) +pp_wide_integer (pretty_printer *pp, const poly_int &x) { if (x.is_constant ()) pp_wide_integer (pp, x.coeffs[0]); @@ -828,9 +828,9 @@ pp_wide_integer (pretty_printer *pp, const poly_int_pod &x) } } -template void pp_wide_integer (pretty_printer *, const poly_uint16_pod &); -template void pp_wide_integer (pretty_printer *, const poly_int64_pod &); -template void pp_wide_integer (pretty_printer *, const poly_uint64_pod &); +template void pp_wide_integer (pretty_printer *, const poly_uint16 &); +template void pp_wide_integer (pretty_printer *, const poly_int64 &); +template void pp_wide_integer (pretty_printer *, const poly_uint64 &); /* Flush the formatted text of PRETTY-PRINTER onto the attached stream. */ void diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h index 0d9bc991a5a..8ba4296578b 100644 --- a/gcc/pretty-print.h +++ b/gcc/pretty-print.h @@ -445,6 +445,6 @@ pp_wide_int (pretty_printer *pp, const wide_int_ref &w, signop sgn) } template -void pp_wide_integer (pretty_printer *pp, const poly_int_pod &); +void pp_wide_integer (pretty_printer *pp, const poly_int &); #endif /* GCC_PRETTY_PRINT_H */ diff --git a/gcc/reload.cc b/gcc/reload.cc index 2126bdd117c..e0024792d4c 100644 --- a/gcc/reload.cc +++ b/gcc/reload.cc @@ -168,8 +168,8 @@ struct decomposition int reg_flag; /* Nonzero if referencing a register. */ int safe; /* Nonzero if this can't conflict with anything. */ rtx base; /* Base address for MEM. */ - poly_int64_pod start; /* Starting offset or register number. */ - poly_int64_pod end; /* Ending offset or register number. */ + poly_int64 start; /* Starting offset or register number. */ + poly_int64 end; /* Ending offset or register number. */ }; /* Save MEMs needed to copy from one class of registers to another. One MEM diff --git a/gcc/reload.h b/gcc/reload.h index 0982d0c5d51..9e8c060088d 100644 --- a/gcc/reload.h +++ b/gcc/reload.h @@ -97,7 +97,7 @@ struct reload /* Positive amount to increment or decrement by if reload_in is a PRE_DEC, PRE_INC, POST_DEC, POST_INC. Ignored otherwise (don't assume it is zero). */ - poly_int64_pod inc; + poly_int64 inc; /* A reg for which reload_in is the equivalent. If reload_in is a symbol_ref which came from reg_equiv_constant, then this is the pseudo diff --git a/gcc/reload1.cc b/gcc/reload1.cc index 9ba822d1ff7..55a416d79ce 100644 --- a/gcc/reload1.cc +++ b/gcc/reload1.cc @@ -196,7 +196,7 @@ static int last_spill_reg; static rtx spill_stack_slot[FIRST_PSEUDO_REGISTER]; /* Width allocated so far for that stack slot. */ -static poly_uint64_pod spill_stack_slot_width[FIRST_PSEUDO_REGISTER]; +static poly_uint64 spill_stack_slot_width[FIRST_PSEUDO_REGISTER]; /* Record which pseudos needed to be spilled. */ static regset_head spilled_pseudos; @@ -257,13 +257,13 @@ struct elim_table { int from; /* Register number to be eliminated. */ int to; /* Register number used as replacement. */ - poly_int64_pod initial_offset; /* Initial difference between values. */ + poly_int64 initial_offset; /* Initial difference between values. */ int can_eliminate; /* Nonzero if this elimination can be done. */ int can_eliminate_previous; /* Value returned by TARGET_CAN_ELIMINATE target hook in previous scan over insns made by reload. */ - poly_int64_pod offset; /* Current offset between the two regs. */ - poly_int64_pod previous_offset; /* Offset at end of previous insn. */ + poly_int64 offset; /* Current offset between the two regs. */ + poly_int64 previous_offset; /* Offset at end of previous insn. */ int ref_outside_mem; /* "to" has been referenced outside a MEM. */ rtx from_rtx; /* REG rtx for the register to be eliminated. We cannot simply compare the number since @@ -309,7 +309,7 @@ static int num_eliminable_invariants; static int first_label_num; static char *offsets_known_at; -static poly_int64_pod (*offsets_at)[NUM_ELIMINABLE_REGS]; +static poly_int64 (*offsets_at)[NUM_ELIMINABLE_REGS]; vec *reg_equivs; @@ -4020,7 +4020,7 @@ init_eliminable_invariants (rtx_insn *first, bool do_subregs) /* Allocate the tables used to store offset information at labels. */ offsets_known_at = XNEWVEC (char, num_labels); - offsets_at = (poly_int64_pod (*)[NUM_ELIMINABLE_REGS]) + offsets_at = (poly_int64 (*)[NUM_ELIMINABLE_REGS]) xmalloc (num_labels * NUM_ELIMINABLE_REGS * sizeof (poly_int64)); /* Look for REG_EQUIV notes; record what each pseudo is equivalent diff --git a/gcc/rtl.h b/gcc/rtl.h index 8e59cd5d156..6850281af62 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -204,7 +204,7 @@ union rtunion { int rt_int; unsigned int rt_uint; - poly_uint16_pod rt_subreg; + poly_uint16 rt_subreg; const char *rt_str; rtx rt_rtx; rtvec rt_rtvec; @@ -2402,7 +2402,7 @@ rtx_to_poly_int64 (const_rtx x) otherwise leave it unmodified. */ inline bool -poly_int_rtx_p (const_rtx x, poly_int64_pod *res) +poly_int_rtx_p (const_rtx x, poly_int64 *res) { if (CONST_INT_P (x)) { @@ -3630,7 +3630,7 @@ extern HOST_WIDE_INT get_integer_term (const_rtx); extern rtx get_related_value (const_rtx); extern bool offset_within_block_p (const_rtx, HOST_WIDE_INT); extern void split_const (rtx, rtx *, rtx *); -extern rtx strip_offset (rtx, poly_int64_pod *); +extern rtx strip_offset (rtx, poly_int64 *); extern poly_int64 get_args_size (const_rtx); extern bool unsigned_reg_p (rtx); extern bool reg_mentioned_p (const_rtx, const_rtx); @@ -4586,7 +4586,7 @@ load_extend_op (machine_mode mode) and return the base. Return X otherwise. */ inline rtx -strip_offset_and_add (rtx x, poly_int64_pod *offset) +strip_offset_and_add (rtx x, poly_int64 *offset) { if (GET_CODE (x) == PLUS) { diff --git a/gcc/rtlanal.cc b/gcc/rtlanal.cc index 8b48fc243a1..87267ee3b88 100644 --- a/gcc/rtlanal.cc +++ b/gcc/rtlanal.cc @@ -945,7 +945,7 @@ split_const (rtx x, rtx *base_out, rtx *offset_out) to a new rtx). Return the Y and store the offset in *OFFSET_OUT. */ rtx -strip_offset (rtx x, poly_int64_pod *offset_out) +strip_offset (rtx x, poly_int64 *offset_out) { rtx base = const0_rtx; rtx test = x; diff --git a/gcc/testsuite/gcc.dg/plugin/poly-int-tests.h b/gcc/testsuite/gcc.dg/plugin/poly-int-tests.h index 7af98595a5e..022ccd69cea 100644 --- a/gcc/testsuite/gcc.dg/plugin/poly-int-tests.h +++ b/gcc/testsuite/gcc.dg/plugin/poly-int-tests.h @@ -4839,11 +4839,11 @@ test_num_coeffs_extra () { /* Test the most common POD types. */ test_unsigned > (); + poly_int > (); test_signed > (); + poly_int > (); test_unsigned > (); + poly_int > (); /* Test some coefficient types that weren't covered in the core tests. */ test_signed