1
// Copyright 2009 the V8 project authors. All rights reserved.
3
// Copyright IBM Corp. 2012, 2013. All rights reserved.
5
// Redistribution and use in source and binary forms, with or without
6
// modification, are permitted provided that the following conditions are
9
// * Redistributions of source code must retain the above copyright
10
// notice, this list of conditions and the following disclaimer.
11
// * Redistributions in binary form must reproduce the above
12
// copyright notice, this list of conditions and the following
13
// disclaimer in the documentation and/or other materials provided
14
// with the distribution.
15
// * Neither the name of Google Inc. nor the names of its
16
// contributors may be used to endorse or promote products derived
17
// from this software without specific prior written permission.
19
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
#if defined(V8_TARGET_ARCH_PPC)
35
#include "constants-ppc.h"
41
// These register names are defined in a way to match the native disassembler
42
// formatting. See for example the command "objdump -d <binary file>".
43
const char* Registers::names_[kNumRegisters] = {
44
"r0", "sp", "r2", "r3", "r4", "r5", "r6", "r7",
45
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
46
"r16", "r17", "r18", "r19", "r20", "r21", "r22",
47
"r23", "r24", "r25", "r26", "r27", "r28", "r29",
52
// List of alias names which can be used when referring to PPC registers.
53
const Registers::RegisterAlias Registers::aliases_[] = {
64
const char* Registers::Name(int reg) {
66
if ((0 <= reg) && (reg < kNumRegisters)) {
75
const char* FPRegisters::names_[kNumFPRegisters] = {
76
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
77
"d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15",
78
"d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
79
"d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31"
81
const char* FPRegisters::Name(int reg) {
82
ASSERT((0 <= reg) && (reg < kNumFPRegisters));
85
int FPRegisters::Number(const char* name) {
86
for (int i = 0; i < kNumFPRegisters; i++) {
87
if (strcmp(names_[i], name) == 0) {
92
// No register with the requested name found.
98
int Registers::Number(const char* name) {
99
// Look through the canonical names.
100
for (int i = 0; i < kNumRegisters; i++) {
101
if (strcmp(names_[i], name) == 0) {
106
// Look through the alias names.
108
while (aliases_[i].reg != kNoRegister) {
109
if (strcmp(aliases_[i].name, name) == 0) {
110
return aliases_[i].reg;
115
// No register with the requested name found.
120
} } // namespace v8::internal
122
#endif // V8_TARGET_ARCH_PPC