On 2/15/23 12:50, Andrew MacLeod wrote:
On 2/15/23 12:13, Tamar Christina wrote:
On 2/15/23 07:51, Tamar Christina wrote:
void
operator_plus::wi_fold (irange &r, tree type,
const wide_int &lh_lb, const wide_int &lh_ub,
const wide_int &rh_lb, const wide_int &rh_ub)
const
{
wi::overflow_type ov_lb, ov_ub;
signop s = TYPE_SIGN (type);
// Do whatever wideint magic is required to do this adds in higher
precision
wide_int new_lb = wi::add (lh_lb, rh_lb, s, &ov_lb);
wide_int new_ub = wi::add (lh_ub, rh_ub, s, &ov_ub);
r = int_range<2> (type, new_lb, new_ub);
}
The operator needs to be registered, I've attached the skeleton for
it. you should just have to finish implementing wi_fold().
in theory :-)
You also mentioned earlier that some were tree codes, some were internal
function calls? We have some initial support for built in functions,
but I am not familiar with all the various forms they can take. We
currently support CFN_ functions in
gimple-range-op.cc, gimple_range_op_handler::maybe_builtin_call ()
Basically this is part of a "gimple_range_op_handler" wrapper for
range-ops which can provide a range-ops class for stmts that don't map
to a binary or unary form.. such as built in functions.
If you get to the point where you need this for a builtin function, I
can help you through that too. Although someone may have to also help
me through what differentiates the different kinds of internal function
:-) I presume they are all similar in some way.
Andrew