]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/gimple-range-cache.h
x86: Remove "%!" before ret
[thirdparty/gcc.git] / gcc / gimple-range-cache.h
CommitLineData
90e88fd3 1/* Header file for gimple ranger SSA cache.
99dee823 2 Copyright (C) 2017-2021 Free Software Foundation, Inc.
90e88fd3
AM
3 Contributed by Andrew MacLeod <amacleod@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_SSA_RANGE_CACHE_H
22#define GCC_SSA_RANGE_CACHE_H
23
24#include "gimple-range-gori.h"
25
26// Class used to track non-null references of an SSA name. A vector
27// of bitmaps indexed by SSA name is maintained. When indexed by
28// basic block, an on-bit indicates there is a non-null dereference
29// for that SSA in that block.
30
31class non_null_ref
32{
33public:
34 non_null_ref ();
35 ~non_null_ref ();
a7943ea9 36 bool non_null_deref_p (tree name, basic_block bb, bool search_dom = true);
79f71ec6
AH
37 bool adjust_range (irange &r, tree name, basic_block bb,
38 bool search_dom = true);
90e88fd3
AM
39private:
40 vec <bitmap> m_nn;
41 void process_name (tree name);
42 bitmap_obstack m_bitmaps;
43};
44
45// This class manages a vector of pointers to ssa_block ranges. It
46// provides the basis for the "range on entry" cache for all
47// SSA names.
48
49class block_range_cache
50{
51public:
52 block_range_cache ();
53 ~block_range_cache ();
54
d242acc3
AM
55 bool set_bb_range (tree name, const_basic_block bb, const irange &r);
56 bool get_bb_range (irange &r, tree name, const_basic_block bb);
57 bool bb_range_p (tree name, const_basic_block bb);
90e88fd3
AM
58
59 void dump (FILE *f);
60 void dump (FILE *f, basic_block bb, bool print_varying = true);
61private:
62 vec<class ssa_block_ranges *> m_ssa_ranges;
63 ssa_block_ranges &get_block_ranges (tree name);
220929c0 64 ssa_block_ranges *query_block_ranges (tree name);
90e88fd3 65 irange_allocator *m_irange_allocator;
9858cd1a 66 bitmap_obstack m_bitmaps;
90e88fd3
AM
67};
68
69// This global cache is used with the range engine as markers for what
70// has been visited during this incarnation. Once the ranger evaluates
71// a name, it is typically not re-evaluated again.
72
73class ssa_global_cache
74{
75public:
76 ssa_global_cache ();
77 ~ssa_global_cache ();
78 bool get_global_range (irange &r, tree name) const;
ea7df355 79 bool set_global_range (tree name, const irange &r);
90e88fd3
AM
80 void clear_global_range (tree name);
81 void clear ();
82 void dump (FILE *f = stderr);
83private:
84 vec<irange *> m_tab;
85 class irange_allocator *m_irange_allocator;
86};
87
88// This class provides all the caches a global ranger may need, and makes
89// them available for gori-computes to query so outgoing edges can be
90// properly calculated.
91
47ea02bb 92class ranger_cache : public range_query
90e88fd3
AM
93{
94public:
053e1d64 95 ranger_cache (int not_executable_flag);
90e88fd3
AM
96 ~ranger_cache ();
97
2e0f3246 98 virtual bool range_of_expr (irange &r, tree name, gimple *stmt);
47ea02bb 99 virtual bool range_on_edge (irange &r, edge e, tree expr);
90e88fd3
AM
100 bool block_range (irange &r, basic_block bb, tree name, bool calc = true);
101
220929c0 102 bool get_global_range (irange &r, tree name) const;
e86fd6a1 103 bool get_non_stale_global_range (irange &r, tree name);
220929c0
AM
104 void set_global_range (tree name, const irange &r);
105
cb596fd4
AM
106 void propagate_updated_value (tree name, basic_block bb);
107
90e88fd3 108 non_null_ref m_non_null;
47ea02bb 109 gori_compute m_gori;
220929c0 110
47ea02bb
AM
111 void dump_bb (FILE *f, basic_block bb);
112 virtual void dump (FILE *f) OVERRIDE;
90e88fd3 113private:
220929c0
AM
114 ssa_global_cache m_globals;
115 block_range_cache m_on_entry;
e86fd6a1 116 class temporal_cache *m_temporal;
90e88fd3 117 void fill_block_cache (tree name, basic_block bb, basic_block def_bb);
ea7df355
AM
118 void propagate_cache (tree name);
119
cb448ade 120 void range_of_def (irange &r, tree name, basic_block bb = NULL);
2e0f3246
AM
121 void entry_range (irange &r, tree expr, basic_block bb);
122 void exit_range (irange &r, tree expr, basic_block bb);
123
90e88fd3 124 vec<basic_block> m_workback;
98244c68 125 class update_list *m_update;
90e88fd3
AM
126};
127
128#endif // GCC_SSA_RANGE_CACHE_H