Refactor range handling of builtins in vr_values and ranger.
This sets things up so we can share range handling of builtins between
vr_values and ranger. It is meant to refactor the code so that we can
verify that both implementations yield the same results.
First, we abstract out gimple_ranger::range_of_builtin_call into an externally
visible counterpart that can be called from vr_values. It will take a
range_query since both ranger and vr_values inherit from this base class.
Then we abstract out all the builtin handling in vr_values into a separate
method that is easier to compare against.
Finally, we call the ranger version from vr_values and compare it with the
vr_values version. Since this proves both versions return the same,
we can remove vr_values::extract_range_builtin in a follow-up patch.
The vr_values::range_of_expr change brings the vr_values version up to par
with the ranger version. It should've handled non-SSA's. This was
a small oversight that went unnoticed because the vr_value version isn't
stressed nearly as much as the ranger version. The change is needed because
the ranger code handling builtins calls, may call it for integer arguments
in range_of_builtin_ubsan_call.
There should be no change in functionality.
gcc/ChangeLog:
* gimple-range.cc (gimple_ranger::range_of_builtin_ubsan_call):
Make externally visble...
(range_of_builtin_ubsan_call): ...here. Add range_query argument.
(gimple_ranger::range_of_builtin_call): Make externally visible...
(range_of_builtin_call): ...here. Add range_query argument.
* gimple-range.h (range_of_builtin_call): Move out from class and
make externally visible.
* vr-values.c (vr_values::extract_range_basic): Abstract out
builtin handling to...
(vr_values::range_of_expr): Handle non SSAs.
(vr_values::extract_range_builtin): ...here.
* vr-values.h (class vr_values): Add extract_range_builtin.
(range_of_expr): Rename NAME to EXPR.