1 /*
   2  * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
   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 it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 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 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "register_arm.hpp"
  27 #include "utilities/debug.hpp"
  28 
  29 const int ConcreteRegisterImpl::max_gpr = ConcreteRegisterImpl::num_gpr;
  30 const int ConcreteRegisterImpl::max_fpr = ConcreteRegisterImpl::num_fpr +
  31                                           ConcreteRegisterImpl::max_gpr;
  32 
  33 const char* RegisterImpl::name() const {
  34   const char* names[number_of_registers] = {
  35 #ifdef AARCH64
  36     "x0",  "x1",  "x2",  "x3",  "x4",  "x5",  "x6",  "x7",
  37     "x8",  "x9",  "x10", "x11", "x12", "x13", "x14", "x15",
  38     "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23",
  39     "x24", "x25", "x26", "x27", "x28", "fp",  "lr",  "xzr", "sp"
  40 #else
  41     "r0", "r1", "r2", "r3", "r4", "r5", "r6",
  42 #if (FP_REG_NUM == 7)
  43     "fp",
  44 #else
  45     "r7",
  46 #endif
  47     "r8", "r9", "r10",
  48 #if (FP_REG_NUM == 11)
  49     "fp",
  50 #else
  51     "r11",
  52 #endif
  53     "r12", "sp", "lr", "pc"
  54 #endif // AARCH64
  55   };
  56   return is_valid() ? names[encoding()] : "noreg";
  57 }
  58 
  59 const char* FloatRegisterImpl::name() const {
  60   const char* names[number_of_registers] = {
  61 #ifdef AARCH64
  62     "v0",  "v1",  "v2",  "v3",  "v4",  "v5",  "v6",  "v7",
  63     "v8",  "v9",  "v10", "v11", "v12", "v13", "v14", "v15",
  64     "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23",
  65     "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31"
  66 #else
  67      "s0",  "s1",  "s2",  "s3",  "s4",  "s5",  "s6",  "s7",
  68      "s8",  "s9", "s10", "s11", "s12", "s13", "s14", "s15",
  69     "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23",
  70     "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31"
  71 #ifdef COMPILER2
  72    ,"s32", "s33?","s34", "s35?","s36", "s37?","s38", "s39?",
  73     "s40", "s41?","s42", "s43?","s44", "s45?","s46", "s47?",
  74     "s48", "s49?","s50", "s51?","s52", "s53?","s54", "s55?",
  75     "s56", "s57?","s58", "s59?","s60", "s61?","s62", "s63?"
  76 #endif
  77 #endif // AARCH64
  78   };
  79   return is_valid() ? names[encoding()] : "fnoreg";
  80 }