]>
Commit | Line | Data |
---|---|---|
90e88fd3 | 1 | /* Gimple range edge header file. |
a945c346 | 2 | Copyright (C) 2020-2024 Free Software Foundation, Inc. |
90e88fd3 AM |
3 | Contributed by Andrew MacLeod <amacleod@redhat.com> |
4 | and Aldy Hernandez <aldyh@redhat.com>. | |
5 | ||
6 | This file is part of GCC. | |
7 | ||
8 | GCC is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 3, or (at your option) | |
11 | any later version. | |
12 | ||
13 | GCC is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GCC; see the file COPYING3. If not see | |
20 | <http://www.gnu.org/licenses/>. */ | |
21 | ||
22 | #ifndef GIMPLE_RANGE_EDGE_H | |
23 | #define GIMPLE_RANGE_EDGE_H | |
24 | ||
25 | // This class is used to query ranges on constant edges in GIMPLE. | |
26 | // | |
27 | // For a COND_EXPR, the TRUE edge will return [1,1] and the false edge a [0,0]. | |
28 | // | |
29 | // For SWITCH_EXPR, it is awkward to calculate ranges. When a request | |
c46b5b0a | 30 | // is made, the entire switch is evaluated and the results cached. |
90e88fd3 AM |
31 | // Any future requests to that switch will use the cached value, providing |
32 | // dramatic decrease in computation time. | |
33 | // | |
34 | // The API is simple, just ask for the range on the edge. | |
35 | // The return value is NULL for no range, or the branch statement which the | |
36 | // edge gets the range from, along with the range. | |
37 | ||
12f0a54b | 38 | class gimple_outgoing_range |
90e88fd3 AM |
39 | { |
40 | public: | |
3ca950c3 | 41 | gimple_outgoing_range (int max_sw_edges = INT_MAX); |
12f0a54b | 42 | ~gimple_outgoing_range (); |
90e88fd3 AM |
43 | gimple *edge_range_p (irange &r, edge e); |
44 | private: | |
45 | void calc_switch_ranges (gswitch *sw); | |
45c8523d | 46 | bool switch_edge_range (irange &r, gswitch *sw, edge e); |
90e88fd3 | 47 | |
3ca950c3 | 48 | int m_max_edges; |
e1366a7e AH |
49 | hash_map<edge, vrange_storage *> *m_edge_table; |
50 | class vrange_allocator *m_range_allocator; | |
12f0a54b | 51 | }; |
90e88fd3 | 52 | |
12f0a54b | 53 | // If there is a range control statement at the end of block BB, return it. |
90e88fd3 | 54 | gimple *gimple_outgoing_range_stmt_p (basic_block bb); |
12f0a54b AM |
55 | // Return the range on edge E if it is from a GCOND. Either TRUE or FALSE. |
56 | void gcond_edge_range (irange &r, edge e); | |
90e88fd3 AM |
57 | |
58 | #endif // GIMPLE_RANGE_EDGE_H |