]>
Commit | Line | Data |
---|---|---|
38a73435 | 1 | /* Header file for misc range functions. -*- C++ -*- |
7adcbafe | 2 | Copyright (C) 2017-2022 Free Software Foundation, Inc. |
38a73435 AH |
3 | Contributed by Aldy Hernandez <aldyh@redhat.com>. |
4 | ||
5 | This file is part of GCC. | |
6 | ||
7 | GCC is free software; you can redistribute it and/or modify it under | |
8 | the terms of the GNU General Public License as published by the Free | |
9 | Software Foundation; either version 3, or (at your option) any later | |
10 | version. | |
11 | ||
12 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with GCC; see the file COPYING3. If not see | |
19 | <http://www.gnu.org/licenses/>. */ | |
20 | ||
21 | #ifndef GCC_RANGE_H | |
22 | #define GCC_RANGE_H | |
23 | ||
028d81b1 AH |
24 | value_range range_zero (tree type); |
25 | value_range range_nonzero (tree type); | |
028d81b1 AH |
26 | value_range range_positives (tree type); |
27 | value_range range_negatives (tree type); | |
9eb38e88 AH |
28 | |
29 | // Return an irange instance that is a boolean TRUE. | |
30 | ||
31 | static inline int_range<1> | |
32 | range_true (tree type) | |
33 | { | |
34 | unsigned prec = TYPE_PRECISION (type); | |
8b6bcedc | 35 | return int_range<2> (type, wi::one (prec), wi::one (prec)); |
9eb38e88 AH |
36 | } |
37 | ||
38 | // Return an irange instance that is a boolean FALSE. | |
39 | ||
40 | static inline int_range<1> | |
41 | range_false (tree type) | |
42 | { | |
43 | unsigned prec = TYPE_PRECISION (type); | |
8b6bcedc | 44 | return int_range<2> (type, wi::zero (prec), wi::zero (prec)); |
9eb38e88 AH |
45 | } |
46 | ||
47 | // Return an irange that covers both true and false. | |
48 | ||
49 | static inline int_range<1> | |
50 | range_true_and_false (tree type) | |
51 | { | |
52 | unsigned prec = TYPE_PRECISION (type); | |
d3296989 AH |
53 | if (prec == 1) |
54 | return int_range<2> (type); | |
8b6bcedc | 55 | return int_range<2> (type, wi::zero (prec), wi::one (prec)); |
9eb38e88 AH |
56 | } |
57 | ||
38a73435 | 58 | #endif // GCC_RANGE_H |