GCC Middle and Back End API Reference
range.h
Go to the documentation of this file.
1/* Header file for misc range functions. -*- C++ -*-
2 Copyright (C) 2017-2024 Free Software Foundation, Inc.
3 Contributed by Aldy Hernandez <aldyh@redhat.com>.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16
17You should have received a copy of the GNU General Public License
18along 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
28
29// Return an irange instance that is a boolean TRUE.
30
31inline int_range<1>
33{
34 unsigned prec = TYPE_PRECISION (type);
35 return int_range<1> (type, wi::one (prec), wi::one (prec));
36}
37
38// Return an irange instance that is a boolean FALSE.
39
40inline int_range<1>
42{
43 unsigned prec = TYPE_PRECISION (type);
44 return int_range<1> (type, wi::zero (prec), wi::zero (prec));
45}
46
47// Return an irange that covers both true and false.
48
49inline int_range<1>
51{
52 unsigned prec = TYPE_PRECISION (type);
53 if (prec == 1)
54 return int_range<1> (type);
55 return int_range<1> (type, wi::zero (prec), wi::one (prec));
56}
57
58#endif // GCC_RANGE_H
union tree_node * tree
Definition coretypes.h:97
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184
hwi_with_prec zero(unsigned int)
Definition wide-int.h:2018
hwi_with_prec one(unsigned int)
Definition wide-int.h:2025
int_range< 1 > range_false(tree type=boolean_type_node)
Definition range.h:41
value_range range_nonzero(tree type)
Definition range.cc:40
value_range range_positives(tree type)
Definition range.cc:47
int_range< 1 > range_true_and_false(tree type=boolean_type_node)
Definition range.h:50
value_range range_negatives(tree type)
Definition range.cc:55
value_range range_zero(tree type)
Definition range.cc:33
int_range< 1 > range_true(tree type=boolean_type_node)
Definition range.h:32
Definition gengtype.h:252
#define TYPE_PRECISION(NODE)
Definition tree.h:2245
#define boolean_type_node
Definition tree.h:4514