hotspot/src/cpu/sparc/vm/register_sparc.hpp
author lana
Fri, 05 Apr 2013 14:51:55 -0700
changeset 16804 fc843e3ea772
parent 7397 5b173b4ca846
child 18097 acd70736bd60
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
     2
 * Copyright (c) 2000, 2010, 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
#ifndef CPU_SPARC_VM_REGISTER_SPARC_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define CPU_SPARC_VM_REGISTER_SPARC_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "asm/register.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "vm_version_sparc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// forward declaration
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
class Address;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
class VMRegImpl;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
typedef VMRegImpl* VMReg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// Use Register as shortcut
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
class RegisterImpl;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
typedef RegisterImpl* Register;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
inline Register as_Register(int encoding) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  return (Register)(intptr_t) encoding;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
// The implementation of integer registers for the SPARC architecture
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
class RegisterImpl: public AbstractRegisterImpl {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  enum {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    log_set_size        = 3,                          // the number of bits to encode the set register number
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    number_of_sets      = 4,                          // the number of registers sets (in, local, out, global)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
    number_of_registers = number_of_sets << log_set_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
    iset_no = 3,  ibase = iset_no << log_set_size,    // the in     register set
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
    lset_no = 2,  lbase = lset_no << log_set_size,    // the local  register set
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    oset_no = 1,  obase = oset_no << log_set_size,    // the output register set
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
    gset_no = 0,  gbase = gset_no << log_set_size     // the global register set
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  friend Register as_Register(int encoding);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  // set specific construction
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  friend Register as_iRegister(int number);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  friend Register as_lRegister(int number);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  friend Register as_oRegister(int number);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  friend Register as_gRegister(int number);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  VMReg as_VMReg();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  // accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  int   encoding() const                              { assert(is_valid(), "invalid register"); return value(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  const char* name() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  // testers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  bool is_valid() const                               { return (0 <= (value()&0x7F) && (value()&0x7F) < number_of_registers); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  bool is_even() const                                { return (encoding() & 1) == 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  bool is_in() const                                  { return (encoding() >> log_set_size) == iset_no; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  bool is_local() const                               { return (encoding() >> log_set_size) == lset_no; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  bool is_out() const                                 { return (encoding() >> log_set_size) == oset_no; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  bool is_global() const                              { return (encoding() >> log_set_size) == gset_no; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  // derived registers, offsets, and addresses
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  Register successor() const                          { return as_Register(encoding() + 1); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  int input_number() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    assert(is_in(), "must be input register");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    return encoding() - ibase;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  Register after_save() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    assert(is_out() || is_global(), "register not visible after save");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    return is_out() ? as_Register(encoding() + (ibase - obase)) : (const Register)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  Register after_restore() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    assert(is_in() || is_global(), "register not visible after restore");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    return is_in() ? as_Register(encoding() + (obase - ibase)) : (const Register)this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  int sp_offset_in_saved_window() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    assert(is_in() || is_local(), "only i and l registers are saved in frame");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    return encoding() - lbase;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  inline Address address_in_saved_window() const;     // implemented in assembler_sparc.hpp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
// set specific construction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
inline Register as_iRegister(int number)            { return as_Register(RegisterImpl::ibase + number); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
inline Register as_lRegister(int number)            { return as_Register(RegisterImpl::lbase + number); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
inline Register as_oRegister(int number)            { return as_Register(RegisterImpl::obase + number); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
inline Register as_gRegister(int number)            { return as_Register(RegisterImpl::gbase + number); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
// The integer registers of the SPARC architecture
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
CONSTANT_REGISTER_DECLARATION(Register, noreg , (-1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
CONSTANT_REGISTER_DECLARATION(Register, G0    , (RegisterImpl::gbase + 0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
CONSTANT_REGISTER_DECLARATION(Register, G1    , (RegisterImpl::gbase + 1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
CONSTANT_REGISTER_DECLARATION(Register, G2    , (RegisterImpl::gbase + 2));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
CONSTANT_REGISTER_DECLARATION(Register, G3    , (RegisterImpl::gbase + 3));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
CONSTANT_REGISTER_DECLARATION(Register, G4    , (RegisterImpl::gbase + 4));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
CONSTANT_REGISTER_DECLARATION(Register, G5    , (RegisterImpl::gbase + 5));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
CONSTANT_REGISTER_DECLARATION(Register, G6    , (RegisterImpl::gbase + 6));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
CONSTANT_REGISTER_DECLARATION(Register, G7    , (RegisterImpl::gbase + 7));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
CONSTANT_REGISTER_DECLARATION(Register, O0    , (RegisterImpl::obase + 0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
CONSTANT_REGISTER_DECLARATION(Register, O1    , (RegisterImpl::obase + 1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
CONSTANT_REGISTER_DECLARATION(Register, O2    , (RegisterImpl::obase + 2));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
CONSTANT_REGISTER_DECLARATION(Register, O3    , (RegisterImpl::obase + 3));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
CONSTANT_REGISTER_DECLARATION(Register, O4    , (RegisterImpl::obase + 4));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
CONSTANT_REGISTER_DECLARATION(Register, O5    , (RegisterImpl::obase + 5));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
CONSTANT_REGISTER_DECLARATION(Register, O6    , (RegisterImpl::obase + 6));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
CONSTANT_REGISTER_DECLARATION(Register, O7    , (RegisterImpl::obase + 7));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
CONSTANT_REGISTER_DECLARATION(Register, L0    , (RegisterImpl::lbase + 0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
CONSTANT_REGISTER_DECLARATION(Register, L1    , (RegisterImpl::lbase + 1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
CONSTANT_REGISTER_DECLARATION(Register, L2    , (RegisterImpl::lbase + 2));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
CONSTANT_REGISTER_DECLARATION(Register, L3    , (RegisterImpl::lbase + 3));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
CONSTANT_REGISTER_DECLARATION(Register, L4    , (RegisterImpl::lbase + 4));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
CONSTANT_REGISTER_DECLARATION(Register, L5    , (RegisterImpl::lbase + 5));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
CONSTANT_REGISTER_DECLARATION(Register, L6    , (RegisterImpl::lbase + 6));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
CONSTANT_REGISTER_DECLARATION(Register, L7    , (RegisterImpl::lbase + 7));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
CONSTANT_REGISTER_DECLARATION(Register, I0    , (RegisterImpl::ibase + 0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
CONSTANT_REGISTER_DECLARATION(Register, I1    , (RegisterImpl::ibase + 1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
CONSTANT_REGISTER_DECLARATION(Register, I2    , (RegisterImpl::ibase + 2));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
CONSTANT_REGISTER_DECLARATION(Register, I3    , (RegisterImpl::ibase + 3));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
CONSTANT_REGISTER_DECLARATION(Register, I4    , (RegisterImpl::ibase + 4));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
CONSTANT_REGISTER_DECLARATION(Register, I5    , (RegisterImpl::ibase + 5));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
CONSTANT_REGISTER_DECLARATION(Register, I6    , (RegisterImpl::ibase + 6));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
CONSTANT_REGISTER_DECLARATION(Register, I7    , (RegisterImpl::ibase + 7));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
CONSTANT_REGISTER_DECLARATION(Register, FP    , (RegisterImpl::ibase + 6));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
CONSTANT_REGISTER_DECLARATION(Register, SP    , (RegisterImpl::obase + 6));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
// Because sparc has so many registers, #define'ing values for the is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
// beneficial in code size and the cost of some of the dangers of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
// defines.  We don't use them on Intel because win32 uses asm
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
// directives which use the same names for registers as Hotspot does,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
// so #defines would screw up the inline assembly.  If a particular
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
// file has a problem with these defines then it's possible to turn
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
// them off in that file by defining DONT_USE_REGISTER_DEFINES.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
// register_definition_sparc.cpp does that so that it's able to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
// provide real definitions of these registers for use in debuggers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
// and such.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
#ifndef DONT_USE_REGISTER_DEFINES
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
#define noreg ((Register)(noreg_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
#define G0 ((Register)(G0_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
#define G1 ((Register)(G1_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
#define G2 ((Register)(G2_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
#define G3 ((Register)(G3_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
#define G4 ((Register)(G4_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
#define G5 ((Register)(G5_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
#define G6 ((Register)(G6_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
#define G7 ((Register)(G7_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
#define O0 ((Register)(O0_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
#define O1 ((Register)(O1_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
#define O2 ((Register)(O2_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
#define O3 ((Register)(O3_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
#define O4 ((Register)(O4_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
#define O5 ((Register)(O5_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
#define O6 ((Register)(O6_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
#define O7 ((Register)(O7_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
#define L0 ((Register)(L0_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
#define L1 ((Register)(L1_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
#define L2 ((Register)(L2_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
#define L3 ((Register)(L3_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
#define L4 ((Register)(L4_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
#define L5 ((Register)(L5_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
#define L6 ((Register)(L6_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
#define L7 ((Register)(L7_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
#define I0 ((Register)(I0_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
#define I1 ((Register)(I1_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
#define I2 ((Register)(I2_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
#define I3 ((Register)(I3_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
#define I4 ((Register)(I4_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
#define I5 ((Register)(I5_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
#define I6 ((Register)(I6_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
#define I7 ((Register)(I7_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
#define FP ((Register)(FP_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
#define SP ((Register)(SP_RegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
#endif // DONT_USE_REGISTER_DEFINES
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
// Use FloatRegister as shortcut
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
class FloatRegisterImpl;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
typedef FloatRegisterImpl* FloatRegister;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
// construction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
inline FloatRegister as_FloatRegister(int encoding) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  return (FloatRegister)(intptr_t)encoding;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
// The implementation of float registers for the SPARC architecture
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
class FloatRegisterImpl: public AbstractRegisterImpl {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  enum {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    number_of_registers = 64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  enum Width {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
    S = 1,  D = 2,  Q = 3
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  // construction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  VMReg as_VMReg( );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  // accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  int encoding() const                                { assert(is_valid(), "invalid register"); return value(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  int encoding(Width w) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
    const int c = encoding();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
    switch (w) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
      case S:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
        assert(c < 32, "bad single float register");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
        return c;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
      case D:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
        assert(c < 64  &&  (c & 1) == 0, "bad double float register");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
        assert(c < 32 || VM_Version::v9_instructions_work(), "V9 float work only on V9 platform");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
        return (c & 0x1e) | ((c & 0x20) >> 5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
      case Q:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
        assert(c < 64  &&  (c & 3) == 0, "bad quad float register");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
        assert(c < 32 || VM_Version::v9_instructions_work(), "V9 float work only on V9 platform");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
        return (c & 0x1c) | ((c & 0x20) >> 5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
    ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
    return -1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  bool  is_valid() const                              { return 0 <= value() && value() < number_of_registers; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  const char* name() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  FloatRegister successor() const                     { return as_FloatRegister(encoding() + 1); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
// The float registers of the SPARC architecture
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
CONSTANT_REGISTER_DECLARATION(FloatRegister, fnoreg , (-1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
CONSTANT_REGISTER_DECLARATION(FloatRegister, F0     , ( 0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
CONSTANT_REGISTER_DECLARATION(FloatRegister, F1     , ( 1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
CONSTANT_REGISTER_DECLARATION(FloatRegister, F2     , ( 2));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
CONSTANT_REGISTER_DECLARATION(FloatRegister, F3     , ( 3));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
CONSTANT_REGISTER_DECLARATION(FloatRegister, F4     , ( 4));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
CONSTANT_REGISTER_DECLARATION(FloatRegister, F5     , ( 5));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
CONSTANT_REGISTER_DECLARATION(FloatRegister, F6     , ( 6));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
CONSTANT_REGISTER_DECLARATION(FloatRegister, F7     , ( 7));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
CONSTANT_REGISTER_DECLARATION(FloatRegister, F8     , ( 8));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
CONSTANT_REGISTER_DECLARATION(FloatRegister, F9     , ( 9));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
CONSTANT_REGISTER_DECLARATION(FloatRegister, F10    , (10));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
CONSTANT_REGISTER_DECLARATION(FloatRegister, F11    , (11));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
CONSTANT_REGISTER_DECLARATION(FloatRegister, F12    , (12));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
CONSTANT_REGISTER_DECLARATION(FloatRegister, F13    , (13));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
CONSTANT_REGISTER_DECLARATION(FloatRegister, F14    , (14));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
CONSTANT_REGISTER_DECLARATION(FloatRegister, F15    , (15));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
CONSTANT_REGISTER_DECLARATION(FloatRegister, F16    , (16));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
CONSTANT_REGISTER_DECLARATION(FloatRegister, F17    , (17));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
CONSTANT_REGISTER_DECLARATION(FloatRegister, F18    , (18));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
CONSTANT_REGISTER_DECLARATION(FloatRegister, F19    , (19));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
CONSTANT_REGISTER_DECLARATION(FloatRegister, F20    , (20));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
CONSTANT_REGISTER_DECLARATION(FloatRegister, F21    , (21));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
CONSTANT_REGISTER_DECLARATION(FloatRegister, F22    , (22));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
CONSTANT_REGISTER_DECLARATION(FloatRegister, F23    , (23));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
CONSTANT_REGISTER_DECLARATION(FloatRegister, F24    , (24));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
CONSTANT_REGISTER_DECLARATION(FloatRegister, F25    , (25));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
CONSTANT_REGISTER_DECLARATION(FloatRegister, F26    , (26));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
CONSTANT_REGISTER_DECLARATION(FloatRegister, F27    , (27));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
CONSTANT_REGISTER_DECLARATION(FloatRegister, F28    , (28));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
CONSTANT_REGISTER_DECLARATION(FloatRegister, F29    , (29));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
CONSTANT_REGISTER_DECLARATION(FloatRegister, F30    , (30));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
CONSTANT_REGISTER_DECLARATION(FloatRegister, F31    , (31));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
CONSTANT_REGISTER_DECLARATION(FloatRegister, F32    , (32));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
CONSTANT_REGISTER_DECLARATION(FloatRegister, F34    , (34));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
CONSTANT_REGISTER_DECLARATION(FloatRegister, F36    , (36));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
CONSTANT_REGISTER_DECLARATION(FloatRegister, F38    , (38));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
CONSTANT_REGISTER_DECLARATION(FloatRegister, F40    , (40));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
CONSTANT_REGISTER_DECLARATION(FloatRegister, F42    , (42));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
CONSTANT_REGISTER_DECLARATION(FloatRegister, F44    , (44));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
CONSTANT_REGISTER_DECLARATION(FloatRegister, F46    , (46));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
CONSTANT_REGISTER_DECLARATION(FloatRegister, F48    , (48));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
CONSTANT_REGISTER_DECLARATION(FloatRegister, F50    , (50));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
CONSTANT_REGISTER_DECLARATION(FloatRegister, F52    , (52));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
CONSTANT_REGISTER_DECLARATION(FloatRegister, F54    , (54));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
CONSTANT_REGISTER_DECLARATION(FloatRegister, F56    , (56));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
CONSTANT_REGISTER_DECLARATION(FloatRegister, F58    , (58));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
CONSTANT_REGISTER_DECLARATION(FloatRegister, F60    , (60));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
CONSTANT_REGISTER_DECLARATION(FloatRegister, F62    , (62));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
#ifndef DONT_USE_REGISTER_DEFINES
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
#define fnoreg ((FloatRegister)(fnoreg_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
#define F0     ((FloatRegister)(    F0_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
#define F1     ((FloatRegister)(    F1_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
#define F2     ((FloatRegister)(    F2_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
#define F3     ((FloatRegister)(    F3_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
#define F4     ((FloatRegister)(    F4_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
#define F5     ((FloatRegister)(    F5_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
#define F6     ((FloatRegister)(    F6_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
#define F7     ((FloatRegister)(    F7_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
#define F8     ((FloatRegister)(    F8_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
#define F9     ((FloatRegister)(    F9_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
#define F10    ((FloatRegister)(   F10_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
#define F11    ((FloatRegister)(   F11_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
#define F12    ((FloatRegister)(   F12_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
#define F13    ((FloatRegister)(   F13_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
#define F14    ((FloatRegister)(   F14_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
#define F15    ((FloatRegister)(   F15_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
#define F16    ((FloatRegister)(   F16_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
#define F17    ((FloatRegister)(   F17_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
#define F18    ((FloatRegister)(   F18_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
#define F19    ((FloatRegister)(   F19_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
#define F20    ((FloatRegister)(   F20_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
#define F21    ((FloatRegister)(   F21_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
#define F22    ((FloatRegister)(   F22_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
#define F23    ((FloatRegister)(   F23_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
#define F24    ((FloatRegister)(   F24_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
#define F25    ((FloatRegister)(   F25_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
#define F26    ((FloatRegister)(   F26_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
#define F27    ((FloatRegister)(   F27_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
#define F28    ((FloatRegister)(   F28_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
#define F29    ((FloatRegister)(   F29_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
#define F30    ((FloatRegister)(   F30_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
#define F31    ((FloatRegister)(   F31_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
#define F32    ((FloatRegister)(   F32_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
#define F34    ((FloatRegister)(   F34_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
#define F36    ((FloatRegister)(   F36_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
#define F38    ((FloatRegister)(   F38_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
#define F40    ((FloatRegister)(   F40_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
#define F42    ((FloatRegister)(   F42_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
#define F44    ((FloatRegister)(   F44_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
#define F46    ((FloatRegister)(   F46_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
#define F48    ((FloatRegister)(   F48_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
#define F50    ((FloatRegister)(   F50_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
#define F52    ((FloatRegister)(   F52_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
#define F54    ((FloatRegister)(   F54_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
#define F56    ((FloatRegister)(   F56_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
#define F58    ((FloatRegister)(   F58_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
#define F60    ((FloatRegister)(   F60_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
#define F62    ((FloatRegister)(   F62_FloatRegisterEnumValue))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
#endif // DONT_USE_REGISTER_DEFINES
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
// Maximum number of incoming arguments that can be passed in i registers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
const int SPARC_ARGS_IN_REGS_NUM = 6;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
class ConcreteRegisterImpl : public AbstractRegisterImpl {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
  enum {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
    // This number must be large enough to cover REG_COUNT (defined by c2) registers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
    // There is no requirement that any ordering here matches any ordering c2 gives
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
    // it's optoregs.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
    number_of_registers = 2*RegisterImpl::number_of_registers +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
                            FloatRegisterImpl::number_of_registers +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
                            1 + // ccr
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
                            4  //  fcc
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  static const int max_gpr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
  static const int max_fpr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
// Single, Double and Quad fp reg classes.  These exist to map the ADLC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
// encoding for a floating point register, to the FloatRegister number
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
// desired by the macroassembler.  A FloatRegister is a number between
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
// 0 and 63 passed around as a pointer.  For ADLC, an fp register encoding
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
// is the actual bit encoding used by the sparc hardware.  When ADLC used
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
// the macroassembler to generate an instruction that references, e.g., a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
// double fp reg, it passed the bit encoding to the macroassembler via
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
// as_FloatRegister, which, for double regs > 30, returns an illegal
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
// register number.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
// Therefore we provide the following classes for use by ADLC.  Their
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
// sole purpose is to convert from sparc register encodings to FloatRegisters.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
// At some future time, we might replace FloatRegister with these classes,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
// hence the definitions of as_xxxFloatRegister as class methods rather
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
// than as external inline routines.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
class SingleFloatRegisterImpl;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
typedef SingleFloatRegisterImpl *SingleFloatRegister;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
inline FloatRegister as_SingleFloatRegister(int encoding);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
class SingleFloatRegisterImpl {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
  friend inline FloatRegister as_SingleFloatRegister(int encoding) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
    assert(encoding < 32, "bad single float register encoding");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
    return as_FloatRegister(encoding);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
class DoubleFloatRegisterImpl;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
typedef DoubleFloatRegisterImpl *DoubleFloatRegister;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
inline FloatRegister as_DoubleFloatRegister(int encoding);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
class DoubleFloatRegisterImpl {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
  friend inline FloatRegister as_DoubleFloatRegister(int encoding) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
    assert(encoding < 32, "bad double float register encoding");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
    return as_FloatRegister( ((encoding & 1) << 5) | (encoding & 0x1e) );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
class QuadFloatRegisterImpl;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
typedef QuadFloatRegisterImpl *QuadFloatRegister;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
class QuadFloatRegisterImpl {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
  friend FloatRegister as_QuadFloatRegister(int encoding) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
    assert(encoding < 32 && ((encoding & 2) == 0), "bad quad float register encoding");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
    return as_FloatRegister( ((encoding & 1) << 5) | (encoding & 0x1c) );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   449
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   450
#endif // CPU_SPARC_VM_REGISTER_SPARC_HPP