1 /*
   2  * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
   4  * Copyright (c) 2015, Linaro Ltd. All rights reserved.
   5  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   6  *
   7  * This code is free software; you can redistribute it and/or modify it
   8  * under the terms of the GNU General Public License version 2 only, as
   9  * published by the Free Software Foundation.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  *
  25  */
  26 
  27 #include "precompiled.hpp"
  28 #include "asm/register.hpp"
  29 
  30 const int ConcreteRegisterImpl::max_gpr = RegisterImpl::number_of_registers;
  31 const int ConcreteRegisterImpl::max_fpr = ConcreteRegisterImpl::max_gpr +
  32                                           FloatRegisterImpl::number_of_registers;
  33 
  34 const char* RegisterImpl::name() const {
  35   const char* names[number_of_registers] = {
  36     "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
  37     "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
  38   };
  39   return is_valid() ? names[encoding()] : "noreg";
  40 }
  41 
  42 const char* FloatRegisterImpl::name() const {
  43   const char* names[number_of_registers] = {
  44     "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
  45     "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15",
  46     "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23",
  47     "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31"
  48   };
  49   return is_valid() ? names[encoding()] : "fnoreg";
  50 }