< prev index next >

src/hotspot/share/opto/regmask.cpp

Print this page

220     return true;
221   }
222   return false;
223 }
224 
225 // Check that whether given reg number with size is valid
226 // for current regmask, where reg is the highest number.
227 bool RegMask::is_valid_reg(OptoReg::Name reg, const int size) const {
228   for (int i = 0; i < size; i++) {
229     if (!Member(reg - i)) {
230       return false;
231     }
232   }
233   return true;
234 }
235 
236 // Find the lowest-numbered register set in the mask.  Return the
237 // HIGHEST register number in the set, or BAD if no sets.
238 // Works also for size 1.
239 OptoReg::Name RegMask::find_first_set(LRG &lrg, const int size) const {
240   if (lrg.is_scalable()) {
241     // For scalable vector register, regmask is SlotsPerVecA bits aligned.
242     assert(is_aligned_sets(SlotsPerVecA), "mask is not aligned, adjacent sets");
243   } else {
244     assert(is_aligned_sets(size), "mask is not aligned, adjacent sets");
245   }
246   assert(valid_watermarks(), "sanity");
247   for (unsigned i = _lwm; i <= _hwm; i++) {
248     if (_RM_UP[i]) {                // Found some bits
249       // Convert to bit number, return hi bit in pair
250       return OptoReg::Name((i<<_LogWordBits) + find_lowest_bit(_RM_UP[i]) + (size - 1));
251     }
252   }
253   return OptoReg::Bad;
254 }
255 
256 // Clear out partial bits; leave only aligned adjacent bit pairs
257 void RegMask::clear_to_sets(const unsigned int size) {
258   if (size == 1) return;
259   assert(2 <= size && size <= 16, "update low bits table");
260   assert(is_power_of_2(size), "sanity");

220     return true;
221   }
222   return false;
223 }
224 
225 // Check that whether given reg number with size is valid
226 // for current regmask, where reg is the highest number.
227 bool RegMask::is_valid_reg(OptoReg::Name reg, const int size) const {
228   for (int i = 0; i < size; i++) {
229     if (!Member(reg - i)) {
230       return false;
231     }
232   }
233   return true;
234 }
235 
236 // Find the lowest-numbered register set in the mask.  Return the
237 // HIGHEST register number in the set, or BAD if no sets.
238 // Works also for size 1.
239 OptoReg::Name RegMask::find_first_set(LRG &lrg, const int size) const {
240   if (lrg.is_scalable() && lrg._is_vector) {
241     // For scalable vector register, regmask is SlotsPerVecA bits aligned.
242     assert(is_aligned_sets(SlotsPerVecA), "mask is not aligned, adjacent sets");
243   } else {
244     assert(is_aligned_sets(size), "mask is not aligned, adjacent sets");
245   }
246   assert(valid_watermarks(), "sanity");
247   for (unsigned i = _lwm; i <= _hwm; i++) {
248     if (_RM_UP[i]) {                // Found some bits
249       // Convert to bit number, return hi bit in pair
250       return OptoReg::Name((i<<_LogWordBits) + find_lowest_bit(_RM_UP[i]) + (size - 1));
251     }
252   }
253   return OptoReg::Bad;
254 }
255 
256 // Clear out partial bits; leave only aligned adjacent bit pairs
257 void RegMask::clear_to_sets(const unsigned int size) {
258   if (size == 1) return;
259   assert(2 <= size && size <= 16, "update low bits table");
260   assert(is_power_of_2(size), "sanity");
< prev index next >