src/cpu/ppc/vm/register_ppc.cpp

Wed, 15 Apr 2020 11:49:55 +0800

author
aoqi
date
Wed, 15 Apr 2020 11:49:55 +0800
changeset 9852
70aa912cebe5
parent 9703
2fdf635bcf28
permissions
-rw-r--r--

Merge

goetz@6458 1 /*
gromero@9662 2 * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
gromero@9662 3 * Copyright 2012, 2018 SAP AG. All rights reserved.
goetz@6458 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
goetz@6458 5 *
goetz@6458 6 * This code is free software; you can redistribute it and/or modify it
goetz@6458 7 * under the terms of the GNU General Public License version 2 only, as
goetz@6458 8 * published by the Free Software Foundation.
goetz@6458 9 *
goetz@6458 10 * This code is distributed in the hope that it will be useful, but WITHOUT
goetz@6458 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
goetz@6458 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
goetz@6458 13 * version 2 for more details (a copy is included in the LICENSE file that
goetz@6458 14 * accompanied this code).
goetz@6458 15 *
goetz@6458 16 * You should have received a copy of the GNU General Public License version
goetz@6458 17 * 2 along with this work; if not, write to the Free Software Foundation,
goetz@6458 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
goetz@6458 19 *
goetz@6458 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
goetz@6458 21 * or visit www.oracle.com if you need additional information or have any
goetz@6458 22 * questions.
goetz@6458 23 *
goetz@6458 24 */
goetz@6458 25
goetz@6458 26 #include "precompiled.hpp"
goetz@6458 27 #include "register_ppc.hpp"
goetz@6458 28
goetz@6458 29 const int ConcreteRegisterImpl::max_gpr = RegisterImpl::number_of_registers * 2;
goetz@6458 30 const int ConcreteRegisterImpl::max_fpr = ConcreteRegisterImpl::max_gpr +
goetz@6458 31 FloatRegisterImpl::number_of_registers * 2;
goetz@6458 32 const int ConcreteRegisterImpl::max_cnd = ConcreteRegisterImpl::max_fpr +
goetz@6458 33 ConditionRegisterImpl::number_of_registers;
goetz@6458 34
goetz@6458 35 const char* RegisterImpl::name() const {
goetz@6458 36 const char* names[number_of_registers] = {
goetz@6458 37 "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7",
goetz@6458 38 "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15",
goetz@6458 39 "R16", "R17", "R18", "R19", "R20", "R21", "R22", "R23",
goetz@6458 40 "R24", "R25", "R26", "R27", "R28", "R29", "R30", "R31"
goetz@6458 41 };
goetz@6458 42 return is_valid() ? names[encoding()] : "noreg";
goetz@6458 43 }
goetz@6458 44
goetz@6458 45 const char* ConditionRegisterImpl::name() const {
goetz@6458 46 const char* names[number_of_registers] = {
goetz@6495 47 "CR0", "CR1", "CR2", "CR3", "CR4", "CR5", "CR6", "CR7"
goetz@6458 48 };
goetz@6458 49 return is_valid() ? names[encoding()] : "cnoreg";
goetz@6458 50 }
goetz@6458 51
goetz@6458 52 const char* FloatRegisterImpl::name() const {
goetz@6458 53 const char* names[number_of_registers] = {
goetz@6458 54 "F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7",
goetz@6458 55 "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15",
goetz@6458 56 "F16", "F17", "F18", "F19", "F20", "F21", "F22", "F23",
goetz@6458 57 "F24", "F25", "F26", "F27", "F28", "F29", "F30", "F31"
goetz@6458 58 };
goetz@6458 59 return is_valid() ? names[encoding()] : "fnoreg";
goetz@6458 60 }
goetz@6458 61
goetz@6458 62 const char* SpecialRegisterImpl::name() const {
goetz@6458 63 const char* names[number_of_registers] = {
goetz@6495 64 "SR_XER", "SR_LR", "SR_CTR", "SR_VRSAVE", "SR_SPEFSCR", "SR_PPR"
goetz@6458 65 };
goetz@6458 66 return is_valid() ? names[encoding()] : "snoreg";
goetz@6458 67 }
goetz@6458 68
goetz@6458 69 const char* VectorRegisterImpl::name() const {
goetz@6458 70 const char* names[number_of_registers] = {
goetz@6458 71 "VR0", "VR1", "VR2", "VR3", "VR4", "VR5", "VR6", "VR7",
goetz@6458 72 "VR8", "VR9", "VR10", "VR11", "VR12", "VR13", "VR14", "VR15",
goetz@6458 73 "VR16", "VR17", "VR18", "VR19", "VR20", "VR21", "VR22", "VR23",
goetz@6458 74 "VR24", "VR25", "VR26", "VR27", "VR28", "VR29", "VR30", "VR31"
goetz@6458 75 };
goetz@6458 76 return is_valid() ? names[encoding()] : "vnoreg";
goetz@6458 77 }
gromero@9662 78
gromero@9662 79 const char* VectorSRegisterImpl::name() const {
gromero@9662 80 const char* names[number_of_registers] = {
gromero@9662 81 "VSR0", "VSR1", "VSR2", "VSR3", "VSR4", "VSR5", "VSR6", "VSR7",
gromero@9662 82 "VSR8", "VSR9", "VSR10", "VSR11", "VSR12", "VSR13", "VSR14", "VSR15",
gromero@9662 83 "VSR16", "VSR17", "VSR18", "VSR19", "VSR20", "VSR21", "VSR22", "VSR23",
gromero@9687 84 "VSR24", "VSR25", "VSR26", "VSR27", "VSR28", "VSR29", "VSR30", "VSR31",
gromero@9687 85 "VSR32", "VSR33", "VSR34", "VSR35", "VSR36", "VSR37", "VSR38", "VSR39",
gromero@9687 86 "VSR40", "VSR41", "VSR42", "VSR43", "VSR44", "VSR45", "VSR46", "VSR47",
gromero@9687 87 "VSR48", "VSR49", "VSR50", "VSR51", "VSR52", "VSR53", "VSR54", "VSR55",
gromero@9687 88 "VSR56", "VSR57", "VSR58", "VSR59", "VSR60", "VSR61", "VSR62", "VSR63"
gromero@9662 89 };
gromero@9662 90 return is_valid() ? names[encoding()] : "vsnoreg";
gromero@9662 91 }
gromero@9662 92
gromero@9687 93 // Method to convert a VectorRegister to a Vector-Scalar Register (VectorSRegister)
gromero@9687 94 VectorSRegister VectorRegisterImpl::to_vsr() const {
gromero@9687 95 if (this == vnoreg) { return vsnoregi; }
gromero@9687 96 return as_VectorSRegister(encoding() + 32);
gromero@9687 97 }

mercurial