1 /* Support routines for Value Range Propagation (VRP).
2 Copyright (C) 2016-2020 Free Software Foundation, Inc.
4 This file is part of GCC.
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)
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.
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/>. */
20 #ifndef GCC_TREE_VRP_H
21 #define GCC_TREE_VRP_H
23 #include "value-range.h"
27 /* Predicate code for the ASSERT_EXPR. Must be COMPARISON_CLASS_P. */
28 enum tree_code comp_code
;
30 /* Name to register the assert for. */
33 /* Value being compared against. */
36 /* Expression to compare. */
40 extern void register_edge_assert_for (tree
, edge
, enum tree_code
,
41 tree
, tree
, vec
<assert_info
> &);
42 extern bool stmt_interesting_for_vrp (gimple
*);
43 extern bool infer_value_range (gimple
*, tree
, tree_code
*, tree
*);
45 extern bool range_int_cst_p (const value_range
*);
47 extern int compare_values (tree
, tree
);
48 extern int compare_values_warnv (tree
, tree
, bool *);
49 extern int operand_less_p (tree
, tree
);
51 void range_fold_unary_expr (value_range
*, enum tree_code
, tree type
,
52 const value_range
*, tree op0_type
);
53 void range_fold_binary_expr (value_range
*, enum tree_code
, tree type
,
54 const value_range
*, const value_range
*);
56 extern enum value_range_kind intersect_range_with_nonzero_bits
57 (enum value_range_kind
, wide_int
*, wide_int
*, const wide_int
&, signop
);
59 extern bool find_case_label_range (gswitch
*, tree
, tree
, size_t *, size_t *);
60 extern tree
find_case_label_range (gswitch
*, const irange
*vr
);
61 extern bool find_case_label_index (gswitch
*, size_t, tree
, size_t *);
62 extern bool overflow_comparison_p (tree_code
, tree
, tree
, bool, tree
*);
63 extern tree
get_single_symbol (tree
, bool *, tree
*);
64 extern void maybe_set_nonzero_bits (edge
, tree
);
65 extern value_range_kind
determine_value_range (tree
, wide_int
*, wide_int
*);
66 extern wide_int
masked_increment (const wide_int
&val_in
, const wide_int
&mask
,
67 const wide_int
&sgnbit
, unsigned int prec
);
69 #endif /* GCC_TREE_VRP_H */