diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2020-10-09 11:26:33 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2020-10-20 18:21:23 +0200 |
commit | 16e4f1ad44e3c00b8b73c9e4ade3d236ea7044a8 (patch) | |
tree | 8d9782b4176bc6c40aac2f84355ffca712d75b73 /gcc/gimple-range.h | |
parent | 5d53ec27015b916640171e891870adf2c6fdfd4c (diff) | |
download | gcc-16e4f1ad44e3c00b8b73c9e4ade3d236ea7044a8.zip gcc-16e4f1ad44e3c00b8b73c9e4ade3d236ea7044a8.tar.gz gcc-16e4f1ad44e3c00b8b73c9e4ade3d236ea7044a8.tar.bz2 |
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.
Diffstat (limited to 'gcc/gimple-range.h')
-rw-r--r-- | gcc/gimple-range.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/gimple-range.h b/gcc/gimple-range.h index a6e8793..0aa6d46 100644 --- a/gcc/gimple-range.h +++ b/gcc/gimple-range.h @@ -64,7 +64,6 @@ private: bool range_of_phi (irange &r, gphi *phi); bool range_of_non_trivial_assignment (irange &r, gimple *s); bool range_of_builtin_call (irange &r, gcall *call); - void range_of_builtin_ubsan_call (irange &r, gcall *call, tree_code code); bool range_with_loop_info (irange &r, tree name); void range_of_ssa_name_with_loop_info (irange &, tree, class loop *, gphi *); @@ -179,4 +178,7 @@ private: // Flag to enable debugging the various internal Caches. #define DEBUG_RANGE_CACHE (dump_file && (param_evrp_mode & EVRP_MODE_DEBUG)) +// Temporary external interface to share with vr_values. +bool range_of_builtin_call (range_query &query, irange &r, gcall *call); + #endif // GCC_GIMPLE_RANGE_STMT_H |