34 #ifdef TARGET_ARCH_MODEL_sparc
35 # include "adfiles/ad_sparc.hpp"
36 #endif
37 #ifdef TARGET_ARCH_MODEL_zero
38 # include "adfiles/ad_zero.hpp"
39 #endif
40 #ifdef TARGET_ARCH_MODEL_arm
41 # include "adfiles/ad_arm.hpp"
42 #endif
43 #ifdef TARGET_ARCH_MODEL_ppc_32
44 # include "adfiles/ad_ppc_32.hpp"
45 #endif
46 #ifdef TARGET_ARCH_MODEL_ppc_64
47 # include "adfiles/ad_ppc_64.hpp"
48 #endif
49
50 #define RM_SIZE _RM_SIZE /* a constant private to the class RegMask */
51
52 //-------------Non-zero bit search methods used by RegMask---------------------
53 // Find lowest 1, or return 32 if empty
54 int find_lowest_bit( uint32 mask ) {
55 int n = 0;
56 if( (mask & 0xffff) == 0 ) {
57 mask >>= 16;
58 n += 16;
59 }
60 if( (mask & 0xff) == 0 ) {
61 mask >>= 8;
62 n += 8;
63 }
64 if( (mask & 0xf) == 0 ) {
65 mask >>= 4;
66 n += 4;
67 }
68 if( (mask & 0x3) == 0 ) {
69 mask >>= 2;
70 n += 2;
71 }
72 if( (mask & 0x1) == 0 ) {
73 mask >>= 1;
74 n += 1;
75 }
76 if( mask == 0 ) {
77 n = 32;
78 }
79 return n;
80 }
81
82 // Find highest 1, or return 32 if empty
83 int find_hihghest_bit( uint32 mask ) {
84 int n = 0;
85 if( mask > 0xffff ) {
86 mask >>= 16;
87 n += 16;
88 }
89 if( mask > 0xff ) {
90 mask >>= 8;
91 n += 8;
92 }
93 if( mask > 0xf ) {
94 mask >>= 4;
95 n += 4;
96 }
97 if( mask > 0x3 ) {
98 mask >>= 2;
99 n += 2;
100 }
101 if( mask > 0x1 ) {
102 mask >>= 1;
103 n += 1;
378 // True for both the empty mask and for a bit set
379 return true;
380 }
381
382 //------------------------------is_UP------------------------------------------
383 // UP means register only, Register plus stack, or stack only is DOWN
384 bool RegMask::is_UP() const {
385 // Quick common case check for DOWN (any stack slot is legal)
386 if( is_AllStack() )
387 return false;
388 // Slower check for any stack bits set (also DOWN)
389 if( overlap(Matcher::STACK_ONLY_mask) )
390 return false;
391 // Not DOWN, so must be UP
392 return true;
393 }
394
395 //------------------------------Size-------------------------------------------
396 // Compute size of register mask in bits
397 uint RegMask::Size() const {
398 extern uint8 bitsInByte[256];
399 uint sum = 0;
400 for( int i = 0; i < RM_SIZE; i++ )
401 sum +=
402 bitsInByte[(_A[i]>>24) & 0xff] +
403 bitsInByte[(_A[i]>>16) & 0xff] +
404 bitsInByte[(_A[i]>> 8) & 0xff] +
405 bitsInByte[ _A[i] & 0xff];
406 return sum;
407 }
408
409 #ifndef PRODUCT
410 //------------------------------print------------------------------------------
411 void RegMask::dump(outputStream *st) const {
412 st->print("[");
413 RegMask rm = *this; // Structure copy into local temp
414
415 OptoReg::Name start = rm.find_first_elem(); // Get a register
416 if (OptoReg::is_valid(start)) { // Check for empty mask
417 rm.Remove(start); // Yank from mask
418 OptoReg::dump(start, st); // Print register
|
34 #ifdef TARGET_ARCH_MODEL_sparc
35 # include "adfiles/ad_sparc.hpp"
36 #endif
37 #ifdef TARGET_ARCH_MODEL_zero
38 # include "adfiles/ad_zero.hpp"
39 #endif
40 #ifdef TARGET_ARCH_MODEL_arm
41 # include "adfiles/ad_arm.hpp"
42 #endif
43 #ifdef TARGET_ARCH_MODEL_ppc_32
44 # include "adfiles/ad_ppc_32.hpp"
45 #endif
46 #ifdef TARGET_ARCH_MODEL_ppc_64
47 # include "adfiles/ad_ppc_64.hpp"
48 #endif
49
50 #define RM_SIZE _RM_SIZE /* a constant private to the class RegMask */
51
52 //-------------Non-zero bit search methods used by RegMask---------------------
53 // Find lowest 1, or return 32 if empty
54 int find_lowest_bit( uint32_t mask ) {
55 int n = 0;
56 if( (mask & 0xffff) == 0 ) {
57 mask >>= 16;
58 n += 16;
59 }
60 if( (mask & 0xff) == 0 ) {
61 mask >>= 8;
62 n += 8;
63 }
64 if( (mask & 0xf) == 0 ) {
65 mask >>= 4;
66 n += 4;
67 }
68 if( (mask & 0x3) == 0 ) {
69 mask >>= 2;
70 n += 2;
71 }
72 if( (mask & 0x1) == 0 ) {
73 mask >>= 1;
74 n += 1;
75 }
76 if( mask == 0 ) {
77 n = 32;
78 }
79 return n;
80 }
81
82 // Find highest 1, or return 32 if empty
83 int find_hihghest_bit( uint32_t mask ) {
84 int n = 0;
85 if( mask > 0xffff ) {
86 mask >>= 16;
87 n += 16;
88 }
89 if( mask > 0xff ) {
90 mask >>= 8;
91 n += 8;
92 }
93 if( mask > 0xf ) {
94 mask >>= 4;
95 n += 4;
96 }
97 if( mask > 0x3 ) {
98 mask >>= 2;
99 n += 2;
100 }
101 if( mask > 0x1 ) {
102 mask >>= 1;
103 n += 1;
378 // True for both the empty mask and for a bit set
379 return true;
380 }
381
382 //------------------------------is_UP------------------------------------------
383 // UP means register only, Register plus stack, or stack only is DOWN
384 bool RegMask::is_UP() const {
385 // Quick common case check for DOWN (any stack slot is legal)
386 if( is_AllStack() )
387 return false;
388 // Slower check for any stack bits set (also DOWN)
389 if( overlap(Matcher::STACK_ONLY_mask) )
390 return false;
391 // Not DOWN, so must be UP
392 return true;
393 }
394
395 //------------------------------Size-------------------------------------------
396 // Compute size of register mask in bits
397 uint RegMask::Size() const {
398 extern uint8_t bitsInByte[256];
399 uint sum = 0;
400 for( int i = 0; i < RM_SIZE; i++ )
401 sum +=
402 bitsInByte[(_A[i]>>24) & 0xff] +
403 bitsInByte[(_A[i]>>16) & 0xff] +
404 bitsInByte[(_A[i]>> 8) & 0xff] +
405 bitsInByte[ _A[i] & 0xff];
406 return sum;
407 }
408
409 #ifndef PRODUCT
410 //------------------------------print------------------------------------------
411 void RegMask::dump(outputStream *st) const {
412 st->print("[");
413 RegMask rm = *this; // Structure copy into local temp
414
415 OptoReg::Name start = rm.find_first_elem(); // Get a register
416 if (OptoReg::is_valid(start)) { // Check for empty mask
417 rm.Remove(start); // Yank from mask
418 OptoReg::dump(start, st); // Print register
|