hotspot/src/cpu/zero/vm/register_zero.hpp
author stefank
Tue, 23 Nov 2010 13:22:55 -0800
changeset 7397 5b173b4ca846
parent 5547 f4b087cbb361
child 14294 130e947dfbe6
permissions -rw-r--r--
6989984: Use standard include model for Hospot Summary: Replaced MakeDeps and the includeDB files with more standardized solutions. Reviewed-by: coleenp, kvn, kamg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
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.
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     3
 * Copyright 2007 Red Hat, Inc.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     5
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     8
 * published by the Free Software Foundation.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     9
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    14
 * accompanied this code).
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    15
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    19
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    22
 * questions.
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    23
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    24
 */
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    25
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#ifndef CPU_ZERO_VM_REGISTER_ZERO_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#define CPU_ZERO_VM_REGISTER_ZERO_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "asm/register.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "vm_version_zero.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    32
class VMRegImpl;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    33
typedef VMRegImpl* VMReg;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    34
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    35
// Use Register as shortcut
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    36
class RegisterImpl;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    37
typedef RegisterImpl* Register;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    38
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    39
inline Register as_Register(int encoding) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    40
  return (Register)(intptr_t) encoding;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    41
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    42
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    43
// The implementation of integer registers for the zero architecture
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    44
class RegisterImpl : public AbstractRegisterImpl {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    45
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    46
  enum {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    47
    number_of_registers = 0
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    48
  };
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    49
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    50
  // construction
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    51
  inline friend Register as_Register(int encoding);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    52
  VMReg as_VMReg();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    53
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    54
  // derived registers, offsets, and addresses
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    55
  Register successor() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    56
    return as_Register(encoding() + 1);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    57
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    58
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    59
  // accessors
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    60
  int encoding() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    61
    assert(is_valid(), "invalid register");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    62
    return (intptr_t)this;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    63
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    64
  bool is_valid() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    65
    return 0 <= (intptr_t) this && (intptr_t)this < number_of_registers;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    66
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    67
  const char* name() const;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    68
};
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    69
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    70
// Use FloatRegister as shortcut
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    71
class FloatRegisterImpl;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    72
typedef FloatRegisterImpl* FloatRegister;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    73
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    74
inline FloatRegister as_FloatRegister(int encoding) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    75
  return (FloatRegister)(intptr_t) encoding;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    76
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    77
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    78
// The implementation of floating point registers for the zero architecture
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    79
class FloatRegisterImpl : public AbstractRegisterImpl {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    80
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    81
  enum {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    82
    number_of_registers = 0
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    83
  };
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    84
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    85
  // construction
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    86
  inline friend FloatRegister as_FloatRegister(int encoding);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    87
  VMReg as_VMReg();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    88
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    89
  // derived registers, offsets, and addresses
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    90
  FloatRegister successor() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    91
    return as_FloatRegister(encoding() + 1);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    92
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    93
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    94
  // accessors
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    95
  int encoding() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    96
    assert(is_valid(), "invalid register");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    97
    return (intptr_t)this;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    98
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    99
  bool is_valid() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   100
    return 0 <= (intptr_t) this && (intptr_t)this < number_of_registers;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   101
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   102
  const char* name() const;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   103
};
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   104
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   105
class ConcreteRegisterImpl : public AbstractRegisterImpl {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   106
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   107
  enum {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   108
    number_of_registers = RegisterImpl::number_of_registers +
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   109
                          FloatRegisterImpl::number_of_registers
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   110
  };
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   111
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   112
  static const int max_gpr;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   113
  static const int max_fpr;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   114
};
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   115
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   116
CONSTANT_REGISTER_DECLARATION(Register, noreg, (-1));
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   117
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   118
#endif // CPU_ZERO_VM_REGISTER_ZERO_HPP