1 /* Header file for gimple ranger SSA cache.
2 Copyright (C) 2017-2020 Free Software Foundation, Inc.
3 Contributed by Andrew MacLeod <amacleod@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
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
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_SSA_RANGE_CACHE_H
22 #define GCC_SSA_RANGE_CACHE_H
24 #include "gimple-range-gori.h"
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.
36 bool non_null_deref_p (tree name
, basic_block bb
);
39 void process_name (tree name
);
40 bitmap_obstack m_bitmaps
;
43 // This class manages a vector of pointers to ssa_block ranges. It
44 // provides the basis for the "range on entry" cache for all
47 class block_range_cache
51 ~block_range_cache ();
53 void set_bb_range (tree name
, const basic_block bb
, const irange
&r
);
54 void set_bb_varying (tree name
, const basic_block bb
);
55 bool get_bb_range (irange
&r
, tree name
, const basic_block bb
);
56 bool bb_range_p (tree name
, const basic_block bb
);
59 void dump (FILE *f
, basic_block bb
, bool print_varying
= true);
61 vec
<class ssa_block_ranges
*> m_ssa_ranges
;
62 ssa_block_ranges
&get_block_ranges (tree name
);
63 irange_allocator
*m_irange_allocator
;
66 // This global cache is used with the range engine as markers for what
67 // has been visited during this incarnation. Once the ranger evaluates
68 // a name, it is typically not re-evaluated again.
70 class ssa_global_cache
75 bool get_global_range (irange
&r
, tree name
) const;
76 void set_global_range (tree name
, const irange
&r
);
77 void clear_global_range (tree name
);
79 void dump (FILE *f
= stderr
);
82 class irange_allocator
*m_irange_allocator
;
85 // This class provides all the caches a global ranger may need, and makes
86 // them available for gori-computes to query so outgoing edges can be
87 // properly calculated.
89 class ranger_cache
: public gori_compute_cache
92 ranger_cache (class range_query
&q
);
95 virtual void ssa_range_in_bb (irange
&r
, tree name
, basic_block bb
);
96 bool block_range (irange
&r
, basic_block bb
, tree name
, bool calc
= true);
98 ssa_global_cache m_globals
;
99 block_range_cache m_on_entry
;
100 non_null_ref m_non_null
;
102 void add_to_update (basic_block bb
);
103 void fill_block_cache (tree name
, basic_block bb
, basic_block def_bb
);
104 void iterative_cache_update (tree name
);
106 vec
<basic_block
> m_workback
;
107 vec
<basic_block
> m_update_list
;
109 // Iterative "poor value" calculations.
112 basic_block bb
; // Block which value needs to be calculated in.
113 tree calc
; // SSA_NAME which needs its value calculated.
115 bool push_poor_value (basic_block bb
, tree name
);
116 vec
<update_record
> m_poor_value_list
;
117 class range_query
&query
;
120 #endif // GCC_SSA_RANGE_CACHE_H