]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/tree-vrp.h
i386: Improve vector mode and TFmode ABS and NEG patterns
[thirdparty/gcc.git] / gcc / tree-vrp.h
CommitLineData
f90aa46c 1/* Support routines for Value Range Propagation (VRP).
8d9254fc 2 Copyright (C) 2016-2020 Free Software Foundation, Inc.
f90aa46c
KV
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
96715b4b
PK
20#ifndef GCC_TREE_VRP_H
21#define GCC_TREE_VRP_H
22
cca78449 23#include "value-range.h"
2506b92c 24
028d81b1
AH
25/* Note value_range_equiv cannot currently be used with GC memory,
26 only value_range is fully set up for this. */
27class GTY((user)) value_range_equiv : public value_range
f90aa46c 28{
54994253 29 public:
028d81b1
AH
30 value_range_equiv ();
31 value_range_equiv (const value_range &);
27922d51 32 /* Deep-copies equiv bitmap argument. */
5d462877 33 value_range_equiv (tree, tree, bitmap = NULL, value_range_kind = VR_RANGE);
27922d51
RB
34
35 /* Shallow-copies equiv bitmap. */
028d81b1 36 value_range_equiv (const value_range_equiv &) /* = delete */;
27922d51 37 /* Shallow-copies equiv bitmap. */
028d81b1 38 value_range_equiv& operator=(const value_range_equiv &) /* = delete */;
27922d51
RB
39
40 /* Move equiv bitmap from source range. */
028d81b1 41 void move (value_range_equiv *);
27922d51
RB
42
43 /* Leaves equiv bitmap alone. */
5d462877 44 void update (tree, tree, value_range_kind = VR_RANGE);
27922d51 45 /* Deep-copies equiv bitmap argument. */
5d462877 46 void set (tree, tree, bitmap = NULL, value_range_kind = VR_RANGE);
27922d51 47 void set (tree);
27922d51 48
028d81b1
AH
49 bool operator== (const value_range_equiv &) const /* = delete */;
50 bool operator!= (const value_range_equiv &) const /* = delete */;
51 void intersect (const value_range_equiv *);
52 void union_ (const value_range_equiv *);
53 bool equal_p (const value_range_equiv &, bool ignore_equivs) const;
54994253
AH
54
55 /* Types of value ranges. */
54994253 56 void set_undefined ();
97ecc8d5 57 void set_varying (tree);
54994253
AH
58
59 /* Equivalence bitmap methods. */
60 bitmap equiv () const;
61 void equiv_clear ();
028d81b1
AH
62 void equiv_add (const_tree, const value_range_equiv *,
63 bitmap_obstack * = NULL);
54994253
AH
64
65 /* Misc methods. */
028d81b1 66 void deep_copy (const value_range_equiv *);
54994253 67 void dump (FILE *) const;
97ecc8d5 68 void dump () const;
54994253 69
54994253 70 private:
27922d51 71 /* Deep-copies bitmap argument. */
2506b92c 72 void set_equiv (bitmap);
54994253 73 void check ();
54994253 74
54994253
AH
75 /* Set of SSA names whose value ranges are equivalent to this one.
76 This set is only valid when TYPE is VR_RANGE or VR_ANTI_RANGE. */
77 bitmap m_equiv;
78};
f90aa46c 79
2506b92c 80inline
028d81b1
AH
81value_range_equiv::value_range_equiv ()
82 : value_range ()
2506b92c 83{
54994253
AH
84 m_equiv = NULL;
85}
f90aa46c 86
54994253 87inline bitmap
028d81b1 88value_range_equiv::equiv () const
54994253
AH
89{
90 return m_equiv;
91}
f90aa46c 92
028d81b1 93extern void dump_value_range (FILE *, const value_range_equiv *);
16207ddd
JL
94
95struct assert_info
96{
97 /* Predicate code for the ASSERT_EXPR. Must be COMPARISON_CLASS_P. */
98 enum tree_code comp_code;
99
100 /* Name to register the assert for. */
101 tree name;
102
103 /* Value being compared against. */
104 tree val;
105
106 /* Expression to compare. */
107 tree expr;
108};
109
110extern void register_edge_assert_for (tree, edge, enum tree_code,
111 tree, tree, vec<assert_info> &);
112extern bool stmt_interesting_for_vrp (gimple *);
16207ddd
JL
113extern bool infer_value_range (gimple *, tree, tree_code *, tree *);
114
028d81b1 115extern bool range_int_cst_p (const value_range *);
c49eeac3 116
c2ad9885
JL
117extern int compare_values (tree, tree);
118extern int compare_values_warnv (tree, tree, bool *);
e7e785df 119extern int operand_less_p (tree, tree);
c49eeac3 120
028d81b1
AH
121void range_fold_unary_expr (value_range *, enum tree_code, tree type,
122 const value_range *, tree op0_type);
123void range_fold_binary_expr (value_range *, enum tree_code, tree type,
b00460cb 124 const value_range *, const value_range *);
c49eeac3 125
c49eeac3
RB
126extern enum value_range_kind intersect_range_with_nonzero_bits
127 (enum value_range_kind, wide_int *, wide_int *, const wide_int &, signop);
c49eeac3 128
c2ad9885
JL
129extern bool find_case_label_range (gswitch *, tree, tree, size_t *, size_t *);
130extern bool find_case_label_index (gswitch *, size_t, tree, size_t *);
c2ad9885 131extern bool overflow_comparison_p (tree_code, tree, tree, bool, tree *);
c2ad9885 132extern tree get_single_symbol (tree, bool *, tree *);
4aa458f2 133extern void maybe_set_nonzero_bits (edge, tree);
54994253 134extern value_range_kind determine_value_range (tree, wide_int *, wide_int *);
c49eeac3 135
96715b4b 136#endif /* GCC_TREE_VRP_H */