9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OPTO_CHAITIN_HPP
26 #define SHARE_VM_OPTO_CHAITIN_HPP
27
28 #include "code/vmreg.hpp"
29 #include "libadt/port.hpp"
30 #include "memory/resourceArea.hpp"
31 #include "opto/connode.hpp"
32 #include "opto/live.hpp"
33 #include "opto/matcher.hpp"
34 #include "opto/phase.hpp"
35 #include "opto/regalloc.hpp"
36 #include "opto/regmask.hpp"
37 #include "opto/machnode.hpp"
38
39 class LoopTree;
40 class Matcher;
41 class PhaseCFG;
42 class PhaseLive;
43 class PhaseRegAlloc;
44 class PhaseChaitin;
45
46 #define OPTO_DEBUG_SPLIT_FREQ BLOCK_FREQUENCY(0.001)
47 #define OPTO_LRG_HIGH_FREQ BLOCK_FREQUENCY(0.25)
48
49 //------------------------------LRG--------------------------------------------
125 void compute_set_mask_size() { set_mask_size(compute_mask_size()); }
126 int mask_size() const { assert( _msize_valid, "mask size not valid" );
127 return _mask_size; }
128 // Get the last mask size computed, even if it does not match the
129 // count of bits in the current mask.
130 int get_invalid_mask_size() const { return _mask_size; }
131 const RegMask &mask() const { return _mask; }
132 void set_mask( const RegMask &rm ) { _mask = rm; debug_only(_msize_valid=0;)}
133 void AND( const RegMask &rm ) { _mask.AND(rm); debug_only(_msize_valid=0;)}
134 void SUBTRACT( const RegMask &rm ) { _mask.SUBTRACT(rm); debug_only(_msize_valid=0;)}
135 void Clear() { _mask.Clear() ; debug_only(_msize_valid=1); _mask_size = 0; }
136 void Set_All() { _mask.Set_All(); debug_only(_msize_valid=1); _mask_size = RegMask::CHUNK_SIZE; }
137
138 void Insert( OptoReg::Name reg ) { _mask.Insert(reg); debug_only(_msize_valid=0;) }
139 void Remove( OptoReg::Name reg ) { _mask.Remove(reg); debug_only(_msize_valid=0;) }
140 void clear_to_pairs() { _mask.clear_to_pairs(); debug_only(_msize_valid=0;) }
141 void clear_to_sets() { _mask.clear_to_sets(_num_regs); debug_only(_msize_valid=0;) }
142
143 // Number of registers this live range uses when it colors
144 private:
145 uint8 _num_regs; // 2 for Longs and Doubles, 1 for all else
146 // except _num_regs is kill count for fat_proj
147 public:
148 int num_regs() const { return _num_regs; }
149 void set_num_regs( int reg ) { assert( _num_regs == reg || !_num_regs, "" ); _num_regs = reg; }
150
151 private:
152 // Number of physical registers this live range uses when it colors
153 // Architecture and register-set dependent
154 uint8 _reg_pressure;
155 public:
156 void set_reg_pressure(int i) { _reg_pressure = i; }
157 int reg_pressure() const { return _reg_pressure; }
158
159 // How much 'wiggle room' does this live range have?
160 // How many color choices can it make (scaled by _num_regs)?
161 int degrees_of_freedom() const { return mask_size() - _num_regs; }
162 // Bound LRGs have ZERO degrees of freedom. We also count
163 // must_spill as bound.
164 bool is_bound () const { return _is_bound; }
165 // Negative degrees-of-freedom; even with no neighbors this
166 // live range must spill.
167 bool not_free() const { return degrees_of_freedom() < 0; }
168 // Is this live range of "low-degree"? Trivially colorable?
169 bool lo_degree () const { return degree() <= degrees_of_freedom(); }
170 // Is this live range just barely "low-degree"? Trivially colorable?
171 bool just_lo_degree () const { return degree() == degrees_of_freedom(); }
172
173 uint _is_oop:1, // Live-range holds an oop
174 _is_float:1, // True if in float registers
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OPTO_CHAITIN_HPP
26 #define SHARE_VM_OPTO_CHAITIN_HPP
27
28 #include "code/vmreg.hpp"
29 #include "memory/resourceArea.hpp"
30 #include "opto/connode.hpp"
31 #include "opto/live.hpp"
32 #include "opto/matcher.hpp"
33 #include "opto/phase.hpp"
34 #include "opto/regalloc.hpp"
35 #include "opto/regmask.hpp"
36 #include "opto/machnode.hpp"
37
38 class LoopTree;
39 class Matcher;
40 class PhaseCFG;
41 class PhaseLive;
42 class PhaseRegAlloc;
43 class PhaseChaitin;
44
45 #define OPTO_DEBUG_SPLIT_FREQ BLOCK_FREQUENCY(0.001)
46 #define OPTO_LRG_HIGH_FREQ BLOCK_FREQUENCY(0.25)
47
48 //------------------------------LRG--------------------------------------------
124 void compute_set_mask_size() { set_mask_size(compute_mask_size()); }
125 int mask_size() const { assert( _msize_valid, "mask size not valid" );
126 return _mask_size; }
127 // Get the last mask size computed, even if it does not match the
128 // count of bits in the current mask.
129 int get_invalid_mask_size() const { return _mask_size; }
130 const RegMask &mask() const { return _mask; }
131 void set_mask( const RegMask &rm ) { _mask = rm; debug_only(_msize_valid=0;)}
132 void AND( const RegMask &rm ) { _mask.AND(rm); debug_only(_msize_valid=0;)}
133 void SUBTRACT( const RegMask &rm ) { _mask.SUBTRACT(rm); debug_only(_msize_valid=0;)}
134 void Clear() { _mask.Clear() ; debug_only(_msize_valid=1); _mask_size = 0; }
135 void Set_All() { _mask.Set_All(); debug_only(_msize_valid=1); _mask_size = RegMask::CHUNK_SIZE; }
136
137 void Insert( OptoReg::Name reg ) { _mask.Insert(reg); debug_only(_msize_valid=0;) }
138 void Remove( OptoReg::Name reg ) { _mask.Remove(reg); debug_only(_msize_valid=0;) }
139 void clear_to_pairs() { _mask.clear_to_pairs(); debug_only(_msize_valid=0;) }
140 void clear_to_sets() { _mask.clear_to_sets(_num_regs); debug_only(_msize_valid=0;) }
141
142 // Number of registers this live range uses when it colors
143 private:
144 uint8_t _num_regs; // 2 for Longs and Doubles, 1 for all else
145 // except _num_regs is kill count for fat_proj
146 public:
147 int num_regs() const { return _num_regs; }
148 void set_num_regs( int reg ) { assert( _num_regs == reg || !_num_regs, "" ); _num_regs = reg; }
149
150 private:
151 // Number of physical registers this live range uses when it colors
152 // Architecture and register-set dependent
153 uint8_t _reg_pressure;
154 public:
155 void set_reg_pressure(int i) { _reg_pressure = i; }
156 int reg_pressure() const { return _reg_pressure; }
157
158 // How much 'wiggle room' does this live range have?
159 // How many color choices can it make (scaled by _num_regs)?
160 int degrees_of_freedom() const { return mask_size() - _num_regs; }
161 // Bound LRGs have ZERO degrees of freedom. We also count
162 // must_spill as bound.
163 bool is_bound () const { return _is_bound; }
164 // Negative degrees-of-freedom; even with no neighbors this
165 // live range must spill.
166 bool not_free() const { return degrees_of_freedom() < 0; }
167 // Is this live range of "low-degree"? Trivially colorable?
168 bool lo_degree () const { return degree() <= degrees_of_freedom(); }
169 // Is this live range just barely "low-degree"? Trivially colorable?
170 bool just_lo_degree () const { return degree() == degrees_of_freedom(); }
171
172 uint _is_oop:1, // Live-range holds an oop
173 _is_float:1, // True if in float registers
|