From: Richard Sandiford <richard.sandiford@arm.com>
To: gcc-patches@gcc.gnu.org
Cc: jakub@redhat.com
Subject: [PATCH] Remove poly_int_pod
Date: Thu, 28 Sep 2023 10:55:46 +0100 [thread overview]
Message-ID: <mptil7utye5.fsf@arm.com> (raw)
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<N, wide_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.
Tested on aarch64-linux-gnu & x86_64-linux-gnu. Also tested with
Jakub's vec.h patch with the static_asserts uncommented; there were
no errors from poly_int-related stuff. OK to install?
Richard
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.
---
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 f1e98ea1ab6..6efb24cbfba 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<NUM_POLY_INT_COEFFS, bitpack_word_t>
bp_unpack_poly_value (struct bitpack_d *bp, unsigned nbits)
{
- poly_int_pod<NUM_POLY_INT_COEFFS, bitpack_word_t> x;
+ poly_int<NUM_POLY_INT_COEFFS, bitpack_word_t> 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 308ddc09e63..e155da2dec6 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;
@@ -7884,8 +7884,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<unsigned int N, typename T>
- void add_poly_int (const poly_int_pod<N, T> &v)
+ void add_poly_int (const poly_int<N, T> &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<unsigned int N, typename T>
- void add_poly_hwi (const poly_int_pod<N, T> &v)
+ void add_poly_hwi (const poly_int<N, T> &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 4daaff1a124..79d94717a62 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<machine_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<tree, va_heap> 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<NUM_POLY_INT_COEFFS, unsigned short> poly_uint16_pod;
-typedef poly_int_pod<NUM_POLY_INT_COEFFS, HOST_WIDE_INT> poly_int64_pod;
-typedef poly_int_pod<NUM_POLY_INT_COEFFS,
- unsigned HOST_WIDE_INT> poly_uint64_pod;
-typedef poly_int_pod<NUM_POLY_INT_COEFFS, offset_int> poly_offset_int_pod;
-typedef poly_int_pod<NUM_POLY_INT_COEFFS, wide_int> poly_wide_int_pod;
-typedef poly_int_pod<NUM_POLY_INT_COEFFS, widest_int> poly_widest_int_pod;
-
typedef poly_int<NUM_POLY_INT_COEFFS, unsigned short> poly_uint16;
typedef poly_int<NUM_POLY_INT_COEFFS, HOST_WIDE_INT> poly_int64;
typedef poly_int<NUM_POLY_INT_COEFFS, unsigned HOST_WIDE_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<unsigned int N, typename T> struct poly_int_pod;
template<unsigned int N, typename T> class poly_int;
/* poly_coeff_traiits<T> describes the properties of a poly_int
@@ -58,7 +57,11 @@ template<unsigned int N, typename T> class poly_int;
- poly_coeff_traits<T>::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<T>::init_cast<Arg>::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<typename T, wi::precision_type = wi::int_traits<T>::precision_type>
struct poly_coeff_traits;
@@ -74,6 +77,9 @@ struct poly_coeff_traits<T, wi::FLEXIBLE_PRECISION>
+ ((T (1) << (precision - 2)) - 1))
: T (-1));
static const int rank = sizeof (T) * 2 + !signedness;
+
+ template<typename Arg>
+ struct init_cast { using type = T; };
};
template<typename T>
@@ -84,6 +90,9 @@ struct poly_coeff_traits<T, wi::VAR_PRECISION>
static const int signedness = -1;
static const int precision = WIDE_INT_MAX_PRECISION;
static const int rank = INT_MAX;
+
+ template<typename Arg>
+ struct init_cast { using type = const Arg &; };
};
template<typename T>
@@ -95,6 +104,9 @@ struct poly_coeff_traits<T, wi::CONST_PRECISION>
static const int signedness = 1;
static const int precision = wi::int_traits<T>::precision;
static const int rank = precision * 2 / CHAR_BIT;
+
+ template<typename Arg>
+ 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<T>::int_type int_type;
};
template<unsigned int N, typename C>
-struct poly_int_traits<poly_int_pod<N, C> >
+struct poly_int_traits<poly_int<N, C> >
{
static const bool is_poly = true;
static const unsigned int num_coeffs = N;
typedef C coeff_type;
typedef typename poly_coeff_traits<C>::int_type int_type;
};
-template<unsigned int N, typename C>
-struct poly_int_traits<poly_int<N, C> > : poly_int_traits<poly_int_pod<N, C> >
-{
-};
/* SFINAE class that makes T2 available as "type" if T1 is a non-polynomial
type. */
@@ -332,31 +340,55 @@ struct poly_result<T1, T2, 2>
? (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<B>::type is poly_int_full when B is true and
+ poly_int_hungry when B is false. */
+template<bool> struct poly_int_fullness;
+template<> struct poly_int_fullness<false> { using type = poly_int_hungry; };
+template<> struct poly_int_fullness<true> { using type = poly_int_full; };
+
+/* A class containing polynomial integers. The polynomial has N coefficients
+ of type C, and N - 1 indeterminates. */
template<unsigned int N, typename C>
-struct poly_int_pod
+struct poly_int
{
public:
+ poly_int () = default;
+ poly_int (const poly_int &) = default;
+
+ template<typename Ca>
+ poly_int (const poly_int<N, Ca> &);
+
+ template<typename ...Cs>
+ constexpr poly_int (const Cs &...);
+
+ poly_int &operator = (const poly_int &) = default;
+
template<typename Ca>
- poly_int_pod &operator = (const poly_int_pod<N, Ca> &);
+ poly_int &operator = (const poly_int<N, Ca> &);
template<typename Ca>
- typename if_nonpoly<Ca, poly_int_pod>::type &operator = (const Ca &);
+ typename if_nonpoly<Ca, poly_int>::type &operator = (const Ca &);
template<typename Ca>
- poly_int_pod &operator += (const poly_int_pod<N, Ca> &);
+ poly_int &operator += (const poly_int<N, Ca> &);
template<typename Ca>
- typename if_nonpoly<Ca, poly_int_pod>::type &operator += (const Ca &);
+ typename if_nonpoly<Ca, poly_int>::type &operator += (const Ca &);
template<typename Ca>
- poly_int_pod &operator -= (const poly_int_pod<N, Ca> &);
+ poly_int &operator -= (const poly_int<N, Ca> &);
template<typename Ca>
- typename if_nonpoly<Ca, poly_int_pod>::type &operator -= (const Ca &);
+ typename if_nonpoly<Ca, poly_int>::type &operator -= (const Ca &);
template<typename Ca>
- typename if_nonpoly<Ca, poly_int_pod>::type &operator *= (const Ca &);
+ typename if_nonpoly<Ca, poly_int>::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<typename Ca>
- static poly_int<N, C> from (const poly_int_pod<N, Ca> &, unsigned int,
+ static poly_int<N, C> from (const poly_int<N, Ca> &, unsigned int,
signop);
template<typename Ca>
- static poly_int<N, C> from (const poly_int_pod<N, Ca> &, signop);
+ static poly_int<N, C> from (const poly_int<N, Ca> &, signop);
- bool to_shwi (poly_int_pod<N, HOST_WIDE_INT> *) const;
- bool to_uhwi (poly_int_pod<N, unsigned HOST_WIDE_INT> *) const;
+ bool to_shwi (poly_int<N, HOST_WIDE_INT> *) const;
+ bool to_uhwi (poly_int<N, unsigned HOST_WIDE_INT> *) const;
poly_int<N, HOST_WIDE_INT> force_shwi () const;
poly_int<N, unsigned HOST_WIDE_INT> force_uhwi () const;
@@ -381,12 +413,50 @@ public:
#endif
C coeffs[N];
+
+private:
+ template<typename ...Cs>
+ constexpr poly_int (poly_int_full, const Cs &...);
+
+ template<typename C0, typename ...Cs>
+ constexpr poly_int (poly_int_hungry, const C0 &, const Cs &...);
};
template<unsigned int N, typename C>
template<typename Ca>
-inline poly_int_pod<N, C>&
-poly_int_pod<N, C>::operator = (const poly_int_pod<N, Ca> &a)
+inline
+poly_int<N, C>::poly_int (const poly_int<N, Ca> &a)
+{
+ for (unsigned int i = 0; i < N; i++)
+ POLY_SET_COEFF (C, *this, i, a.coeffs[i]);
+}
+
+template<unsigned int N, typename C>
+template<typename ...Cs>
+inline constexpr
+poly_int<N, C>::poly_int (const Cs &... cs)
+ : poly_int (typename poly_int_fullness<sizeof... (Cs) >= N>::type (),
+ cs...) {}
+
+/* Initialize with c0, cs..., and some trailing zeros. */
+template<unsigned int N, typename C>
+template<typename C0, typename ...Cs>
+inline constexpr
+poly_int<N, C>::poly_int (poly_int_hungry, const C0 &c0, const Cs &... cs)
+ : poly_int (c0, cs..., wi::ints_for<C>::zero (c0)) {}
+
+/* Initialize with cs... directly, casting where necessary. */
+template<unsigned int N, typename C>
+template<typename ...Cs>
+inline constexpr
+poly_int<N, C>::poly_int (poly_int_full, const Cs &... cs)
+ : coeffs { (typename poly_coeff_traits<C>::
+ template init_cast<Cs>::type (cs))... } {}
+
+template<unsigned int N, typename C>
+template<typename Ca>
+inline poly_int<N, C>&
+poly_int<N, C>::operator = (const poly_int<N, Ca> &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<N, C>::operator = (const poly_int_pod<N, Ca> &a)
template<unsigned int N, typename C>
template<typename Ca>
-inline typename if_nonpoly<Ca, poly_int_pod<N, C> >::type &
-poly_int_pod<N, C>::operator = (const Ca &a)
+inline typename if_nonpoly<Ca, poly_int<N, C> >::type &
+poly_int<N, C>::operator = (const Ca &a)
{
POLY_SET_COEFF (C, *this, 0, a);
if (N >= 2)
@@ -407,8 +477,8 @@ poly_int_pod<N, C>::operator = (const Ca &a)
template<unsigned int N, typename C>
template<typename Ca>
-inline poly_int_pod<N, C>&
-poly_int_pod<N, C>::operator += (const poly_int_pod<N, Ca> &a)
+inline poly_int<N, C>&
+poly_int<N, C>::operator += (const poly_int<N, Ca> &a)
{
for (unsigned int i = 0; i < N; i++)
this->coeffs[i] += a.coeffs[i];
@@ -417,8 +487,8 @@ poly_int_pod<N, C>::operator += (const poly_int_pod<N, Ca> &a)
template<unsigned int N, typename C>
template<typename Ca>
-inline typename if_nonpoly<Ca, poly_int_pod<N, C> >::type &
-poly_int_pod<N, C>::operator += (const Ca &a)
+inline typename if_nonpoly<Ca, poly_int<N, C> >::type &
+poly_int<N, C>::operator += (const Ca &a)
{
this->coeffs[0] += a;
return *this;
@@ -426,8 +496,8 @@ poly_int_pod<N, C>::operator += (const Ca &a)
template<unsigned int N, typename C>
template<typename Ca>
-inline poly_int_pod<N, C>&
-poly_int_pod<N, C>::operator -= (const poly_int_pod<N, Ca> &a)
+inline poly_int<N, C>&
+poly_int<N, C>::operator -= (const poly_int<N, Ca> &a)
{
for (unsigned int i = 0; i < N; i++)
this->coeffs[i] -= a.coeffs[i];
@@ -436,8 +506,8 @@ poly_int_pod<N, C>::operator -= (const poly_int_pod<N, Ca> &a)
template<unsigned int N, typename C>
template<typename Ca>
-inline typename if_nonpoly<Ca, poly_int_pod<N, C> >::type &
-poly_int_pod<N, C>::operator -= (const Ca &a)
+inline typename if_nonpoly<Ca, poly_int<N, C> >::type &
+poly_int<N, C>::operator -= (const Ca &a)
{
this->coeffs[0] -= a;
return *this;
@@ -445,8 +515,8 @@ poly_int_pod<N, C>::operator -= (const Ca &a)
template<unsigned int N, typename C>
template<typename Ca>
-inline typename if_nonpoly<Ca, poly_int_pod<N, C> >::type &
-poly_int_pod<N, C>::operator *= (const Ca &a)
+inline typename if_nonpoly<Ca, poly_int<N, C> >::type &
+poly_int<N, C>::operator *= (const Ca &a)
{
for (unsigned int i = 0; i < N; i++)
this->coeffs[i] *= a;
@@ -454,8 +524,8 @@ poly_int_pod<N, C>::operator *= (const Ca &a)
}
template<unsigned int N, typename C>
-inline poly_int_pod<N, C>&
-poly_int_pod<N, C>::operator <<= (unsigned int a)
+inline poly_int<N, C>&
+poly_int<N, C>::operator <<= (unsigned int a)
{
for (unsigned int i = 0; i < N; i++)
this->coeffs[i] <<= a;
@@ -466,7 +536,7 @@ poly_int_pod<N, C>::operator <<= (unsigned int a)
template<unsigned int N, typename C>
inline bool
-poly_int_pod<N, C>::is_constant () const
+poly_int<N, C>::is_constant () const
{
if (N >= 2)
for (unsigned int i = 1; i < N; i++)
@@ -481,7 +551,7 @@ poly_int_pod<N, C>::is_constant () const
template<unsigned int N, typename C>
template<typename T>
inline typename if_lossless<T, C, bool>::type
-poly_int_pod<N, C>::is_constant (T *const_value) const
+poly_int<N, C>::is_constant (T *const_value) const
{
if (is_constant ())
{
@@ -499,7 +569,7 @@ poly_int_pod<N, C>::is_constant (T *const_value) const
template<unsigned int N, typename C>
inline C
-poly_int_pod<N, C>::to_constant () const
+poly_int<N, C>::to_constant () const
{
gcc_checking_assert (is_constant ());
return this->coeffs[0];
@@ -512,8 +582,8 @@ poly_int_pod<N, C>::to_constant () const
template<unsigned int N, typename C>
template<typename Ca>
inline poly_int<N, C>
-poly_int_pod<N, C>::from (const poly_int_pod<N, Ca> &a,
- unsigned int bitsize, signop sgn)
+poly_int<N, C>::from (const poly_int<N, Ca> &a, unsigned int bitsize,
+ signop sgn)
{
poly_int<N, C> r;
for (unsigned int i = 0; i < N; i++)
@@ -527,7 +597,7 @@ poly_int_pod<N, C>::from (const poly_int_pod<N, Ca> &a,
template<unsigned int N, typename C>
template<typename Ca>
inline poly_int<N, C>
-poly_int_pod<N, C>::from (const poly_int_pod<N, Ca> &a, signop sgn)
+poly_int<N, C>::from (const poly_int<N, Ca> &a, signop sgn)
{
poly_int<N, C> r;
for (unsigned int i = 0; i < N; i++)
@@ -541,7 +611,7 @@ poly_int_pod<N, C>::from (const poly_int_pod<N, Ca> &a, signop sgn)
template<unsigned int N, typename C>
inline bool
-poly_int_pod<N, C>::to_shwi (poly_int_pod<N, HOST_WIDE_INT> *r) const
+poly_int<N, C>::to_shwi (poly_int<N, HOST_WIDE_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<N, C>::to_shwi (poly_int_pod<N, HOST_WIDE_INT> *r) const
template<unsigned int N, typename C>
inline bool
-poly_int_pod<N, C>::to_uhwi (poly_int_pod<N, unsigned HOST_WIDE_INT> *r) const
+poly_int<N, C>::to_uhwi (poly_int<N, unsigned HOST_WIDE_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<N, C>::to_uhwi (poly_int_pod<N, unsigned HOST_WIDE_INT> *r) const
template<unsigned int N, typename C>
inline poly_int<N, HOST_WIDE_INT>
-poly_int_pod<N, C>::force_shwi () const
+poly_int<N, C>::force_shwi () const
{
- poly_int_pod<N, HOST_WIDE_INT> r;
+ poly_int<N, HOST_WIDE_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<N, C>::force_shwi () const
template<unsigned int N, typename C>
inline poly_int<N, unsigned HOST_WIDE_INT>
-poly_int_pod<N, C>::force_uhwi () const
+poly_int<N, C>::force_uhwi () const
{
- poly_int_pod<N, unsigned HOST_WIDE_INT> r;
+ poly_int<N, unsigned HOST_WIDE_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<N, C>::force_uhwi () const
template<unsigned int N, typename C>
inline
-poly_int_pod<N, C>::operator C () const
+poly_int<N, C>::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<unsigned int N, typename C>
-class poly_int : public poly_int_pod<N, C>
-{
-public:
- poly_int () {}
-
- template<typename Ca>
- poly_int (const poly_int<N, Ca> &);
- template<typename Ca>
- poly_int (const poly_int_pod<N, Ca> &);
- template<typename C0>
- poly_int (const C0 &);
- template<typename C0, typename C1>
- poly_int (const C0 &, const C1 &);
-
- template<typename Ca>
- poly_int &operator = (const poly_int_pod<N, Ca> &);
- template<typename Ca>
- typename if_nonpoly<Ca, poly_int>::type &operator = (const Ca &);
-
- template<typename Ca>
- poly_int &operator += (const poly_int_pod<N, Ca> &);
- template<typename Ca>
- typename if_nonpoly<Ca, poly_int>::type &operator += (const Ca &);
-
- template<typename Ca>
- poly_int &operator -= (const poly_int_pod<N, Ca> &);
- template<typename Ca>
- typename if_nonpoly<Ca, poly_int>::type &operator -= (const Ca &);
-
- template<typename Ca>
- typename if_nonpoly<Ca, poly_int>::type &operator *= (const Ca &);
-
- poly_int &operator <<= (unsigned int);
-};
-
-template<unsigned int N, typename C>
-template<typename Ca>
-inline
-poly_int<N, C>::poly_int (const poly_int<N, Ca> &a)
-{
- for (unsigned int i = 0; i < N; i++)
- POLY_SET_COEFF (C, *this, i, a.coeffs[i]);
-}
-
-template<unsigned int N, typename C>
-template<typename Ca>
-inline
-poly_int<N, C>::poly_int (const poly_int_pod<N, Ca> &a)
-{
- for (unsigned int i = 0; i < N; i++)
- POLY_SET_COEFF (C, *this, i, a.coeffs[i]);
-}
-
-template<unsigned int N, typename C>
-template<typename C0>
-inline
-poly_int<N, C>::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<C>::zero (this->coeffs[0]));
-}
-
-template<unsigned int N, typename C>
-template<typename C0, typename C1>
-inline
-poly_int<N, C>::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<C>::zero (this->coeffs[0]));
-}
-
-template<unsigned int N, typename C>
-template<typename Ca>
-inline poly_int<N, C>&
-poly_int<N, C>::operator = (const poly_int_pod<N, Ca> &a)
-{
- for (unsigned int i = 0; i < N; i++)
- this->coeffs[i] = a.coeffs[i];
- return *this;
-}
-
-template<unsigned int N, typename C>
-template<typename Ca>
-inline typename if_nonpoly<Ca, poly_int<N, C> >::type &
-poly_int<N, C>::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<C>::zero (this->coeffs[0]);
- return *this;
-}
-
-template<unsigned int N, typename C>
-template<typename Ca>
-inline poly_int<N, C>&
-poly_int<N, C>::operator += (const poly_int_pod<N, Ca> &a)
-{
- for (unsigned int i = 0; i < N; i++)
- this->coeffs[i] += a.coeffs[i];
- return *this;
-}
-
-template<unsigned int N, typename C>
-template<typename Ca>
-inline typename if_nonpoly<Ca, poly_int<N, C> >::type &
-poly_int<N, C>::operator += (const Ca &a)
-{
- this->coeffs[0] += a;
- return *this;
-}
-
-template<unsigned int N, typename C>
-template<typename Ca>
-inline poly_int<N, C>&
-poly_int<N, C>::operator -= (const poly_int_pod<N, Ca> &a)
-{
- for (unsigned int i = 0; i < N; i++)
- this->coeffs[i] -= a.coeffs[i];
- return *this;
-}
-
-template<unsigned int N, typename C>
-template<typename Ca>
-inline typename if_nonpoly<Ca, poly_int<N, C> >::type &
-poly_int<N, C>::operator -= (const Ca &a)
-{
- this->coeffs[0] -= a;
- return *this;
-}
-
-template<unsigned int N, typename C>
-template<typename Ca>
-inline typename if_nonpoly<Ca, poly_int<N, C> >::type &
-poly_int<N, C>::operator *= (const Ca &a)
-{
- for (unsigned int i = 0; i < N; i++)
- this->coeffs[i] *= a;
- return *this;
-}
-
-template<unsigned int N, typename C>
-inline poly_int<N, C>&
-poly_int<N, C>::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<typename Ca, typename Cb, typename Cc>
@@ -774,7 +687,7 @@ coeffs_in_range_p (const Ca &a, const Cb &b, const Cc &c)
template<unsigned int N, typename Ca, typename Cb, typename Cc>
inline typename if_nonpoly<Ca, bool>::type
-coeffs_in_range_p (const poly_int_pod<N, Ca> &a, const Cb &b, const Cc &c)
+coeffs_in_range_p (const poly_int<N, Ca> &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<unsigned int N>
inline poly_int<N, hwi_with_prec>
-shwi (const poly_int_pod<N, HOST_WIDE_INT> &a, unsigned int precision)
+shwi (const poly_int<N, HOST_WIDE_INT> &a, unsigned int precision)
{
poly_int<N, hwi_with_prec> r;
for (unsigned int i = 0; i < N; i++)
@@ -799,7 +712,7 @@ shwi (const poly_int_pod<N, HOST_WIDE_INT> &a, unsigned int precision)
template<unsigned int N>
inline poly_int<N, hwi_with_prec>
-uhwi (const poly_int_pod<N, unsigned HOST_WIDE_INT> &a, unsigned int precision)
+uhwi (const poly_int<N, unsigned HOST_WIDE_INT> &a, unsigned int precision)
{
poly_int<N, hwi_with_prec> r;
for (unsigned int i = 0; i < N; i++)
@@ -811,7 +724,7 @@ uhwi (const poly_int_pod<N, unsigned HOST_WIDE_INT> &a, unsigned int precision)
template<unsigned int N, typename Ca>
inline POLY_POLY_RESULT (N, Ca, Ca)
-sext (const poly_int_pod<N, Ca> &a, unsigned int precision)
+sext (const poly_int<N, Ca> &a, unsigned int precision)
{
typedef POLY_POLY_COEFF (Ca, Ca) C;
poly_int<N, C> r;
@@ -824,7 +737,7 @@ sext (const poly_int_pod<N, Ca> &a, unsigned int precision)
template<unsigned int N, typename Ca>
inline POLY_POLY_RESULT (N, Ca, Ca)
-zext (const poly_int_pod<N, Ca> &a, unsigned int precision)
+zext (const poly_int<N, Ca> &a, unsigned int precision)
{
typedef POLY_POLY_COEFF (Ca, Ca) C;
poly_int<N, C> r;
@@ -836,7 +749,7 @@ zext (const poly_int_pod<N, Ca> &a, unsigned int precision)
template<unsigned int N, typename Ca, typename Cb>
inline POLY_POLY_RESULT (N, Ca, Cb)
-operator + (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
+operator + (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b)
{
typedef POLY_CAST (Ca, Cb) NCa;
typedef POLY_POLY_COEFF (Ca, Cb) C;
@@ -848,7 +761,7 @@ operator + (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline POLY_CONST_RESULT (N, Ca, Cb)
-operator + (const poly_int_pod<N, Ca> &a, const Cb &b)
+operator + (const poly_int<N, Ca> &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<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline CONST_POLY_RESULT (N, Ca, Cb)
-operator + (const Ca &a, const poly_int_pod<N, Cb> &b)
+operator + (const Ca &a, const poly_int<N, Cb> &b)
{
typedef POLY_CAST (Cb, Ca) NCb;
typedef CONST_POLY_COEFF (Ca, Cb) C;
@@ -879,7 +792,7 @@ namespace wi {
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, WI_BINARY_RESULT (Ca, Cb)>
-add (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
+add (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b)
{
typedef WI_BINARY_RESULT (Ca, Cb) C;
poly_int<N, C> r;
@@ -890,7 +803,7 @@ add (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, WI_BINARY_RESULT (Ca, Cb)>
-add (const poly_int_pod<N, Ca> &a, const Cb &b)
+add (const poly_int<N, Ca> &a, const Cb &b)
{
typedef WI_BINARY_RESULT (Ca, Cb) C;
poly_int<N, C> r;
@@ -903,7 +816,7 @@ add (const poly_int_pod<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, WI_BINARY_RESULT (Ca, Cb)>
-add (const Ca &a, const poly_int_pod<N, Cb> &b)
+add (const Ca &a, const poly_int<N, Cb> &b)
{
typedef WI_BINARY_RESULT (Ca, Cb) C;
poly_int<N, C> r;
@@ -916,7 +829,7 @@ add (const Ca &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, WI_BINARY_RESULT (Ca, Cb)>
-add (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b,
+add (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b,
signop sgn, wi::overflow_type *overflow)
{
typedef WI_BINARY_RESULT (Ca, Cb) C;
@@ -935,7 +848,7 @@ add (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b,
template<unsigned int N, typename Ca, typename Cb>
inline POLY_POLY_RESULT (N, Ca, Cb)
-operator - (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
+operator - (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b)
{
typedef POLY_CAST (Ca, Cb) NCa;
typedef POLY_POLY_COEFF (Ca, Cb) C;
@@ -947,7 +860,7 @@ operator - (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline POLY_CONST_RESULT (N, Ca, Cb)
-operator - (const poly_int_pod<N, Ca> &a, const Cb &b)
+operator - (const poly_int<N, Ca> &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<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline CONST_POLY_RESULT (N, Ca, Cb)
-operator - (const Ca &a, const poly_int_pod<N, Cb> &b)
+operator - (const Ca &a, const poly_int<N, Cb> &b)
{
typedef POLY_CAST (Cb, Ca) NCb;
typedef CONST_POLY_COEFF (Ca, Cb) C;
@@ -978,7 +891,7 @@ namespace wi {
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, WI_BINARY_RESULT (Ca, Cb)>
-sub (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
+sub (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b)
{
typedef WI_BINARY_RESULT (Ca, Cb) C;
poly_int<N, C> r;
@@ -989,7 +902,7 @@ sub (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, WI_BINARY_RESULT (Ca, Cb)>
-sub (const poly_int_pod<N, Ca> &a, const Cb &b)
+sub (const poly_int<N, Ca> &a, const Cb &b)
{
typedef WI_BINARY_RESULT (Ca, Cb) C;
poly_int<N, C> r;
@@ -1002,7 +915,7 @@ sub (const poly_int_pod<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, WI_BINARY_RESULT (Ca, Cb)>
-sub (const Ca &a, const poly_int_pod<N, Cb> &b)
+sub (const Ca &a, const poly_int<N, Cb> &b)
{
typedef WI_BINARY_RESULT (Ca, Cb) C;
poly_int<N, C> r;
@@ -1015,7 +928,7 @@ sub (const Ca &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, WI_BINARY_RESULT (Ca, Cb)>
-sub (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b,
+sub (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b,
signop sgn, wi::overflow_type *overflow)
{
typedef WI_BINARY_RESULT (Ca, Cb) C;
@@ -1034,7 +947,7 @@ sub (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b,
template<unsigned int N, typename Ca>
inline POLY_POLY_RESULT (N, Ca, Ca)
-operator - (const poly_int_pod<N, Ca> &a)
+operator - (const poly_int<N, Ca> &a)
{
typedef POLY_CAST (Ca, Ca) NCa;
typedef POLY_POLY_COEFF (Ca, Ca) C;
@@ -1049,7 +962,7 @@ namespace wi {
template<unsigned int N, typename Ca>
inline poly_int<N, WI_UNARY_RESULT (Ca)>
-neg (const poly_int_pod<N, Ca> &a)
+neg (const poly_int<N, Ca> &a)
{
typedef WI_UNARY_RESULT (Ca) C;
poly_int<N, C> r;
@@ -1060,7 +973,7 @@ neg (const poly_int_pod<N, Ca> &a)
template<unsigned int N, typename Ca>
inline poly_int<N, WI_UNARY_RESULT (Ca)>
-neg (const poly_int_pod<N, Ca> &a, wi::overflow_type *overflow)
+neg (const poly_int<N, Ca> &a, wi::overflow_type *overflow)
{
typedef WI_UNARY_RESULT (Ca) C;
poly_int<N, C> r;
@@ -1077,7 +990,7 @@ neg (const poly_int_pod<N, Ca> &a, wi::overflow_type *overflow)
template<unsigned int N, typename Ca>
inline POLY_POLY_RESULT (N, Ca, Ca)
-operator ~ (const poly_int_pod<N, Ca> &a)
+operator ~ (const poly_int<N, Ca> &a)
{
if (N >= 2)
return -1 - a;
@@ -1086,7 +999,7 @@ operator ~ (const poly_int_pod<N, Ca> &a)
template<unsigned int N, typename Ca, typename Cb>
inline POLY_CONST_RESULT (N, Ca, Cb)
-operator * (const poly_int_pod<N, Ca> &a, const Cb &b)
+operator * (const poly_int<N, Ca> &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<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline CONST_POLY_RESULT (N, Ca, Cb)
-operator * (const Ca &a, const poly_int_pod<N, Cb> &b)
+operator * (const Ca &a, const poly_int<N, Cb> &b)
{
typedef POLY_CAST (Ca, Cb) NCa;
typedef CONST_POLY_COEFF (Ca, Cb) C;
@@ -1113,7 +1026,7 @@ namespace wi {
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, WI_BINARY_RESULT (Ca, Cb)>
-mul (const poly_int_pod<N, Ca> &a, const Cb &b)
+mul (const poly_int<N, Ca> &a, const Cb &b)
{
typedef WI_BINARY_RESULT (Ca, Cb) C;
poly_int<N, C> r;
@@ -1124,7 +1037,7 @@ mul (const poly_int_pod<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, WI_BINARY_RESULT (Ca, Cb)>
-mul (const Ca &a, const poly_int_pod<N, Cb> &b)
+mul (const Ca &a, const poly_int<N, Cb> &b)
{
typedef WI_BINARY_RESULT (Ca, Cb) C;
poly_int<N, C> r;
@@ -1135,7 +1048,7 @@ mul (const Ca &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, WI_BINARY_RESULT (Ca, Cb)>
-mul (const poly_int_pod<N, Ca> &a, const Cb &b,
+mul (const poly_int<N, Ca> &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<N, Ca> &a, const Cb &b,
template<unsigned int N, typename Ca, typename Cb>
inline POLY_POLY_RESULT (N, Ca, Ca)
-operator << (const poly_int_pod<N, Ca> &a, const Cb &b)
+operator << (const poly_int<N, Ca> &a, const Cb &b)
{
typedef POLY_CAST (Ca, Ca) NCa;
typedef POLY_POLY_COEFF (Ca, Ca) C;
@@ -1168,7 +1081,7 @@ namespace wi {
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, WI_BINARY_RESULT (Ca, Ca)>
-lshift (const poly_int_pod<N, Ca> &a, const Cb &b)
+lshift (const poly_int<N, Ca> &a, const Cb &b)
{
typedef WI_BINARY_RESULT (Ca, Ca) C;
poly_int<N, C> r;
@@ -1184,7 +1097,7 @@ template<unsigned int N, typename C>
inline poly_int<N, HOST_WIDE_INT>
sext_hwi (const poly_int<N, C> &a, unsigned int precision)
{
- poly_int_pod<N, HOST_WIDE_INT> r;
+ poly_int<N, HOST_WIDE_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<unsigned int N, typename Ca, typename Cb>
inline bool
-maybe_eq (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
+maybe_eq (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b)
{
STATIC_ASSERT (N <= 2);
if (N == 2)
@@ -1246,7 +1159,7 @@ maybe_eq (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline typename if_nonpoly<Cb, bool>::type
-maybe_eq (const poly_int_pod<N, Ca> &a, const Cb &b)
+maybe_eq (const poly_int<N, Ca> &a, const Cb &b)
{
STATIC_ASSERT (N <= 2);
if (N == 2)
@@ -1256,7 +1169,7 @@ maybe_eq (const poly_int_pod<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline typename if_nonpoly<Ca, bool>::type
-maybe_eq (const Ca &a, const poly_int_pod<N, Cb> &b)
+maybe_eq (const Ca &a, const poly_int<N, Cb> &b)
{
STATIC_ASSERT (N <= 2);
if (N == 2)
@@ -1275,7 +1188,7 @@ maybe_eq (const Ca &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline bool
-maybe_ne (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
+maybe_ne (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b)
{
if (N >= 2)
for (unsigned int i = 1; i < N; i++)
@@ -1286,7 +1199,7 @@ maybe_ne (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline typename if_nonpoly<Cb, bool>::type
-maybe_ne (const poly_int_pod<N, Ca> &a, const Cb &b)
+maybe_ne (const poly_int<N, Ca> &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<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline typename if_nonpoly<Ca, bool>::type
-maybe_ne (const Ca &a, const poly_int_pod<N, Cb> &b)
+maybe_ne (const Ca &a, const poly_int<N, Cb> &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<unsigned int N, typename Ca, typename Cb>
inline bool
-maybe_le (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
+maybe_le (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b)
{
if (N >= 2)
for (unsigned int i = 1; i < N; i++)
@@ -1335,7 +1248,7 @@ maybe_le (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline typename if_nonpoly<Cb, bool>::type
-maybe_le (const poly_int_pod<N, Ca> &a, const Cb &b)
+maybe_le (const poly_int<N, Ca> &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<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline typename if_nonpoly<Ca, bool>::type
-maybe_le (const Ca &a, const poly_int_pod<N, Cb> &b)
+maybe_le (const Ca &a, const poly_int<N, Cb> &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<unsigned int N, typename Ca, typename Cb>
inline bool
-maybe_lt (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
+maybe_lt (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b)
{
if (N >= 2)
for (unsigned int i = 1; i < N; i++)
@@ -1377,7 +1290,7 @@ maybe_lt (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline typename if_nonpoly<Cb, bool>::type
-maybe_lt (const poly_int_pod<N, Ca> &a, const Cb &b)
+maybe_lt (const poly_int<N, Ca> &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<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline typename if_nonpoly<Ca, bool>::type
-maybe_lt (const Ca &a, const poly_int_pod<N, Cb> &b)
+maybe_lt (const Ca &a, const poly_int<N, Cb> &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<unsigned int N, typename Ca, typename Cb>
inline POLY_POLY_RESULT (N, Ca, Cb)
-ordered_min (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
+ordered_min (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b)
{
if (known_le (a, b))
return a;
@@ -1456,7 +1369,7 @@ ordered_min (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline CONST_POLY_RESULT (N, Ca, Cb)
-ordered_min (const Ca &a, const poly_int_pod<N, Cb> &b)
+ordered_min (const Ca &a, const poly_int<N, Cb> &b)
{
if (known_le (a, b))
return a;
@@ -1470,7 +1383,7 @@ ordered_min (const Ca &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline POLY_CONST_RESULT (N, Ca, Cb)
-ordered_min (const poly_int_pod<N, Ca> &a, const Cb &b)
+ordered_min (const poly_int<N, Ca> &a, const Cb &b)
{
if (known_le (a, b))
return a;
@@ -1490,7 +1403,7 @@ ordered_min (const poly_int_pod<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline POLY_POLY_RESULT (N, Ca, Cb)
-ordered_max (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
+ordered_max (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b)
{
if (known_le (a, b))
return b;
@@ -1504,7 +1417,7 @@ ordered_max (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline CONST_POLY_RESULT (N, Ca, Cb)
-ordered_max (const Ca &a, const poly_int_pod<N, Cb> &b)
+ordered_max (const Ca &a, const poly_int<N, Cb> &b)
{
if (known_le (a, b))
return b;
@@ -1518,7 +1431,7 @@ ordered_max (const Ca &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline POLY_CONST_RESULT (N, Ca, Cb)
-ordered_max (const poly_int_pod<N, Ca> &a, const Cb &b)
+ordered_max (const poly_int<N, Ca> &a, const Cb &b)
{
if (known_le (a, b))
return b;
@@ -1535,7 +1448,7 @@ ordered_max (const poly_int_pod<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca>
inline Ca
-constant_lower_bound (const poly_int_pod<N, Ca> &a)
+constant_lower_bound (const poly_int<N, Ca> &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<N, Ca> &a)
template<unsigned int N, typename Ca, typename Cb>
inline POLY_CONST_COEFF (Ca, Cb)
-constant_lower_bound_with_limit (const poly_int_pod<N, Ca> &a, const Cb &b)
+constant_lower_bound_with_limit (const poly_int<N, Ca> &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<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline POLY_CONST_COEFF (Ca, Cb)
-constant_upper_bound_with_limit (const poly_int_pod<N, Ca> &a, const Cb &b)
+constant_upper_bound_with_limit (const poly_int<N, Ca> &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<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline POLY_CONST_RESULT (N, Ca, Cb)
-lower_bound (const poly_int_pod<N, Ca> &a, const Cb &b)
+lower_bound (const poly_int<N, Ca> &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<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline CONST_POLY_RESULT (N, Ca, Cb)
-lower_bound (const Ca &a, const poly_int_pod<N, Cb> &b)
+lower_bound (const Ca &a, const poly_int<N, Cb> &b)
{
return lower_bound (b, a);
}
template<unsigned int N, typename Ca, typename Cb>
inline POLY_POLY_RESULT (N, Ca, Cb)
-lower_bound (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
+lower_bound (const poly_int<N, Ca> &a, const poly_int<N, Cb> &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<unsigned int N, typename Ca, typename Cb>
inline POLY_CONST_RESULT (N, Ca, Cb)
-upper_bound (const poly_int_pod<N, Ca> &a, const Cb &b)
+upper_bound (const poly_int<N, Ca> &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<N, Ca> &a, const Cb &b)
template<unsigned int N, typename Ca, typename Cb>
inline CONST_POLY_RESULT (N, Ca, Cb)
-upper_bound (const Ca &a, const poly_int_pod<N, Cb> &b)
+upper_bound (const Ca &a, const poly_int<N, Cb> &b)
{
return upper_bound (b, a);
}
template<unsigned int N, typename Ca, typename Cb>
inline POLY_POLY_RESULT (N, Ca, Cb)
-upper_bound (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
+upper_bound (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b)
{
typedef POLY_CAST (Ca, Cb) NCa;
typedef POLY_CAST (Cb, Ca) NCb;
@@ -1660,7 +1573,7 @@ upper_bound (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca>
inline POLY_BINARY_COEFF (Ca, Ca)
-coeff_gcd (const poly_int_pod<N, Ca> &a)
+coeff_gcd (const poly_int<N, Ca> &a)
{
/* Find the first nonzero coefficient, stopping at 0 whatever happens. */
unsigned int i;
@@ -1681,7 +1594,7 @@ coeff_gcd (const poly_int_pod<N, Ca> &a)
template<unsigned int N, typename Ca, typename Cb>
POLY_CONST_RESULT (N, Ca, Cb)
-common_multiple (const poly_int_pod<N, Ca> &a, Cb b)
+common_multiple (const poly_int<N, Ca> &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<N, Ca> &a, Cb b)
template<unsigned int N, typename Ca, typename Cb>
inline CONST_POLY_RESULT (N, Ca, Cb)
-common_multiple (const Ca &a, const poly_int_pod<N, Cb> &b)
+common_multiple (const Ca &a, const poly_int<N, Cb> &b)
{
return common_multiple (b, a);
}
@@ -1704,8 +1617,7 @@ common_multiple (const Ca &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
POLY_POLY_RESULT (N, Ca, Cb)
-force_common_multiple (const poly_int_pod<N, Ca> &a,
- const poly_int_pod<N, Cb> &b)
+force_common_multiple (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b)
{
if (b.is_constant ())
return common_multiple (a, b.coeffs[0]);
@@ -1743,8 +1655,7 @@ force_common_multiple (const poly_int_pod<N, Ca> &a,
template<unsigned int N, typename Ca, typename Cb>
inline int
-compare_sizes_for_sort (const poly_int_pod<N, Ca> &a,
- const poly_int_pod<N, Cb> &b)
+compare_sizes_for_sort (const poly_int<N, Ca> &a, const poly_int<N, Cb> &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<N, Ca> &a,
template<unsigned int N, typename Ca, typename Cb>
inline bool
-can_align_p (const poly_int_pod<N, Ca> &value, Cb align)
+can_align_p (const poly_int<N, Ca> &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<N, Ca> &value, Cb align)
template<unsigned int N, typename Ca, typename Cb>
inline bool
-can_align_up (const poly_int_pod<N, Ca> &value, Cb align,
- poly_int_pod<N, Ca> *aligned)
+can_align_up (const poly_int<N, Ca> &value, Cb align,
+ poly_int<N, Ca> *aligned)
{
if (!can_align_p (value, align))
return false;
@@ -1783,8 +1694,8 @@ can_align_up (const poly_int_pod<N, Ca> &value, Cb align,
template<unsigned int N, typename Ca, typename Cb>
inline bool
-can_align_down (const poly_int_pod<N, Ca> &value, Cb align,
- poly_int_pod<N, Ca> *aligned)
+can_align_down (const poly_int<N, Ca> &value, Cb align,
+ poly_int<N, Ca> *aligned)
{
if (!can_align_p (value, align))
return false;
@@ -1798,8 +1709,8 @@ can_align_down (const poly_int_pod<N, Ca> &value, Cb align,
template<unsigned int N, typename Ca, typename Cb, typename Cc>
inline bool
-known_equal_after_align_up (const poly_int_pod<N, Ca> &a,
- const poly_int_pod<N, Cb> &b,
+known_equal_after_align_up (const poly_int<N, Ca> &a,
+ const poly_int<N, Cb> &b,
Cc align)
{
poly_int<N, Ca> aligned_a;
@@ -1815,8 +1726,8 @@ known_equal_after_align_up (const poly_int_pod<N, Ca> &a,
template<unsigned int N, typename Ca, typename Cb, typename Cc>
inline bool
-known_equal_after_align_down (const poly_int_pod<N, Ca> &a,
- const poly_int_pod<N, Cb> &b,
+known_equal_after_align_down (const poly_int<N, Ca> &a,
+ const poly_int<N, Cb> &b,
Cc align)
{
poly_int<N, Ca> aligned_a;
@@ -1835,7 +1746,7 @@ known_equal_after_align_down (const poly_int_pod<N, Ca> &a,
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, Ca>
-force_align_up (const poly_int_pod<N, Ca> &value, Cb align)
+force_align_up (const poly_int<N, Ca> &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<N, Ca> &value, Cb align)
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, Ca>
-force_align_down (const poly_int_pod<N, Ca> &value, Cb align)
+force_align_down (const poly_int<N, Ca> &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<N, Ca> &value, Cb align)
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, Ca>
-aligned_lower_bound (const poly_int_pod<N, Ca> &value, Cb align)
+aligned_lower_bound (const poly_int<N, Ca> &value, Cb align)
{
poly_int<N, Ca> r;
for (unsigned int i = 0; i < N; i++)
@@ -1879,7 +1790,7 @@ aligned_lower_bound (const poly_int_pod<N, Ca> &value, Cb align)
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, Ca>
-aligned_upper_bound (const poly_int_pod<N, Ca> &value, Cb align)
+aligned_upper_bound (const poly_int<N, Ca> &value, Cb align)
{
poly_int<N, Ca> r;
for (unsigned int i = 0; i < N; i++)
@@ -1898,7 +1809,7 @@ aligned_upper_bound (const poly_int_pod<N, Ca> &value, Cb align)
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, Ca>
-force_align_down_and_div (const poly_int_pod<N, Ca> &value, Cb align)
+force_align_down_and_div (const poly_int<N, Ca> &value, Cb align)
{
gcc_checking_assert (can_align_p (value, align));
@@ -1922,7 +1833,7 @@ force_align_down_and_div (const poly_int_pod<N, Ca> &value, Cb align)
template<unsigned int N, typename Ca, typename Cb>
inline poly_int<N, Ca>
-force_align_up_and_div (const poly_int_pod<N, Ca> &value, Cb align)
+force_align_up_and_div (const poly_int<N, Ca> &value, Cb align)
{
gcc_checking_assert (can_align_p (value, align));
@@ -1942,7 +1853,7 @@ force_align_up_and_div (const poly_int_pod<N, Ca> &value, Cb align)
template<unsigned int N, typename Ca, typename Cb, typename Cm>
inline bool
-known_misalignment (const poly_int_pod<N, Ca> &value, Cb align, Cm *misalign)
+known_misalignment (const poly_int<N, Ca> &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<N, Ca> &value, Cb align, Cm *misalign)
template<unsigned int N, typename Ca, typename Cb>
inline POLY_BINARY_COEFF (Ca, Ca)
-force_get_misalignment (const poly_int_pod<N, Ca> &a, Cb align)
+force_get_misalignment (const poly_int<N, Ca> &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<N, Ca> &a, Cb align)
template<unsigned int N, typename Ca>
inline POLY_BINARY_COEFF (Ca, Ca)
-known_alignment (const poly_int_pod<N, Ca> &a)
+known_alignment (const poly_int<N, Ca> &a)
{
typedef POLY_BINARY_COEFF (Ca, Ca) C;
C r = a.coeffs[0];
@@ -1982,7 +1893,7 @@ known_alignment (const poly_int_pod<N, Ca> &a)
template<unsigned int N, typename Ca, typename Cb, typename Cr>
inline typename if_nonpoly<Cb, bool>::type
-can_ior_p (const poly_int_pod<N, Ca> &a, Cb b, Cr *result)
+can_ior_p (const poly_int<N, Ca> &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<N, Ca> &a, Cb b, Cr *result)
template<unsigned int N, typename Ca, typename Cb, typename Cm>
inline typename if_nonpoly<Cb, bool>::type
-constant_multiple_p (const poly_int_pod<N, Ca> &a, Cb b, Cm *multiple)
+constant_multiple_p (const poly_int<N, Ca> &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<N, Ca> &a, Cb b, Cm *multiple)
template<unsigned int N, typename Ca, typename Cb, typename Cm>
inline typename if_nonpoly<Ca, bool>::type
-constant_multiple_p (Ca a, const poly_int_pod<N, Cb> &b, Cm *multiple)
+constant_multiple_p (Ca a, const poly_int<N, Cb> &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<N, Cb> &b, Cm *multiple)
template<unsigned int N, typename Ca, typename Cb, typename Cm>
inline bool
-constant_multiple_p (const poly_int_pod<N, Ca> &a,
- const poly_int_pod<N, Cb> &b, Cm *multiple)
+constant_multiple_p (const poly_int<N, Ca> &a,
+ const poly_int<N, Cb> &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<N, Ca> &a,
template<unsigned int N, typename Ca, typename Cb>
inline typename if_nonpoly<Cb, bool>::type
-constant_multiple_p (const poly_int_pod<N, Ca> &a, Cb b)
+constant_multiple_p (const poly_int<N, Ca> &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<N, Ca> &a, Cb b)
template<unsigned int N, typename Ca, typename Cb>
inline typename if_nonpoly<Ca, bool>::type
-constant_multiple_p (Ca a, const poly_int_pod<N, Cb> &b)
+constant_multiple_p (Ca a, const poly_int<N, Cb> &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<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline bool
-constant_multiple_p (const poly_int_pod<N, Ca> &a,
- const poly_int_pod<N, Cb> &b)
+constant_multiple_p (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b)
{
typedef POLY_CAST (Ca, Cb) NCa;
typedef POLY_CAST (Cb, Ca) NCb;
@@ -2127,7 +2037,7 @@ multiple_p (Ca a, Cb b)
template<unsigned int N, typename Ca, typename Cb>
inline typename if_nonpoly<Cb, bool>::type
-multiple_p (const poly_int_pod<N, Ca> &a, Cb b)
+multiple_p (const poly_int<N, Ca> &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<N, Ca> &a, Cb b)
template<unsigned int N, typename Ca, typename Cb>
inline typename if_nonpoly<Ca, bool>::type
-multiple_p (Ca a, const poly_int_pod<N, Cb> &b)
+multiple_p (Ca a, const poly_int<N, Cb> &b)
{
typedef POLY_INT_TYPE (Ca) int_type;
@@ -2153,7 +2063,7 @@ multiple_p (Ca a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb>
inline bool
-multiple_p (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
+multiple_p (const poly_int<N, Ca> &a, const poly_int<N, Cb> &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<unsigned int N, typename Ca, typename Cb, typename Cm>
inline typename if_nonpoly<Cb, bool>::type
-multiple_p (const poly_int_pod<N, Ca> &a, Cb b, poly_int_pod<N, Cm> *multiple)
+multiple_p (const poly_int<N, Ca> &a, Cb b, poly_int<N, Cm> *multiple)
{
if (!multiple_p (a, b))
return false;
@@ -2193,7 +2103,7 @@ multiple_p (const poly_int_pod<N, Ca> &a, Cb b, poly_int_pod<N, Cm> *multiple)
template<unsigned int N, typename Ca, typename Cb, typename Cm>
inline typename if_nonpoly<Ca, bool>::type
-multiple_p (Ca a, const poly_int_pod<N, Cb> &b, Cm *multiple)
+multiple_p (Ca a, const poly_int<N, Cb> &b, Cm *multiple)
{
typedef POLY_CAST (Ca, Cb) NCa;
@@ -2211,8 +2121,8 @@ multiple_p (Ca a, const poly_int_pod<N, Cb> &b, Cm *multiple)
template<unsigned int N, typename Ca, typename Cb, typename Cm>
inline bool
-multiple_p (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b,
- poly_int_pod<N, Cm> *multiple)
+multiple_p (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b,
+ poly_int<N, Cm> *multiple)
{
if (b.is_constant ())
return multiple_p (a, b.coeffs[0], multiple);
@@ -2223,7 +2133,7 @@ multiple_p (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b,
template<unsigned int N, typename Ca, typename Cb>
inline POLY_CONST_RESULT (N, Ca, Cb)
-exact_div (const poly_int_pod<N, Ca> &a, Cb b)
+exact_div (const poly_int<N, Ca> &a, Cb b)
{
typedef POLY_CONST_COEFF (Ca, Cb) C;
poly_int<N, C> r;
@@ -2239,7 +2149,7 @@ exact_div (const poly_int_pod<N, Ca> &a, Cb b)
template<unsigned int N, typename Ca, typename Cb>
inline POLY_POLY_RESULT (N, Ca, Cb)
-exact_div (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
+exact_div (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b)
{
if (b.is_constant ())
return exact_div (a, b.coeffs[0]);
@@ -2270,7 +2180,7 @@ exact_div (const poly_int_pod<N, Ca> &a, const poly_int_pod<N, Cb> &b)
template<unsigned int N, typename Ca, typename Cb, typename Cq>
inline typename if_nonpoly2<Cb, Cq, bool>::type
-can_div_trunc_p (const poly_int_pod<N, Ca> &a, Cb b, Cq *quotient)
+can_div_trunc_p (const poly_int<N, Ca> &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<N, Ca> &a, Cb b, Cq *quotient)
template<unsigned int N, typename Ca, typename Cb, typename Cq>
inline typename if_nonpoly<Cq, bool>::type
-can_div_trunc_p (const poly_int_pod<N, Ca> &a,
- const poly_int_pod<N, Cb> &b,
+can_div_trunc_p (const poly_int<N, Ca> &a, const poly_int<N, Cb> &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<N, Ca> &a,
template<unsigned int N, typename Ca, typename Cb, typename Cq, typename Cr>
inline typename if_nonpoly<Cq, bool>::type
-can_div_trunc_p (const poly_int_pod<N, Ca> &a,
- const poly_int_pod<N, Cb> &b,
+can_div_trunc_p (const poly_int<N, Ca> &a, const poly_int<N, Cb> &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<N, Ca> &a,
template<unsigned int N, typename Ca, typename Cb, typename Cq>
inline typename if_nonpoly<Cb, bool>::type
-can_div_trunc_p (const poly_int_pod<N, Ca> &a, Cb b,
- poly_int_pod<N, Cq> *quotient)
+can_div_trunc_p (const poly_int<N, Ca> &a, Cb b,
+ poly_int<N, Cq> *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<N, Ca> &a, Cb b,
template<unsigned int N, typename Ca, typename Cb, typename Cq, typename Cr>
inline typename if_nonpoly<Cb, bool>::type
-can_div_trunc_p (const poly_int_pod<N, Ca> &a, Cb b,
- poly_int_pod<N, Cq> *quotient, Cr *remainder)
+can_div_trunc_p (const poly_int<N, Ca> &a, Cb b,
+ poly_int<N, Cq> *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<N, Ca> &a, Cb b,
template<unsigned int N, typename Ca, typename Cb, typename Cq>
inline bool
-can_div_trunc_p (const poly_int_pod<N, Ca> &a,
- const poly_int_pod<N, Cb> &b,
- poly_int_pod<N, Cq> *quotient)
+can_div_trunc_p (const poly_int<N, Ca> &a, const poly_int<N, Cb> &b,
+ poly_int<N, Cq> *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<N, Ca> &a,
template<unsigned int N, typename Ca, typename Cb, typename Cq>
inline typename if_nonpoly<Cq, bool>::type
-can_div_away_from_zero_p (const poly_int_pod<N, Ca> &a,
- const poly_int_pod<N, Cb> &b,
+can_div_away_from_zero_p (const poly_int<N, Ca> &a, const poly_int<N, Cb> &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<N, Ca> &a,
template<unsigned int N, typename C>
void
-print_dec (const poly_int_pod<N, C> &value, FILE *file, signop sgn)
+print_dec (const poly_int<N, C> &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<N, C> &value, FILE *file, signop sgn)
template<unsigned int N, typename C>
void
-print_dec (const poly_int_pod<N, C> &value, FILE *file)
+print_dec (const poly_int<N, C> &value, FILE *file)
{
STATIC_ASSERT (poly_coeff_traits<C>::signedness >= 0);
print_dec (value, file,
@@ -2520,7 +2426,7 @@ print_dec (const poly_int_pod<N, C> &value, FILE *file)
template<unsigned int N, typename C>
void
-print_hex (const poly_int_pod<N, C> &value, FILE *file)
+print_hex (const poly_int<N, C> &value, FILE *file)
{
if (value.is_constant ())
print_hex (value.coeffs[0], file);
@@ -2570,7 +2476,7 @@ struct poly_span_traits<T1, T2, unsigned HOST_WIDE_INT>
template<unsigned int N, typename T>
static poly_int<N, unsigned HOST_WIDE_INT>
- cast (const poly_int_pod<N, T> &x) { return x; }
+ cast (const poly_int<N, T> &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<unsigned int N, typename C>
inline bool
-endpoint_representable_p (const poly_int_pod<N, C> &pos,
- const poly_int_pod<N, C> &size)
+endpoint_representable_p (const poly_int<N, C> &pos,
+ const poly_int<N, C> &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<N, C> &pos,
template<unsigned int N, typename C>
void
-gt_ggc_mx (poly_int_pod<N, C> *)
+gt_ggc_mx (poly_int<N, C> *)
{
}
template<unsigned int N, typename C>
void
-gt_pch_nx (poly_int_pod<N, C> *)
+gt_pch_nx (poly_int<N, C> *)
{
}
template<unsigned int N, typename C>
void
-gt_pch_nx (poly_int_pod<N, C> *, gt_pointer_operator, void *)
+gt_pch_nx (poly_int<N, C> *, 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<unsigned int N, typename T>
void
-pp_wide_integer (pretty_printer *pp, const poly_int_pod<N, T> &x)
+pp_wide_integer (pretty_printer *pp, const poly_int<N, T> &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<N, T> &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<unsigned int N, typename T>
-void pp_wide_integer (pretty_printer *pp, const poly_int_pod<N, T> &);
+void pp_wide_integer (pretty_printer *pp, const poly_int<N, T> &);
#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_t, va_gc> *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 102ad9b57a6..7532d570467 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);
@@ -4583,7 +4583,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<N, unsigned short, HOST_WIDE_INT,
- poly_int_pod<N, unsigned short> > ();
+ poly_int<N, unsigned short> > ();
test_signed<N, HOST_WIDE_INT, HOST_WIDE_INT,
- poly_int_pod<N, HOST_WIDE_INT> > ();
+ poly_int<N, HOST_WIDE_INT> > ();
test_unsigned<N, unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT,
- poly_int_pod<N, unsigned HOST_WIDE_INT> > ();
+ poly_int<N, unsigned HOST_WIDE_INT> > ();
/* Test some coefficient types that weren't covered in the core tests. */
test_signed<N, int, HOST_WIDE_INT,
diff --git a/gcc/tree-dfa.cc b/gcc/tree-dfa.cc
index ad8cfedec8c..af8e9243947 100644
--- a/gcc/tree-dfa.cc
+++ b/gcc/tree-dfa.cc
@@ -372,9 +372,9 @@ get_or_create_ssa_default_def (struct function *fn, tree var)
true, the storage order of the reference is reversed. */
tree
-get_ref_base_and_extent (tree exp, poly_int64_pod *poffset,
- poly_int64_pod *psize,
- poly_int64_pod *pmax_size,
+get_ref_base_and_extent (tree exp, poly_int64 *poffset,
+ poly_int64 *psize,
+ poly_int64 *pmax_size,
bool *preverse)
{
poly_offset_int bitsize = -1;
@@ -765,7 +765,7 @@ get_ref_base_and_extent_hwi (tree exp, HOST_WIDE_INT *poffset,
its argument or a constant if the argument is known to be constant. */
tree
-get_addr_base_and_unit_offset_1 (tree exp, poly_int64_pod *poffset,
+get_addr_base_and_unit_offset_1 (tree exp, poly_int64 *poffset,
tree (*valueize) (tree))
{
poly_int64 byte_offset = 0;
@@ -907,7 +907,7 @@ done:
is not BITS_PER_UNIT-aligned. */
tree
-get_addr_base_and_unit_offset (tree exp, poly_int64_pod *poffset)
+get_addr_base_and_unit_offset (tree exp, poly_int64 *poffset)
{
return get_addr_base_and_unit_offset_1 (exp, poffset, NULL);
}
diff --git a/gcc/tree-dfa.h b/gcc/tree-dfa.h
index 074a4da3a6c..e27baa8aa17 100644
--- a/gcc/tree-dfa.h
+++ b/gcc/tree-dfa.h
@@ -30,13 +30,13 @@ extern void debug_dfa_stats (void);
extern tree ssa_default_def (struct function *, tree);
extern void set_ssa_default_def (struct function *, tree, tree);
extern tree get_or_create_ssa_default_def (struct function *, tree);
-extern tree get_ref_base_and_extent (tree, poly_int64_pod *, poly_int64_pod *,
- poly_int64_pod *, bool *);
+extern tree get_ref_base_and_extent (tree, poly_int64 *, poly_int64 *,
+ poly_int64 *, bool *);
extern tree get_ref_base_and_extent_hwi (tree, HOST_WIDE_INT *,
HOST_WIDE_INT *, bool *);
-extern tree get_addr_base_and_unit_offset_1 (tree, poly_int64_pod *,
+extern tree get_addr_base_and_unit_offset_1 (tree, poly_int64 *,
tree (*) (tree));
-extern tree get_addr_base_and_unit_offset (tree, poly_int64_pod *);
+extern tree get_addr_base_and_unit_offset (tree, poly_int64 *);
extern bool stmt_references_abnormal_ssa_name (gimple *);
extern void replace_abnormal_ssa_names (gimple *);
extern void dump_enumerated_decls (FILE *, dump_flags_t);
diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc
index 3d3f28f7f3b..339f37d8720 100644
--- a/gcc/tree-ssa-loop-ivopts.cc
+++ b/gcc/tree-ssa-loop-ivopts.cc
@@ -412,7 +412,7 @@ struct iv_use
tree *op_p; /* The place where it occurs. */
tree addr_base; /* Base address with const offset stripped. */
- poly_uint64_pod addr_offset;
+ poly_uint64 addr_offset;
/* Const offset stripped from base address. */
};
@@ -2956,7 +2956,7 @@ strip_offset_1 (tree expr, bool inside_addr, bool top_compref,
/* Strips constant offsets from EXPR and stores them to OFFSET. */
static tree
-strip_offset (tree expr, poly_uint64_pod *offset)
+strip_offset (tree expr, poly_uint64 *offset)
{
poly_int64 off;
tree core = strip_offset_1 (expr, false, false, &off);
diff --git a/gcc/tree-ssa-sccvn.h b/gcc/tree-ssa-sccvn.h
index 675240ebb9d..98d70e0ffe0 100644
--- a/gcc/tree-ssa-sccvn.h
+++ b/gcc/tree-ssa-sccvn.h
@@ -114,7 +114,7 @@ typedef struct vn_reference_op_struct
/* For storing TYPE_ALIGN for array ref element size computation. */
unsigned align : 6;
/* Constant offset this op adds or -1 if it is variable. */
- poly_int64_pod off;
+ poly_int64 off;
tree type;
tree op0;
tree op1;
diff --git a/gcc/tree.cc b/gcc/tree.cc
index 8a8d6d5091a..54ca5e750df 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -3289,7 +3289,7 @@ really_constant_p (const_tree exp)
like sizetype is used to encode a value that is actually negative. */
bool
-ptrdiff_tree_p (const_tree t, poly_int64_pod *value)
+ptrdiff_tree_p (const_tree t, poly_int64 *value)
{
if (!t)
return false;
diff --git a/gcc/tree.h b/gcc/tree.h
index 54cf8282cb2..005c157e9b0 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4974,7 +4974,7 @@ extern tree max_object_size ();
without loss of precision. Store the value in *VALUE if so. */
inline bool
-poly_int_tree_p (const_tree t, poly_int64_pod *value)
+poly_int_tree_p (const_tree t, poly_int64 *value)
{
if (tree_fits_poly_int64_p (t))
{
@@ -4988,7 +4988,7 @@ poly_int_tree_p (const_tree t, poly_int64_pod *value)
without loss of precision. Store the value in *VALUE if so. */
inline bool
-poly_int_tree_p (const_tree t, poly_uint64_pod *value)
+poly_int_tree_p (const_tree t, poly_uint64 *value)
{
if (tree_fits_poly_uint64_p (t))
{
@@ -5617,7 +5617,7 @@ bit_field_offset (const_tree t)
extern tree strip_float_extensions (tree);
extern bool really_constant_p (const_tree);
-extern bool ptrdiff_tree_p (const_tree, poly_int64_pod *);
+extern bool ptrdiff_tree_p (const_tree, poly_int64 *);
extern bool decl_address_invariant_p (const_tree);
extern bool decl_address_ip_invariant_p (const_tree);
extern bool int_fits_type_p (const_tree, const_tree)
@@ -6637,7 +6637,7 @@ extern bool complete_ctor_at_level_p (const_tree, HOST_WIDE_INT, const_tree);
/* Given an expression EXP that is a handled_component_p,
look for the ultimate containing object, which is returned and specify
the access position and size. */
-extern tree get_inner_reference (tree, poly_int64_pod *, poly_int64_pod *,
+extern tree get_inner_reference (tree, poly_int64 *, poly_int64 *,
tree *, machine_mode *, int *, int *, int *);
extern tree build_personality_function (const char *);
--
2.25.1
next reply other threads:[~2023-09-28 9:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-28 9:55 Richard Sandiford [this message]
2023-09-28 14:06 ` Jakub Jelinek
2023-09-28 17:26 ` Jason Merrill
2023-09-28 19:09 ` Jeff Law
2023-09-29 6:31 ` Richard Biener
2023-09-29 8:14 ` Jakub Jelinek
2023-10-02 7:47 ` Jan-Benedict Glaw
2023-10-02 7:50 ` Richard Sandiford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mptil7utye5.fsf@arm.com \
--to=richard.sandiford@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).