Mercurial > hg > CbC > CbC_gcc
comparison gcc/vr-values.h @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* Support routines for Value Range Propagation (VRP). | 1 /* Support routines for Value Range Propagation (VRP). |
2 Copyright (C) 2016-2018 Free Software Foundation, Inc. | 2 Copyright (C) 2016-2020 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GCC. | 4 This file is part of GCC. |
5 | 5 |
6 GCC is free software; you can redistribute it and/or modify | 6 GCC is free software; you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
38 { | 38 { |
39 public: | 39 public: |
40 vr_values (void); | 40 vr_values (void); |
41 ~vr_values (void); | 41 ~vr_values (void); |
42 | 42 |
43 value_range *get_value_range (const_tree); | 43 const value_range_equiv *get_value_range (const_tree); |
44 void set_vr_value (tree, value_range_equiv *); | |
45 value_range_equiv *swap_vr_value (tree, value_range_equiv *); | |
44 | 46 |
45 void set_vr_value (tree, value_range *); | 47 void set_def_to_varying (const_tree); |
46 void set_defs_to_varying (gimple *); | 48 void set_defs_to_varying (gimple *); |
47 bool update_value_range (const_tree, value_range *); | 49 bool update_value_range (const_tree, value_range_equiv *); |
48 tree op_with_constant_singleton_value_range (tree); | 50 tree op_with_constant_singleton_value_range (tree); |
49 void adjust_range_with_scev (value_range *, struct loop *, gimple *, tree); | 51 void adjust_range_with_scev (value_range_equiv *, class loop *, |
52 gimple *, tree); | |
50 tree vrp_evaluate_conditional (tree_code, tree, tree, gimple *); | 53 tree vrp_evaluate_conditional (tree_code, tree, tree, gimple *); |
51 void dump_all_value_ranges (FILE *); | 54 void dump_all_value_ranges (FILE *); |
52 | 55 |
53 void extract_range_for_var_from_comparison_expr (tree, enum tree_code, | 56 void extract_range_for_var_from_comparison_expr (tree, enum tree_code, |
54 tree, tree, value_range *); | 57 tree, tree, |
55 void extract_range_from_phi_node (gphi *, value_range *); | 58 value_range_equiv *); |
56 void extract_range_basic (value_range *, gimple *); | 59 void extract_range_from_phi_node (gphi *, value_range_equiv *); |
57 void extract_range_from_stmt (gimple *, edge *, tree *, value_range *); | 60 void extract_range_basic (value_range_equiv *, gimple *); |
61 void extract_range_from_stmt (gimple *, edge *, tree *, value_range_equiv *); | |
58 | 62 |
59 void vrp_visit_cond_stmt (gcond *, edge *); | 63 void vrp_visit_cond_stmt (gcond *, edge *); |
60 | 64 |
61 void simplify_cond_using_ranges_2 (gcond *); | 65 void simplify_cond_using_ranges_2 (gcond *); |
62 bool simplify_stmt_using_ranges (gimple_stmt_iterator *); | 66 bool simplify_stmt_using_ranges (gimple_stmt_iterator *); |
63 | 67 |
64 /* Indicate that propagation through the lattice is complete. */ | 68 /* Indicate that propagation through the lattice is complete. */ |
65 void set_lattice_propagation_complete (void) { values_propagated = true; } | 69 void set_lattice_propagation_complete (void) { values_propagated = true; } |
66 | 70 |
67 /* Allocate a new value_range object. */ | 71 /* Allocate a new value_range object. */ |
68 value_range *allocate_value_range (void) | 72 value_range_equiv *allocate_value_range_equiv (void) |
69 { return vrp_value_range_pool.allocate (); } | 73 { return vrp_value_range_pool.allocate (); } |
74 void free_value_range (value_range_equiv *vr) | |
75 { vrp_value_range_pool.remove (vr); } | |
70 | 76 |
71 /* */ | 77 /* */ |
72 void cleanup_edges_and_switches (void); | 78 void cleanup_edges_and_switches (void); |
73 | 79 |
74 private: | 80 private: |
81 value_range_equiv *get_lattice_entry (const_tree); | |
75 bool vrp_stmt_computes_nonzero (gimple *); | 82 bool vrp_stmt_computes_nonzero (gimple *); |
76 bool op_with_boolean_value_range_p (tree); | 83 bool op_with_boolean_value_range_p (tree); |
77 bool check_for_binary_op_overflow (enum tree_code, tree, tree, tree, bool *); | 84 bool check_for_binary_op_overflow (enum tree_code, tree, tree, tree, bool *); |
78 value_range get_vr_for_comparison (int); | 85 const value_range_equiv *get_vr_for_comparison (int, value_range_equiv *); |
79 tree compare_name_with_value (enum tree_code, tree, tree, bool *, bool); | 86 tree compare_name_with_value (enum tree_code, tree, tree, bool *, bool); |
80 tree compare_names (enum tree_code, tree, tree, bool *); | 87 tree compare_names (enum tree_code, tree, tree, bool *); |
81 bool two_valued_val_range_p (tree, tree *, tree *); | 88 bool two_valued_val_range_p (tree, tree *, tree *); |
82 tree vrp_evaluate_conditional_warnv_with_ops_using_ranges (enum tree_code, | 89 tree vrp_evaluate_conditional_warnv_with_ops_using_ranges (enum tree_code, |
83 tree, tree, | 90 tree, tree, |
84 bool *); | 91 bool *); |
85 tree vrp_evaluate_conditional_warnv_with_ops (enum tree_code, | 92 tree vrp_evaluate_conditional_warnv_with_ops (enum tree_code, |
86 tree, tree, bool, | 93 tree, tree, bool, |
87 bool *, bool *); | 94 bool *, bool *); |
88 void extract_range_from_assignment (value_range *, gassign *); | 95 void extract_range_from_assignment (value_range_equiv *, gassign *); |
89 void extract_range_from_assert (value_range *, tree); | 96 void extract_range_from_assert (value_range_equiv *, tree); |
90 void extract_range_from_ssa_name (value_range *, tree); | 97 void extract_range_from_ssa_name (value_range_equiv *, tree); |
91 void extract_range_from_binary_expr (value_range *, enum tree_code, | 98 void extract_range_from_binary_expr (value_range_equiv *, enum tree_code, |
92 tree, tree, tree); | 99 tree, tree, tree); |
93 void extract_range_from_unary_expr (value_range *, enum tree_code, | 100 void extract_range_from_unary_expr (value_range_equiv *, enum tree_code, |
94 tree, tree); | 101 tree, tree); |
95 void extract_range_from_cond_expr (value_range *, gassign *); | 102 void extract_range_from_cond_expr (value_range_equiv *, gassign *); |
96 void extract_range_from_comparison (value_range *, enum tree_code, | 103 void extract_range_from_comparison (value_range_equiv *, enum tree_code, |
97 tree, tree, tree); | 104 tree, tree, tree); |
98 void vrp_visit_assignment_or_call (gimple*, tree *, value_range *); | 105 void vrp_visit_assignment_or_call (gimple*, tree *, value_range_equiv *); |
99 void vrp_visit_switch_stmt (gswitch *, edge *); | 106 void vrp_visit_switch_stmt (gswitch *, edge *); |
100 bool simplify_truth_ops_using_ranges (gimple_stmt_iterator *, gimple *); | 107 bool simplify_truth_ops_using_ranges (gimple_stmt_iterator *, gimple *); |
101 bool simplify_div_or_mod_using_ranges (gimple_stmt_iterator *, gimple *); | 108 bool simplify_div_or_mod_using_ranges (gimple_stmt_iterator *, gimple *); |
102 bool simplify_abs_using_ranges (gimple_stmt_iterator *, gimple *); | 109 bool simplify_abs_using_ranges (gimple_stmt_iterator *, gimple *); |
103 bool simplify_bit_ops_using_ranges (gimple_stmt_iterator *, gimple *); | 110 bool simplify_bit_ops_using_ranges (gimple_stmt_iterator *, gimple *); |
107 bool simplify_float_conversion_using_ranges (gimple_stmt_iterator *, | 114 bool simplify_float_conversion_using_ranges (gimple_stmt_iterator *, |
108 gimple *); | 115 gimple *); |
109 bool simplify_internal_call_using_ranges (gimple_stmt_iterator *, gimple *); | 116 bool simplify_internal_call_using_ranges (gimple_stmt_iterator *, gimple *); |
110 | 117 |
111 /* Allocation pools for value_range objects. */ | 118 /* Allocation pools for value_range objects. */ |
112 object_allocator<value_range> vrp_value_range_pool; | 119 object_allocator<value_range_equiv> vrp_value_range_pool; |
113 | 120 |
114 /* This probably belongs in the lattice rather than in here. */ | 121 /* This probably belongs in the lattice rather than in here. */ |
115 bool values_propagated; | 122 bool values_propagated; |
116 | 123 |
117 /* Allocations for equivalences all come from this obstack. */ | 124 /* Allocations for equivalences all come from this obstack. */ |
118 bitmap_obstack vrp_equiv_obstack; | 125 bitmap_obstack vrp_equiv_obstack; |
119 | 126 |
120 /* Value range array. After propagation, VR_VALUE[I] holds the range | 127 /* Value range array. After propagation, VR_VALUE[I] holds the range |
121 of values that SSA name N_I may take. */ | 128 of values that SSA name N_I may take. */ |
122 unsigned int num_vr_values; | 129 unsigned int num_vr_values; |
123 value_range **vr_value; | 130 value_range_equiv **vr_value; |
124 | 131 |
125 /* For a PHI node which sets SSA name N_I, VR_COUNTS[I] holds the | 132 /* For a PHI node which sets SSA name N_I, VR_COUNTS[I] holds the |
126 number of executable edges we saw the last time we visited the | 133 number of executable edges we saw the last time we visited the |
127 node. */ | 134 node. */ |
128 int *vr_phi_edge_counts; | 135 int *vr_phi_edge_counts; |