Path: blob/master/src/hotspot/cpu/zero/register_zero.hpp
64441 views
/*1* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.2* Copyright 2007 Red Hat, Inc.3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4*5* This code is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#ifndef CPU_ZERO_REGISTER_ZERO_HPP26#define CPU_ZERO_REGISTER_ZERO_HPP2728#include "asm/register.hpp"29#include "runtime/vm_version.hpp"3031class VMRegImpl;32typedef VMRegImpl* VMReg;3334// Use Register as shortcut35class RegisterImpl;36typedef RegisterImpl* Register;3738inline Register as_Register(int encoding) {39return (Register)(intptr_t) encoding;40}4142// The implementation of integer registers for the zero architecture43class RegisterImpl : public AbstractRegisterImpl {44public:45enum {46number_of_registers = 047};4849// construction50inline friend Register as_Register(int encoding);51VMReg as_VMReg();5253// derived registers, offsets, and addresses54Register successor() const {55return as_Register(encoding() + 1);56}5758// accessors59int encoding() const {60assert(is_valid(), "invalid register");61return (intptr_t)this;62}63bool is_valid() const {64return 0 <= (intptr_t) this && (intptr_t)this < number_of_registers;65}66const char* name() const;67};6869// Use FloatRegister as shortcut70class FloatRegisterImpl;71typedef FloatRegisterImpl* FloatRegister;7273inline FloatRegister as_FloatRegister(int encoding) {74return (FloatRegister)(intptr_t) encoding;75}7677// The implementation of floating point registers for the zero architecture78class FloatRegisterImpl : public AbstractRegisterImpl {79public:80enum {81number_of_registers = 082};8384// construction85inline friend FloatRegister as_FloatRegister(int encoding);86VMReg as_VMReg();8788// derived registers, offsets, and addresses89FloatRegister successor() const {90return as_FloatRegister(encoding() + 1);91}9293// accessors94int encoding() const {95assert(is_valid(), "invalid register");96return (intptr_t)this;97}98bool is_valid() const {99return 0 <= (intptr_t) this && (intptr_t)this < number_of_registers;100}101const char* name() const;102};103104class ConcreteRegisterImpl : public AbstractRegisterImpl {105public:106enum {107number_of_registers = RegisterImpl::number_of_registers +108FloatRegisterImpl::number_of_registers109};110111static const int max_gpr;112static const int max_fpr;113};114115CONSTANT_REGISTER_DECLARATION(Register, noreg, (-1));116#ifndef DONT_USE_REGISTER_DEFINES117#define noreg ((Register)(noreg_RegisterEnumValue))118#endif119120#endif // CPU_ZERO_REGISTER_ZERO_HPP121122123