c++: Implement modules ABI for vtable emissions
[official-gcc.git] / gcc / range.h
blobeccb9490e4d0f3689ec36a729dfff9770cd6ceb2
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>.
5 This file is part of GCC.
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.
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.
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/>. */
21 #ifndef GCC_RANGE_H
22 #define GCC_RANGE_H
24 value_range range_positives (tree type);
25 value_range range_negatives (tree type);
27 // Return an irange instance that is a boolean TRUE.
29 inline int_range<1>
30 range_true (tree type = boolean_type_node)
32 unsigned prec = TYPE_PRECISION (type);
33 return int_range<1> (type, wi::one (prec), wi::one (prec));
36 // Return an irange instance that is a boolean FALSE.
38 inline int_range<1>
39 range_false (tree type = boolean_type_node)
41 unsigned prec = TYPE_PRECISION (type);
42 return int_range<1> (type, wi::zero (prec), wi::zero (prec));
45 // Return an irange that covers both true and false.
47 inline int_range<1>
48 range_true_and_false (tree type = boolean_type_node)
50 unsigned prec = TYPE_PRECISION (type);
51 if (prec == 1)
52 return int_range<1> (type);
53 return int_range<1> (type, wi::zero (prec), wi::one (prec));
56 #endif // GCC_RANGE_H