diff options
author | Kugan Vivekanandarajah <kuganv@linaro.org> | 2013-09-23 15:13:39 +0000 |
---|---|---|
committer | Christophe Lyon <clyon@gcc.gnu.org> | 2013-09-23 17:13:39 +0200 |
commit | a895a2b8a98464a019e6407e71769eb8aed99013 (patch) | |
tree | f8aeebb9d4ef8b224568c677be438c4daa431b63 /gcc/tree-vrp.c | |
parent | 984af6ac7579a3bc589401cf6d8651e98d0e9eb7 (diff) | |
download | gcc-a895a2b8a98464a019e6407e71769eb8aed99013.zip gcc-a895a2b8a98464a019e6407e71769eb8aed99013.tar.gz gcc-a895a2b8a98464a019e6407e71769eb8aed99013.tar.bz2 |
gimple-pretty-print.c (dump_ssaname_info): New function.
2013-09-23 Kugan Vivekanandarajah <kuganv@linaro.org>
gcc/
* gimple-pretty-print.c (dump_ssaname_info): New function.
(dump_gimple_phi): Call it.
(pp_gimple_stmt_1): Likewise.
* tree-core.h (tree_ssa_name): New union ssa_name_info_type field.
(range_info_def): Declare.
* tree-pretty-print.c (pp_double_int): New function.
(dump_generic_node): Call it.
* tree-pretty-print.h (pp_double_int): Declare.
* tree-ssa-alias.c (dump_alias_info): Check pointer type.
* tree-ssanames.h (range_info_def): New structure.
(value_range_type): Move definition here.
(set_range_info, value_range_type, duplicate_ssa_name_range_info):
Declare.
* tree-ssanames.c (make_ssa_name_fn): Check pointer type at
initialization.
(set_range_info): New function.
(get_range_info): Likewise.
(duplicate_ssa_name_range_info): Likewise.
(duplicate_ssa_name_fn): Check pointer type and call
duplicate_ssa_name_range_info.
* tree-ssa-copy.c (fini_copy_prop): Likewise.
* tree-vrp.c (value_range_type): Remove definition, now in
tree-ssanames.h.
(vrp_finalize): Call set_range_info to update value range of
SSA_NAMEs.
* tree.h (SSA_NAME_PTR_INFO): Macro changed to access via union.
(SSA_NAME_RANGE_INFO): New macro.
From-SVN: r202831
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r-- | gcc/tree-vrp.c | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index ae27dc4..e44d85d 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -41,9 +41,6 @@ along with GCC; see the file COPYING3. If not see #include "optabs.h" -/* Type of value ranges. See value_range_d for a description of these - types. */ -enum value_range_type { VR_UNDEFINED, VR_RANGE, VR_ANTI_RANGE, VR_VARYING }; /* Range of values that can be associated with an SSA_NAME after VRP has executed. */ @@ -9452,6 +9449,50 @@ vrp_finalize (void) the datastructures built by VRP. */ identify_jump_threads (); + /* Set value range to non pointer SSA_NAMEs. */ + for (i = 0; i < num_vr_values; i++) + if (vr_value[i]) + { + tree name = ssa_name (i); + + if (POINTER_TYPE_P (TREE_TYPE (name)) + || (vr_value[i]->type == VR_VARYING) + || (vr_value[i]->type == VR_UNDEFINED)) + continue; + + if ((TREE_CODE (vr_value[i]->min) == INTEGER_CST) + && (TREE_CODE (vr_value[i]->max) == INTEGER_CST)) + { + if (vr_value[i]->type == VR_RANGE) + set_range_info (name, + tree_to_double_int (vr_value[i]->min), + tree_to_double_int (vr_value[i]->max)); + else if (vr_value[i]->type == VR_ANTI_RANGE) + { + /* VR_ANTI_RANGE ~[min, max] is encoded compactly as + [max + 1, min - 1] without additional attributes. + When min value > max value, we know that it is + VR_ANTI_RANGE; it is VR_RANGE otherwise. */ + + /* ~[0,0] anti-range is represented as + range. */ + if (TYPE_UNSIGNED (TREE_TYPE (name)) + && integer_zerop (vr_value[i]->min) + && integer_zerop (vr_value[i]->max)) + set_range_info (name, + double_int_one, + double_int::max_value + (TYPE_PRECISION (TREE_TYPE (name)), true)); + else + set_range_info (name, + tree_to_double_int (vr_value[i]->max) + + double_int_one, + tree_to_double_int (vr_value[i]->min) + - double_int_one); + } + } + } + /* Free allocated memory. */ for (i = 0; i < num_vr_values; i++) if (vr_value[i]) |