GCC Middle and Back End API Reference
gimple-range-edge.h
Go to the documentation of this file.
1/* Gimple range edge header file.
2 Copyright (C) 2020-2024 Free Software Foundation, Inc.
3 Contributed by Andrew MacLeod <amacleod@redhat.com>
4 and Aldy Hernandez <aldyh@redhat.com>.
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GCC is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along 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
30// is made, the entire switch is evaluated and the results cached.
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//
38// THe switch_limit is the number of switch edges beyond which the switch
39// is ignored (ie, edge_range_p () will return NULL as if the sitch was not
40// there. THis value can be adjusted any time via set_switch_limit ().
41// THe default is 0, no switches are precoessed until set_switch_limit () is
42// called, and then the default is INT_MAX.
43//
44// No memory is allocated until an edge for a switch is processed which also
45// falls under the edge limit criteria.
46
48{
49public:
50 gimple_outgoing_range (int max_sw_edges = 0);
51 virtual ~gimple_outgoing_range ();
53 void set_switch_limit (int max_sw_edges = INT_MAX);
54
55 virtual bool edge_range_p (vrange &, edge, tree, range_query &)
56 { return false; }
57 virtual bool has_edge_range_p (tree, basic_block = NULL) { return false; }
58 virtual bool has_edge_range_p (tree, edge ) { return false; }
59 virtual void dump (FILE *) { }
60 virtual bool compute_operand_range (vrange &, gimple *, const vrange &, tree,
61 class fur_source &,
62 class value_relation * = NULL)
63 { return false; }
64private:
67
71};
72
73// If there is a range control statement at the end of block BB, return it.
75// Return the range on edge E if it is from a GCOND. Either TRUE or FALSE.
76void gcond_edge_range (irange &r, edge e);
77
78#endif // GIMPLE_RANGE_EDGE_H
Definition gimple-range-fold.h:105
Definition gimple-range-edge.h:48
gimple * edge_range_p(irange &r, edge e)
Definition gimple-range-edge.cc:199
int m_max_edges
Definition gimple-range-edge.h:68
virtual bool has_edge_range_p(tree, edge)
Definition gimple-range-edge.h:58
virtual void dump(FILE *)
Definition gimple-range-edge.h:59
class vrange_allocator * m_range_allocator
Definition gimple-range-edge.h:70
gimple_outgoing_range(int max_sw_edges=0)
Definition gimple-range-edge.cc:68
void set_switch_limit(int max_sw_edges=INT_MAX)
Definition gimple-range-edge.cc:88
void calc_switch_ranges(gswitch *sw)
Definition gimple-range-edge.cc:128
bool switch_edge_range(irange &r, gswitch *sw, edge e)
Definition gimple-range-edge.cc:97
virtual bool has_edge_range_p(tree, basic_block=NULL)
Definition gimple-range-edge.h:57
virtual ~gimple_outgoing_range()
Definition gimple-range-edge.cc:77
virtual bool compute_operand_range(vrange &, gimple *, const vrange &, tree, class fur_source &, class value_relation *=NULL)
Definition gimple-range-edge.h:60
virtual bool edge_range_p(vrange &, edge, tree, range_query &)
Definition gimple-range-edge.h:55
hash_map< edge, vrange_storage * > * m_edge_table
Definition gimple-range-edge.h:69
Definition hash-map.h:40
Definition value-range.h:273
Definition value-query.h:55
Definition value-relation.h:421
Definition value-range-storage.h:28
Definition value-range.h:78
class edge_def * edge
Definition coretypes.h:352
union tree_node * tree
Definition coretypes.h:97
void gcond_edge_range(irange &r, edge e)
Definition gimple-range-edge.cc:57
gimple * gimple_outgoing_range_stmt_p(basic_block bb)
Definition gimple-range-edge.cc:40
#define INT_MAX
Definition glimits.h:85
poly_int< N, C > r
Definition poly-int.h:774
Definition basic-block.h:117
Definition gimple.h:221
Definition gimple.h:891
Definition shrink-wrap.cc:1086
#define NULL
Definition system.h:50