PR rtl-optimization/82913
[official-gcc.git] / gcc / tree-vrp.h
blob1b68956c6fd2d1fbfda23e641410c2cb108b2e9e
1 /* Support routines for Value Range Propagation (VRP).
2 Copyright (C) 2016-2017 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)
9 any later version.
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 /* Type of value ranges. See value_range below for a
24 description of these types. */
25 enum value_range_type { VR_UNDEFINED, VR_RANGE,
26 VR_ANTI_RANGE, VR_VARYING, VR_LAST };
28 /* Range of values that can be associated with an SSA_NAME after VRP
29 has executed. */
30 struct GTY((for_user)) value_range
32 /* Lattice value represented by this range. */
33 enum value_range_type type;
35 /* Minimum and maximum values represented by this range. These
36 values should be interpreted as follows:
38 - If TYPE is VR_UNDEFINED or VR_VARYING then MIN and MAX must
39 be NULL.
41 - If TYPE == VR_RANGE then MIN holds the minimum value and
42 MAX holds the maximum value of the range [MIN, MAX].
44 - If TYPE == ANTI_RANGE the variable is known to NOT
45 take any values in the range [MIN, MAX]. */
46 tree min;
47 tree max;
49 /* Set of SSA names whose value ranges are equivalent to this one.
50 This set is only valid when TYPE is VR_RANGE or VR_ANTI_RANGE. */
51 bitmap equiv;
54 extern void vrp_intersect_ranges (value_range *vr0, value_range *vr1);
55 extern void vrp_meet (value_range *vr0, const value_range *vr1);
56 extern void dump_value_range (FILE *, const value_range *);
57 extern void extract_range_from_unary_expr (value_range *vr,
58 enum tree_code code,
59 tree type,
60 value_range *vr0_,
61 tree op0_type);
63 #endif /* GCC_TREE_VRP_H */