/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "opto/compile.hpp"
#include "opto/regmask.hpp"
#ifdef TARGET_ARCH_MODEL_x86_32
# include "adfiles/ad_x86_32.hpp"
#endif
#ifdef TARGET_ARCH_MODEL_x86_64
# include "adfiles/ad_x86_64.hpp"
#endif
#ifdef TARGET_ARCH_MODEL_sparc
# include "adfiles/ad_sparc.hpp"
#endif
#ifdef TARGET_ARCH_MODEL_zero
# include "adfiles/ad_zero.hpp"
#endif
#ifdef TARGET_ARCH_MODEL_arm
# include "adfiles/ad_arm.hpp"
#endif
#ifdef TARGET_ARCH_MODEL_ppc
# include "adfiles/ad_ppc.hpp"
#endif
//-------------Non-zero bit search methods used by RegMask---------------------
// Find lowest 1, or return 32 if empty
int n = 0;
if( (mask & 0xffff) == 0 ) {
mask >>= 16;
n += 16;
}
if( (mask & 0xff) == 0 ) {
mask >>= 8;
n += 8;
}
if( (mask & 0xf) == 0 ) {
mask >>= 4;
n += 4;
}
if( (mask & 0x3) == 0 ) {
mask >>= 2;
n += 2;
}
if( (mask & 0x1) == 0 ) {
mask >>= 1;
n += 1;
}
if( mask == 0 ) {
n = 32;
}
return n;
}
// Find highest 1, or return 32 if empty
int n = 0;
if( mask > 0xffff ) {
mask >>= 16;
n += 16;
}
if( mask > 0xff ) {
mask >>= 8;
n += 8;
}
if( mask > 0xf ) {
mask >>= 4;
n += 4;
}
if( mask > 0x3 ) {
mask >>= 2;
n += 2;
}
if( mask > 0x1 ) {
mask >>= 1;
n += 1;
}
if( mask == 0 ) {
n = 32;
}
return n;
}
//------------------------------dump-------------------------------------------
#ifndef PRODUCT
switch (r) {
default:
break;
}
}
#endif
//=============================================================================
# define BODY(I) 0,
0
);
//=============================================================================
}
switch(ireg) {
case Op_VecY:
return 8;
case Op_VecX:
return 4;
case Op_VecD:
case Op_RegD:
case Op_RegL:
#ifdef _LP64
case Op_RegP:
#endif
return 2;
}
// Op_VecS and the rest ideal registers.
return 1;
}
//------------------------------find_first_pair--------------------------------
// Find the lowest-numbered register pair in the mask. Return the
// HIGHEST register number in the pair, or BAD if no pairs.
verify_pairs();
for( int i = 0; i < RM_SIZE; i++ ) {
if( _A[i] ) { // Found some bits
// Convert to bit number, return hi bit in pair
}
}
}
//------------------------------ClearToPairs-----------------------------------
// Clear out partial bits; leave only bit pairs
for( int i = 0; i < RM_SIZE; i++ ) {
}
verify_pairs();
}
//------------------------------SmearToPairs-----------------------------------
// Smear out partial bits; leave only bit pairs
for( int i = 0; i < RM_SIZE; i++ ) {
}
verify_pairs();
}
//------------------------------is_aligned_pairs-------------------------------
// Assert that the register mask contains only bit pairs.
for( int i = 0; i < RM_SIZE; i++ ) {
while( bits ) { // Check bits for pairing
// Low bit is not odd means its mis-aligned.
if( (bit & 0x55555555) == 0 ) return false;
// Check for aligned adjacent bit
}
}
return true;
}
//------------------------------is_bound1--------------------------------------
// Return TRUE if the mask contains a single bit
if( is_AllStack() ) return false;
for( int i = 0; i < RM_SIZE; i++ ) {
if( _A[i] ) { // Found some bits
}
}
// True for both the empty mask and for a single bit
return true;
}
//------------------------------is_bound2--------------------------------------
// Return TRUE if the mask contains an adjacent pair of bits and no other bits.
if( is_AllStack() ) return false;
for( int i = 0; i < RM_SIZE; i++ ) {
if( _A[i] ) { // Found some bits
return false; // Require adjacent bit pair and no more bits
} else { // Else its a split-pair case
i++; // Skip iteration forward
return false; // Require 1 lo bit in next word
}
}
}
// True for both the empty mask and for a bit pair
return true;
}
//------------------------------find_first_set---------------------------------
// Find the lowest-numbered register set in the mask. Return the
// HIGHEST register number in the set, or BAD if no sets.
// Works also for size 1.
for (int i = 0; i < RM_SIZE; i++) {
if (_A[i]) { // Found some bits
// Convert to bit number, return hi bit in pair
}
}
}
//------------------------------clear_to_sets----------------------------------
// Clear out partial bits; leave only aligned adjacent bit pairs
if (size == 1) return;
for (int i = 0; i < RM_SIZE; i++) {
for (int j = 1; j < size; j++) {
}
if (size > 2) {
if (size > 4) {
}
}
}
}
//------------------------------smear_to_sets----------------------------------
// Smear out partial bits to aligned adjacent bit sets
if (size == 1) return;
for (int i = 0; i < RM_SIZE; i++) {
int sets = 0;
for (int j = 0; j < size; j++) {
}
if (size > 2) {
if (size > 4) {
}
}
}
}
//------------------------------is_aligned_set--------------------------------
if (size == 1) return true;
// Assert that the register mask contains only bit sets.
for (int i = 0; i < RM_SIZE; i++) {
while (bits) { // Check bits for pairing
// Low bit is not odd means its mis-aligned.
if ((bit & low_bits_mask) == 0) return false;
// Do extra work since (bit << size) may overflow.
// Check for aligned adjacent bits in this set
}
}
return true;
}
//------------------------------is_bound_set-----------------------------------
// Return TRUE if the mask contains one adjacent set of bits and no other bits.
// Works also for size 1.
if( is_AllStack() ) return false;
for (int i = 0; i < RM_SIZE; i++) {
if (_A[i] ) { // Found some bits
if (bit != -1)
return false; // Already had bits, so fail
if (hi_bit != 0) { // Bit set stays in same word?
return false; // Require adjacent bit set and no more bits
} else { // Else its a split-set case
return false; // Found many bits, so fail
i++; // Skip iteration forward and check high part
// The lower 24 bits should be 0 since it is split case and size <= 8.
return false; // Require expected low bits in next word
}
}
}
// True for both the empty mask and for a bit set
return true;
}
//------------------------------is_UP------------------------------------------
// UP means register only, Register plus stack, or stack only is DOWN
// Quick common case check for DOWN (any stack slot is legal)
if( is_AllStack() )
return false;
// Slower check for any stack bits set (also DOWN)
return false;
// Not DOWN, so must be UP
return true;
}
//------------------------------Size-------------------------------------------
// Compute size of register mask in bits
for( int i = 0; i < RM_SIZE; i++ )
sum +=
return sum;
}
#ifndef PRODUCT
//------------------------------print------------------------------------------
// Now I have printed an initial register.
// Print adjacent registers as "rX-rZ" instead of "rX,rY,rZ".
// Begin looping over the remaining registers.
while (1) { //
break; // Empty mask, end loop
// Adjacent registers just collect into long runs, no printing.
} else { // Ending some kind of run
} else { // Multi-register run; print as "rX-rZ"
}
} // End of if ending a register run or not
} // End of while regmask not empty
} else { // Multi-register run; print as "rX-rZ"
}
}
}
#endif