src/hotspot/share/opto/regmask.cpp
author vlivanov
Fri, 25 Jan 2019 13:37:08 -0800
changeset 53509 28aa41c4165b
parent 53448 e422b21ca556
child 53532 bc20d0376402
permissions -rw-r--r--
8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle Reviewed-by: thartmann, roland
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53443
675d857f5ee3 8217519: Improve RegMask population count calculation
redestad
parents: 47216
diff changeset
     2
 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
25715
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 24429
diff changeset
    26
#include "opto/ad.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "opto/compile.hpp"
31620
53be635ad49c 8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents: 30624
diff changeset
    28
#include "opto/matcher.hpp"
53be635ad49c 8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents: 30624
diff changeset
    29
#include "opto/node.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "opto/regmask.hpp"
53443
675d857f5ee3 8217519: Improve RegMask population count calculation
redestad
parents: 47216
diff changeset
    31
#include "utilities/population_count.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
#define RM_SIZE _RM_SIZE /* a constant private to the class RegMask */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
//-------------Non-zero bit search methods used by RegMask---------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// Find highest 1, or return 32 if empty
53443
675d857f5ee3 8217519: Improve RegMask population count calculation
redestad
parents: 47216
diff changeset
    37
int find_highest_bit( uint32_t mask ) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  int n = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  if( mask > 0xffff ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
    mask >>= 16;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
    n += 16;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  if( mask > 0xff ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    mask >>= 8;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
    n += 8;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  if( mask > 0xf ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
    mask >>= 4;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
    n += 4;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  if( mask > 0x3 ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
    mask >>= 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
    n += 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  if( mask > 0x1 ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    mask >>= 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
    n += 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  if( mask == 0 ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    n = 32;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  return n;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
//------------------------------dump-------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
#ifndef PRODUCT
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
    68
void OptoReg::dump(int r, outputStream *st) {
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
    69
  switch (r) {
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
    70
  case Special: st->print("r---"); break;
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
    71
  case Bad:     st->print("rBAD"); break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  default:
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 22807
diff changeset
    73
    if (r < _last_Mach_Reg) st->print("%s", Matcher::regName[r]);
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
    74
    else st->print("rS%d",r);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
//=============================================================================
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
const RegMask RegMask::Empty(
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
# define BODY(I) 0,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  FORALL_BODY
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
# undef BODY
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  0
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    89
//=============================================================================
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    90
bool RegMask::is_vector(uint ireg) {
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
    91
  return (ireg == Op_VecS || ireg == Op_VecD ||
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
    92
          ireg == Op_VecX || ireg == Op_VecY || ireg == Op_VecZ );
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    93
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    94
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    95
int RegMask::num_registers(uint ireg) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    96
    switch(ireg) {
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
    97
      case Op_VecZ:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
    98
        return 16;
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    99
      case Op_VecY:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   100
        return 8;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   101
      case Op_VecX:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   102
        return 4;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   103
      case Op_VecD:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   104
      case Op_RegD:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   105
      case Op_RegL:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   106
#ifdef _LP64
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   107
      case Op_RegP:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   108
#endif
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   109
        return 2;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   110
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   111
    // Op_VecS and the rest ideal registers.
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   112
    return 1;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   113
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   114
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
//------------------------------ClearToPairs-----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
// Clear out partial bits; leave only bit pairs
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   117
void RegMask::clear_to_pairs() {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  for( int i = 0; i < RM_SIZE; i++ ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    int bits = _A[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    bits &= ((bits & 0x55555555)<<1); // 1 hi-bit set for each pair
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    bits |= (bits>>1);          // Smear 1 hi-bit into a pair
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    _A[i] = bits;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  }
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   124
  verify_pairs();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
//------------------------------is_aligned_pairs-------------------------------
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   128
bool RegMask::is_aligned_pairs() const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  // Assert that the register mask contains only bit pairs.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  for( int i = 0; i < RM_SIZE; i++ ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    int bits = _A[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    while( bits ) {             // Check bits for pairing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
      int bit = bits & -bits;   // Extract low bit
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
      // Low bit is not odd means its mis-aligned.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
      if( (bit & 0x55555555) == 0 ) return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
      bits -= bit;              // Remove bit from mask
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
      // Check for aligned adjacent bit
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
      if( (bits & (bit<<1)) == 0 ) return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
      bits -= (bit<<1);         // Remove other halve of pair
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
//------------------------------is_bound1--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
// Return TRUE if the mask contains a single bit
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
int RegMask::is_bound1() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  if( is_AllStack() ) return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  int bit = -1;                 // Set to hold the one bit allowed
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  for( int i = 0; i < RM_SIZE; i++ ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
    if( _A[i] ) {               // Found some bits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
      if( bit != -1 ) return false; // Already had bits, so fail
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
      bit = _A[i] & -_A[i];     // Extract 1 bit from mask
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
      if( bit != _A[i] ) return false; // Found many bits, so fail
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  // True for both the empty mask and for a single bit
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
//------------------------------is_bound2--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
// Return TRUE if the mask contains an adjacent pair of bits and no other bits.
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   163
int RegMask::is_bound_pair() const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  if( is_AllStack() ) return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  int bit = -1;                 // Set to hold the one bit allowed
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  for( int i = 0; i < RM_SIZE; i++ ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
    if( _A[i] ) {               // Found some bits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
      if( bit != -1 ) return false; // Already had bits, so fail
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
      bit = _A[i] & -(_A[i]);   // Extract 1 bit from mask
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
      if( (bit << 1) != 0 ) {   // Bit pair stays in same word?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
        if( (bit | (bit<<1)) != _A[i] )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
          return false;         // Require adjacent bit pair and no more bits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
      } else {                  // Else its a split-pair case
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
        if( bit != _A[i] ) return false; // Found many bits, so fail
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
        i++;                    // Skip iteration forward
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   177
        if( i >= RM_SIZE || _A[i] != 1 )
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   178
          return false; // Require 1 lo bit in next word
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  // True for both the empty mask and for a bit pair
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   186
// only indicies of power 2 are accessed, so index 3 is only filled in for storage.
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   187
static int low_bits[5] = { 0x55555555, 0x11111111, 0x01010101, 0x00000000, 0x00010001 };
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   188
//------------------------------find_first_set---------------------------------
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   189
// Find the lowest-numbered register set in the mask.  Return the
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   190
// HIGHEST register number in the set, or BAD if no sets.
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   191
// Works also for size 1.
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   192
OptoReg::Name RegMask::find_first_set(const int size) const {
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   193
  verify_sets(size);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   194
  for (int i = 0; i < RM_SIZE; i++) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   195
    if (_A[i]) {                // Found some bits
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   196
      int bit = _A[i] & -_A[i]; // Extract low bit
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   197
      // Convert to bit number, return hi bit in pair
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   198
      return OptoReg::Name((i<<_LogWordBits)+find_lowest_bit(bit)+(size-1));
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   199
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   200
  }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   201
  return OptoReg::Bad;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   202
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   203
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   204
//------------------------------clear_to_sets----------------------------------
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   205
// Clear out partial bits; leave only aligned adjacent bit pairs
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   206
void RegMask::clear_to_sets(const int size) {
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   207
  if (size == 1) return;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   208
  assert(2 <= size && size <= 16, "update low bits table");
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   209
  assert(is_power_of_2(size), "sanity");
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   210
  int low_bits_mask = low_bits[size>>2];
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   211
  for (int i = 0; i < RM_SIZE; i++) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   212
    int bits = _A[i];
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   213
    int sets = (bits & low_bits_mask);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   214
    for (int j = 1; j < size; j++) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   215
      sets = (bits & (sets<<1)); // filter bits which produce whole sets
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   216
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   217
    sets |= (sets>>1);           // Smear 1 hi-bit into a set
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   218
    if (size > 2) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   219
      sets |= (sets>>2);         // Smear 2 hi-bits into a set
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   220
      if (size > 4) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   221
        sets |= (sets>>4);       // Smear 4 hi-bits into a set
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   222
        if (size > 8) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   223
          sets |= (sets>>8);     // Smear 8 hi-bits into a set
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   224
        }
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   225
      }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   226
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   227
    _A[i] = sets;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   228
  }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   229
  verify_sets(size);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   230
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   231
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   232
//------------------------------smear_to_sets----------------------------------
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   233
// Smear out partial bits to aligned adjacent bit sets
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   234
void RegMask::smear_to_sets(const int size) {
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   235
  if (size == 1) return;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   236
  assert(2 <= size && size <= 16, "update low bits table");
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   237
  assert(is_power_of_2(size), "sanity");
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   238
  int low_bits_mask = low_bits[size>>2];
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   239
  for (int i = 0; i < RM_SIZE; i++) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   240
    int bits = _A[i];
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   241
    int sets = 0;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   242
    for (int j = 0; j < size; j++) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   243
      sets |= (bits & low_bits_mask);  // collect partial bits
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   244
      bits  = bits>>1;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   245
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   246
    sets |= (sets<<1);           // Smear 1 lo-bit  into a set
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   247
    if (size > 2) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   248
      sets |= (sets<<2);         // Smear 2 lo-bits into a set
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   249
      if (size > 4) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   250
        sets |= (sets<<4);       // Smear 4 lo-bits into a set
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   251
        if (size > 8) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   252
          sets |= (sets<<8);     // Smear 8 lo-bits into a set
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   253
        }
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   254
      }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   255
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   256
    _A[i] = sets;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   257
  }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   258
  verify_sets(size);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   259
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   260
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   261
//------------------------------is_aligned_set--------------------------------
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   262
bool RegMask::is_aligned_sets(const int size) const {
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   263
  if (size == 1) return true;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   264
  assert(2 <= size && size <= 16, "update low bits table");
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   265
  assert(is_power_of_2(size), "sanity");
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   266
  int low_bits_mask = low_bits[size>>2];
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   267
  // Assert that the register mask contains only bit sets.
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   268
  for (int i = 0; i < RM_SIZE; i++) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   269
    int bits = _A[i];
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   270
    while (bits) {              // Check bits for pairing
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   271
      int bit = bits & -bits;   // Extract low bit
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   272
      // Low bit is not odd means its mis-aligned.
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   273
      if ((bit & low_bits_mask) == 0) return false;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   274
      // Do extra work since (bit << size) may overflow.
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   275
      int hi_bit = bit << (size-1); // high bit
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   276
      int set = hi_bit + ((hi_bit-1) & ~(bit-1));
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   277
      // Check for aligned adjacent bits in this set
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   278
      if ((bits & set) != set) return false;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   279
      bits -= set;  // Remove this set
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   280
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   281
  }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   282
  return true;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   283
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   284
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   285
//------------------------------is_bound_set-----------------------------------
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   286
// Return TRUE if the mask contains one adjacent set of bits and no other bits.
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   287
// Works also for size 1.
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   288
int RegMask::is_bound_set(const int size) const {
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   289
  if( is_AllStack() ) return false;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   290
  assert(1 <= size && size <= 16, "update low bits table");
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   291
  int bit = -1;                 // Set to hold the one bit allowed
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   292
  for (int i = 0; i < RM_SIZE; i++) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   293
    if (_A[i] ) {               // Found some bits
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   294
      if (bit != -1)
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   295
       return false;            // Already had bits, so fail
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   296
      bit = _A[i] & -_A[i];     // Extract low bit from mask
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   297
      int hi_bit = bit << (size-1); // high bit
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   298
      if (hi_bit != 0) {        // Bit set stays in same word?
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   299
        int set = hi_bit + ((hi_bit-1) & ~(bit-1));
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   300
        if (set != _A[i])
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   301
          return false;         // Require adjacent bit set and no more bits
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   302
      } else {                  // Else its a split-set case
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   303
        if (((-1) & ~(bit-1)) != _A[i])
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   304
          return false;         // Found many bits, so fail
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   305
        i++;                    // Skip iteration forward and check high part
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   306
        // The lower (32-size) bits should be 0 since it is split case.
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   307
        int clear_bit_size = 32-size;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   308
        int shift_back_size = 32-clear_bit_size;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   309
        int set = bit>>clear_bit_size;
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   310
        set = set & -set; // Remove sign extension.
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   311
        set = (((set << size) - 1) >> shift_back_size);
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   312
        if (i >= RM_SIZE || _A[i] != set)
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   313
          return false; // Require expected low bits in next word
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   314
      }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   315
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   316
  }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   317
  // True for both the empty mask and for a bit set
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   318
  return true;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   319
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   320
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
//------------------------------is_UP------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
// UP means register only, Register plus stack, or stack only is DOWN
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
bool RegMask::is_UP() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
  // Quick common case check for DOWN (any stack slot is legal)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  if( is_AllStack() )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
    return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  // Slower check for any stack bits set (also DOWN)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  if( overlap(Matcher::STACK_ONLY_mask) )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
    return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
  // Not DOWN, so must be UP
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
//------------------------------Size-------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
// Compute size of register mask in bits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
uint RegMask::Size() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
  uint sum = 0;
53443
675d857f5ee3 8217519: Improve RegMask population count calculation
redestad
parents: 47216
diff changeset
   338
  for (int i = 0; i < RM_SIZE; i++) {
675d857f5ee3 8217519: Improve RegMask population count calculation
redestad
parents: 47216
diff changeset
   339
    sum += population_count(_A[i]);
675d857f5ee3 8217519: Improve RegMask population count calculation
redestad
parents: 47216
diff changeset
   340
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  return sum;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
//------------------------------print------------------------------------------
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   346
void RegMask::dump(outputStream *st) const {
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   347
  st->print("[");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
  RegMask rm = *this;           // Structure copy into local temp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
  OptoReg::Name start = rm.find_first_elem(); // Get a register
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   351
  if (OptoReg::is_valid(start)) { // Check for empty mask
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
    rm.Remove(start);           // Yank from mask
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   353
    OptoReg::dump(start, st);   // Print register
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
    OptoReg::Name last = start;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
    // Now I have printed an initial register.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
    // Print adjacent registers as "rX-rZ" instead of "rX,rY,rZ".
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
    // Begin looping over the remaining registers.
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   359
    while (1) {                 //
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
      OptoReg::Name reg = rm.find_first_elem(); // Get a register
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   361
      if (!OptoReg::is_valid(reg))
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
        break;                  // Empty mask, end loop
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
      rm.Remove(reg);           // Yank from mask
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   365
      if (last+1 == reg) {      // See if they are adjacent
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
        // Adjacent registers just collect into long runs, no printing.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
        last = reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
      } else {                  // Ending some kind of run
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   369
        if (start == last) {    // 1-register run; no special printing
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   370
        } else if (start+1 == last) {
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   371
          st->print(",");       // 2-register run; print as "rX,rY"
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   372
          OptoReg::dump(last, st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
        } else {                // Multi-register run; print as "rX-rZ"
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   374
          st->print("-");
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   375
          OptoReg::dump(last, st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
        }
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   377
        st->print(",");         // Seperate start of new run
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
        start = last = reg;     // Start a new register run
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   379
        OptoReg::dump(start, st); // Print register
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
      } // End of if ending a register run or not
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
    } // End of while regmask not empty
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   383
    if (start == last) {        // 1-register run; no special printing
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   384
    } else if (start+1 == last) {
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   385
      st->print(",");           // 2-register run; print as "rX,rY"
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   386
      OptoReg::dump(last, st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
    } else {                    // Multi-register run; print as "rX-rZ"
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   388
      st->print("-");
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   389
      OptoReg::dump(last, st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
    }
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   391
    if (rm.is_AllStack()) st->print("...");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  }
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   393
  st->print("]");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
#endif