]>
Commit | Line | Data |
---|---|---|
89759031 | 1 | /* Support routines for Value Range Propagation (VRP). |
a945c346 | 2 | Copyright (C) 2016-2024 Free Software Foundation, Inc. |
89759031 JL |
3 | |
4 | This file is part of GCC. | |
5 | ||
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 | |
8 | the Free Software Foundation; either version 3, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GCC is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GCC; see the file COPYING3. If not see | |
18 | <http://www.gnu.org/licenses/>. */ | |
19 | ||
20 | #ifndef GCC_VR_VALUES_H | |
21 | #define GCC_VR_VALUES_H | |
22 | ||
a889e06a | 23 | #include "value-query.h" |
4a5e9d00 | 24 | |
ea95ba8d AH |
25 | // Abstract class to return a range for a given SSA. |
26 | ||
fc36b97a | 27 | // Class to simplify a statement using range information. |
fc36b97a | 28 | |
a889e06a | 29 | class simplify_using_ranges |
fc36b97a AH |
30 | { |
31 | public: | |
053e1d64 AM |
32 | simplify_using_ranges (range_query *query = NULL, |
33 | int not_executable_flag = 0); | |
fc36b97a AH |
34 | ~simplify_using_ranges (); |
35 | bool simplify (gimple_stmt_iterator *); | |
8c99e307 | 36 | bool fold_cond (gcond *); |
ca0be1bb | 37 | private: |
3d8c2d3a | 38 | void legacy_fold_cond (gcond *, edge *); |
c7422782 AH |
39 | tree legacy_fold_cond_overflow (gimple *stmt); |
40 | tree fold_cond_with_ops (tree_code, tree, tree, gimple *s); | |
aadc5c07 | 41 | bool simplify_casted_compare (tree_code &cond_code, tree &op0, tree &op1); |
fc36b97a AH |
42 | bool simplify_truth_ops_using_ranges (gimple_stmt_iterator *, gimple *); |
43 | bool simplify_div_or_mod_using_ranges (gimple_stmt_iterator *, gimple *); | |
44 | bool simplify_abs_using_ranges (gimple_stmt_iterator *, gimple *); | |
45 | bool simplify_bit_ops_using_ranges (gimple_stmt_iterator *, gimple *); | |
46 | bool simplify_min_or_max_using_ranges (gimple_stmt_iterator *, gimple *); | |
47 | bool simplify_cond_using_ranges_1 (gcond *); | |
aadc5c07 AP |
48 | bool simplify_compare_using_ranges_1 (tree_code &, tree &, tree &, gimple *); |
49 | bool simplify_compare_assign_using_ranges_1 (gimple_stmt_iterator *, gimple *); | |
fc36b97a AH |
50 | bool simplify_switch_using_ranges (gswitch *); |
51 | bool simplify_float_conversion_using_ranges (gimple_stmt_iterator *, | |
52 | gimple *); | |
53 | bool simplify_internal_call_using_ranges (gimple_stmt_iterator *, gimple *); | |
54 | ||
a7e655ae AM |
55 | bool two_valued_val_range_p (tree, tree *, tree *, gimple *); |
56 | bool op_with_boolean_value_range_p (tree, gimple *); | |
73cf73af | 57 | void set_and_propagate_unexecutable (edge e); |
fc36b97a AH |
58 | void cleanup_edges_and_switches (void); |
59 | ||
60 | /* Vectors of edges that need removing and switch statements that | |
61 | need updating. It is expected that a pass using the simplification | |
62 | routines will, at the end of the pass, clean up the edges and | |
63 | switch statements. The class dtor will try to detect cases | |
64 | that do not follow that expectation. */ | |
65 | struct switch_update { | |
66 | gswitch *stmt; | |
67 | tree vec; | |
68 | }; | |
69 | ||
70 | vec<edge> to_remove_edges; | |
71 | vec<switch_update> to_update_switch_stmts; | |
a889e06a | 72 | class range_query *query; |
053e1d64 AM |
73 | int m_not_executable_flag; // Non zero if not_executable flag exists. |
74 | vec<edge> m_flag_set_edges; // List of edges with flag to be cleared. | |
fc36b97a AH |
75 | }; |
76 | ||
c7422782 | 77 | extern bool range_fits_type_p (const irange *vr, |
bae73ca5 | 78 | unsigned dest_precision, signop dest_sgn); |
47a76439 AH |
79 | extern bool range_of_var_in_loop (vrange &, tree var, class loop *, gimple *, |
80 | range_query *); | |
ea95ba8d | 81 | |
89759031 | 82 | #endif /* GCC_VR_VALUES_H */ |