src/hotspot/share/opto/regmask.cpp
author pliden
Fri, 13 Sep 2019 08:40:09 +0200
changeset 58125 9b4717ca9bd1
parent 54021 6347ffe2c3c7
permissions -rw-r--r--
8230878: ZGC: Use THREAD_LOCAL instead of __thread Reviewed-by: kbarrett
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
//------------------------------dump-------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
#ifndef PRODUCT
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
    38
void OptoReg::dump(int r, outputStream *st) {
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
    39
  switch (r) {
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
    40
  case Special: st->print("r---"); break;
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
    41
  case Bad:     st->print("rBAD"); break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  default:
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 22807
diff changeset
    43
    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
    44
    else st->print("rS%d",r);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
//=============================================================================
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
const RegMask RegMask::Empty(
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
# define BODY(I) 0,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  FORALL_BODY
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
# undef BODY
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  0
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    59
//=============================================================================
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    60
bool RegMask::is_vector(uint ireg) {
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
    61
  return (ireg == Op_VecS || ireg == Op_VecD ||
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
    62
          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
    63
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    64
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    65
int RegMask::num_registers(uint ireg) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    66
    switch(ireg) {
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
    67
      case Op_VecZ:
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
    68
        return 16;
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    69
      case Op_VecY:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    70
        return 8;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    71
      case Op_VecX:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    72
        return 4;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    73
      case Op_VecD:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    74
      case Op_RegD:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    75
      case Op_RegL:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    76
#ifdef _LP64
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    77
      case Op_RegP:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    78
#endif
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    79
        return 2;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    80
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    81
    // Op_VecS and the rest ideal registers.
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    82
    return 1;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    83
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
    84
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
// 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
    86
void RegMask::clear_to_pairs() {
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
    87
  assert(valid_watermarks(), "sanity");
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
    88
  for (int i = _lwm; i <= _hwm; i++) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    int bits = _A[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    bits &= ((bits & 0x55555555)<<1); // 1 hi-bit set for each pair
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    bits |= (bits>>1);          // Smear 1 hi-bit into a pair
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    _A[i] = bits;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  }
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
    94
  assert(is_aligned_pairs(), "mask is not aligned, adjacent pairs");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
    97
bool RegMask::is_misaligned_pair() const {
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
    98
  return Size() == 2 && !is_aligned_pairs();
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
    99
}
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   100
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   101
bool RegMask::is_aligned_pairs() const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  // Assert that the register mask contains only bit pairs.
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   103
  assert(valid_watermarks(), "sanity");
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   104
  for (int i = _lwm; i <= _hwm; i++) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    int bits = _A[i];
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   106
    while (bits) {              // Check bits for pairing
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
      int bit = bits & -bits;   // Extract low bit
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
      // Low bit is not odd means its mis-aligned.
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   109
      if ((bit & 0x55555555) == 0) return false;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
      bits -= bit;              // Remove bit from mask
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
      // Check for aligned adjacent bit
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   112
      if ((bits & (bit<<1)) == 0) return false;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
      bits -= (bit<<1);         // Remove other halve of pair
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
// Return TRUE if the mask contains a single bit
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   120
bool RegMask::is_bound1() const {
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   121
  if (is_AllStack()) return false;
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   122
  return Size() == 1;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
// Return TRUE if the mask contains an adjacent pair of bits and no other bits.
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   126
bool RegMask::is_bound_pair() const {
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   127
  if (is_AllStack()) return false;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  int bit = -1;                 // Set to hold the one bit allowed
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   129
  assert(valid_watermarks(), "sanity");
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   130
  for (int i = _lwm; i <= _hwm; i++) {
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   131
    if (_A[i]) {                   // Found some bits
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   132
      if (bit != -1) return false; // Already had bits, so fail
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   133
      bit = _A[i] & -(_A[i]);      // Extract 1 bit from mask
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   134
      if ((bit << 1) != 0) {       // Bit pair stays in same word?
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   135
        if ((bit | (bit<<1)) != _A[i])
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   136
          return false;            // Require adjacent bit pair and no more bits
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   137
      } else {                     // Else its a split-pair case
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   138
        if(bit != _A[i]) return false; // Found many bits, so fail
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   139
        i++;                       // Skip iteration forward
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   140
        if (i > _hwm || _A[i] != 1)
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   141
          return false; // Require 1 lo bit in next word
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  // True for both the empty mask and for a bit pair
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   149
// Test for a single adjacent set of ideal register's size.
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   150
bool RegMask::is_bound(uint ireg) const {
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   151
  if (is_vector(ireg)) {
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   152
    if (is_bound_set(num_registers(ireg)))
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   153
      return true;
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   154
  } else if (is_bound1() || is_bound_pair()) {
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   155
    return true;
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   156
  }
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   157
  return false;
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   158
}
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   159
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   160
// 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
   161
static int low_bits[5] = { 0x55555555, 0x11111111, 0x01010101, 0x00000000, 0x00010001 };
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   162
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   163
// 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
   164
// 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
   165
// Works also for size 1.
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   166
OptoReg::Name RegMask::find_first_set(const int size) const {
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   167
  assert(is_aligned_sets(size), "mask is not aligned, adjacent sets");
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   168
  assert(valid_watermarks(), "sanity");
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   169
  for (int i = _lwm; i <= _hwm; i++) {
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   170
    if (_A[i]) {                // Found some bits
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   171
      // Convert to bit number, return hi bit in pair
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   172
      return OptoReg::Name((i<<_LogWordBits) + find_lowest_bit(_A[i]) + (size - 1));
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   173
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   174
  }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   175
  return OptoReg::Bad;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   176
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   177
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   178
// 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
   179
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
   180
  if (size == 1) return;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   181
  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
   182
  assert(is_power_of_2(size), "sanity");
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   183
  assert(valid_watermarks(), "sanity");
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   184
  int low_bits_mask = low_bits[size>>2];
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   185
  for (int i = _lwm; i <= _hwm; i++) {
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   186
    int bits = _A[i];
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   187
    int sets = (bits & low_bits_mask);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   188
    for (int j = 1; j < size; j++) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   189
      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
   190
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   191
    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
   192
    if (size > 2) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   193
      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
   194
      if (size > 4) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   195
        sets |= (sets>>4);       // Smear 4 hi-bits into a set
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   196
        if (size > 8) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   197
          sets |= (sets>>8);     // Smear 8 hi-bits into a set
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   198
        }
13104
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
    _A[i] = sets;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   202
  }
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   203
  assert(is_aligned_sets(size), "mask is not aligned, adjacent sets");
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   204
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   205
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   206
// Smear out partial bits to aligned adjacent bit sets
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   207
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
   208
  if (size == 1) return;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   209
  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
   210
  assert(is_power_of_2(size), "sanity");
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   211
  assert(valid_watermarks(), "sanity");
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   212
  int low_bits_mask = low_bits[size>>2];
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   213
  for (int i = _lwm; i <= _hwm; i++) {
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   214
    int bits = _A[i];
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   215
    int sets = 0;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   216
    for (int j = 0; j < size; j++) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   217
      sets |= (bits & low_bits_mask);  // collect partial bits
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   218
      bits  = bits>>1;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   219
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   220
    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
   221
    if (size > 2) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   222
      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
   223
      if (size > 4) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   224
        sets |= (sets<<4);       // Smear 4 lo-bits into a set
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   225
        if (size > 8) {
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   226
          sets |= (sets<<8);     // Smear 8 lo-bits into a set
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   227
        }
13104
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
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   230
    _A[i] = sets;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   231
  }
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   232
  assert(is_aligned_sets(size), "mask is not aligned, adjacent sets");
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   233
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   234
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   235
// Assert that the register mask contains only bit sets.
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   236
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
   237
  if (size == 1) return true;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   238
  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
   239
  assert(is_power_of_2(size), "sanity");
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   240
  int low_bits_mask = low_bits[size>>2];
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   241
  assert(valid_watermarks(), "sanity");
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   242
  for (int i = _lwm; i <= _hwm; i++) {
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   243
    int bits = _A[i];
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   244
    while (bits) {              // Check bits for pairing
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   245
      int bit = bits & -bits;   // Extract low bit
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   246
      // 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
   247
      if ((bit & low_bits_mask) == 0) return false;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   248
      // Do extra work since (bit << size) may overflow.
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   249
      int hi_bit = bit << (size-1); // high bit
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   250
      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
   251
      // Check for aligned adjacent bits in this set
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   252
      if ((bits & set) != set) return false;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   253
      bits -= set;  // Remove this set
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
  return true;
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
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   259
// 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
   260
// Works also for size 1.
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   261
int RegMask::is_bound_set(const int size) const {
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   262
  if (is_AllStack()) return false;
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   263
  assert(1 <= size && size <= 16, "update low bits table");
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   264
  assert(valid_watermarks(), "sanity");
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   265
  int bit = -1;                 // Set to hold the one bit allowed
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   266
  for (int i = _lwm; i <= _hwm; i++) {
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   267
    if (_A[i] ) {               // Found some bits
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   268
      if (bit != -1)
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   269
       return false;            // Already had bits, so fail
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   270
      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
   271
      int hi_bit = bit << (size-1); // high bit
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   272
      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
   273
        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
   274
        if (set != _A[i])
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   275
          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
   276
      } else {                  // Else its a split-set case
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   277
        if (((-1) & ~(bit-1)) != _A[i])
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   278
          return false;         // Found many bits, so fail
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   279
        i++;                    // Skip iteration forward and check high part
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   280
        // The lower (32-size) bits should be 0 since it is split case.
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   281
        int clear_bit_size = 32-size;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   282
        int shift_back_size = 32-clear_bit_size;
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   283
        int set = bit>>clear_bit_size;
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   284
        set = set & -set; // Remove sign extension.
30624
2e1803c8a26d 8076276: Add support for AVX512
kvn
parents: 25715
diff changeset
   285
        set = (((set << size) - 1) >> shift_back_size);
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   286
        if (i > _hwm || _A[i] != set)
15614
3d9afca22dc7 8007402: Code cleanup to remove Parfait false positive
drchase
parents: 15241
diff changeset
   287
          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
   288
      }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   289
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   290
  }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   291
  // 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
   292
  return true;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   293
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 8921
diff changeset
   294
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
// UP means register only, Register plus stack, or stack only is DOWN
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
bool RegMask::is_UP() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  // Quick common case check for DOWN (any stack slot is legal)
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   298
  if (is_AllStack())
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
    return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  // Slower check for any stack bits set (also DOWN)
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   301
  if (overlap(Matcher::STACK_ONLY_mask))
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
    return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
  // Not DOWN, so must be UP
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
  return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
// Compute size of register mask in bits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
uint RegMask::Size() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
  uint sum = 0;
54021
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   310
  assert(valid_watermarks(), "sanity");
6347ffe2c3c7 8220159: Optimize various RegMask operations by introducing watermarks
redestad
parents: 53532
diff changeset
   311
  for (int i = _lwm; i <= _hwm; i++) {
53443
675d857f5ee3 8217519: Improve RegMask population count calculation
redestad
parents: 47216
diff changeset
   312
    sum += population_count(_A[i]);
675d857f5ee3 8217519: Improve RegMask population count calculation
redestad
parents: 47216
diff changeset
   313
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
  return sum;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
#ifndef PRODUCT
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   318
void RegMask::dump(outputStream *st) const {
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   319
  st->print("[");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  RegMask rm = *this;           // Structure copy into local temp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
  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
   323
  if (OptoReg::is_valid(start)) { // Check for empty mask
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
    rm.Remove(start);           // Yank from mask
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   325
    OptoReg::dump(start, st);   // Print register
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
    OptoReg::Name last = start;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
    // Now I have printed an initial register.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
    // Print adjacent registers as "rX-rZ" instead of "rX,rY,rZ".
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
    // Begin looping over the remaining registers.
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   331
    while (1) {                 //
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
      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
   333
      if (!OptoReg::is_valid(reg))
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
        break;                  // Empty mask, end loop
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
      rm.Remove(reg);           // Yank from mask
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   337
      if (last+1 == reg) {      // See if they are adjacent
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
        // Adjacent registers just collect into long runs, no printing.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
        last = reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
      } else {                  // Ending some kind of run
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   341
        if (start == last) {    // 1-register run; no special printing
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   342
        } else if (start+1 == last) {
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   343
          st->print(",");       // 2-register run; print as "rX,rY"
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   344
          OptoReg::dump(last, st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
        } else {                // Multi-register run; print as "rX-rZ"
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   346
          st->print("-");
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   347
          OptoReg::dump(last, st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
        }
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   349
        st->print(",");         // Seperate start of new run
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
        start = last = reg;     // Start a new register run
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   351
        OptoReg::dump(start, st); // Print register
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
      } // End of if ending a register run or not
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
    } // End of while regmask not empty
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   355
    if (start == last) {        // 1-register run; no special printing
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   356
    } else if (start+1 == last) {
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   357
      st->print(",");           // 2-register run; print as "rX,rY"
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   358
      OptoReg::dump(last, st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
    } else {                    // Multi-register run; print as "rX-rZ"
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   360
      st->print("-");
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   361
      OptoReg::dump(last, st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
    }
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   363
    if (rm.is_AllStack()) st->print("...");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  }
15241
87d217c2d183 8005055: pass outputStream to more opto debug routines
kvn
parents: 13104
diff changeset
   365
  st->print("]");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
#endif