GCC Middle and Back End API Reference
vr-values.h
Go to the documentation of this file.
1/* Support routines for Value Range Propagation (VRP).
2 Copyright (C) 2016-2026 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 3, or (at your option)
9any later version.
10
11GCC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along 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
23#include "value-query.h"
24
25// Abstract class to return a range for a given SSA.
26
27// Class to simplify a statement using range information.
28
30{
31public:
33 int not_executable_flag = 0);
36 bool fold_cond (gcond *);
37private:
38 void legacy_fold_cond (gcond *, edge *);
41 bool simplify_casted_compare (tree_code &cond_code, tree &op0, tree &op1);
50 gassign *);
53 gassign *);
55
60
61 /* Vectors of edges that need removing and switch statements that
62 need updating. It is expected that a pass using the simplification
63 routines will, at the end of the pass, clean up the edges and
64 switch statements. The class dtor will try to detect cases
65 that do not follow that expectation. */
70
74 int m_not_executable_flag; // Non zero if not_executable flag exists.
75 vec<edge> m_flag_set_edges; // List of edges with flag to be cleared.
76};
77
78extern bool range_fits_type_p (const irange *vr,
79 unsigned dest_precision, signop dest_sgn);
80extern bool range_of_var_in_loop (vrange &, tree var, class loop *, gimple *,
81 range_query *);
82
83#endif /* GCC_VR_VALUES_H */
Definition value-range.h:291
Definition cfgloop.h:120
Definition value-query.h:55
vec< edge > m_flag_set_edges
Definition vr-values.h:75
bool simplify_div_or_mod_using_ranges(gimple_stmt_iterator *, gassign *)
Definition vr-values.cc:601
bool simplify_compare_assign_using_ranges_1(gimple_stmt_iterator *, gassign *)
Definition vr-values.cc:1124
bool simplify_truth_ops_using_ranges(gimple_stmt_iterator *, gassign *)
Definition vr-values.cc:520
bool op_with_boolean_value_range_p(tree, gimple *)
Definition vr-values.cc:58
bool simplify_internal_call_using_ranges(gimple_stmt_iterator *, gimple *)
Definition vr-values.cc:1619
bool simplify_bit_ops_using_ranges(gimple_stmt_iterator *, gassign *)
Definition vr-values.cc:800
void cleanup_edges_and_switches(void)
Definition vr-values.cc:1423
bool simplify_compare_using_ranges_1(tree_code &, tree &, tree &, gimple *)
Definition vr-values.cc:1172
bool simplify_cond_using_ranges_1(gcond *)
Definition vr-values.cc:1085
vec< edge > to_remove_edges
Definition vr-values.h:71
class range_query * query
Definition vr-values.h:73
simplify_using_ranges(range_query *query=NULL, int not_executable_flag=0)
Definition vr-values.cc:1742
bool two_valued_val_range_p(tree, tree *, tree *, gimple *)
Definition vr-values.cc:1721
bool simplify_min_or_max_using_ranges(gimple_stmt_iterator *, gassign *)
Definition vr-values.cc:714
bool fold_cond(gcond *)
Definition vr-values.cc:1013
bool simplify_casted_compare(tree_code &cond_code, tree &op0, tree &op1)
Definition vr-values.cc:1237
int m_not_executable_flag
Definition vr-values.h:74
void set_and_propagate_unexecutable(edge e)
Definition vr-values.cc:985
bool simplify_switch_using_ranges(gswitch *)
Definition vr-values.cc:1300
void legacy_fold_cond(gcond *, edge *)
Definition vr-values.cc:474
vec< switch_update > to_update_switch_stmts
Definition vr-values.h:72
tree fold_cond_with_ops(tree_code, tree, tree, gimple *s)
Definition vr-values.cc:343
bool simplify_abs_using_ranges(gimple_stmt_iterator *, gassign *)
Definition vr-values.cc:743
tree legacy_fold_cond_overflow(gimple *stmt)
Definition vr-values.cc:374
bool simplify_float_conversion_using_ranges(gimple_stmt_iterator *, gassign *)
Definition vr-values.cc:1549
simplify(simplify_kind kind_, unsigned id_, operand *match_, operand *result_, vec< vec< user_id * > > for_vec_, cid_map_t *capture_ids_)
Definition genmatch.cc:1803
Definition value-range.h:88
class edge_def * edge
Definition coretypes.h:356
union tree_node * tree
Definition coretypes.h:97
tree_code
Definition genmatch.cc:1011
signop
Definition signop.h:28
Definition gimple.h:911
Definition gimple.h:865
Definition gimple-iterator.h:26
Definition gimple.h:225
Definition gimple.h:902
Definition vr-values.h:66
gswitch * stmt
Definition vr-values.h:67
tree vec
Definition vr-values.h:68
Definition vec.h:450
#define NULL
Definition system.h:55
bool range_of_var_in_loop(vrange &v, tree name, class loop *l, gimple *stmt, range_query *query)
Definition vr-values.cc:299
bool range_fits_type_p(const irange *vr, unsigned dest_precision, signop dest_sgn)
Definition vr-values.cc:930