blob: a958082a8ff5597c9082322e5b1b2866450ac4a1 [file] [log] [blame]
Ben Murdochda12d292016-06-02 14:46:10 +01001// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#if V8_TARGET_ARCH_S390
6
7#include "src/s390/constants-s390.h"
8
9namespace v8 {
10namespace internal {
11
12// These register names are defined in a way to match the native disassembler
13// formatting. See for example the command "objdump -d <binary file>".
14const char* Registers::names_[kNumRegisters] = {
15 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
16 "r8", "r9", "r10", "fp", "ip", "r13", "r14", "sp"};
17
18const char* DoubleRegisters::names_[kNumDoubleRegisters] = {
19 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
20 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15"};
21
22int DoubleRegisters::Number(const char* name) {
23 for (int i = 0; i < kNumDoubleRegisters; i++) {
24 if (strcmp(names_[i], name) == 0) {
25 return i;
26 }
27 }
28
29 // No register with the requested name found.
30 return kNoRegister;
31}
32
33int Registers::Number(const char* name) {
34 // Look through the canonical names.
35 for (int i = 0; i < kNumRegisters; i++) {
36 if (strcmp(names_[i], name) == 0) {
37 return i;
38 }
39 }
40
41 // No register with the requested name found.
42 return kNoRegister;
43}
44
45} // namespace internal
46} // namespace v8
47
48#endif // V8_TARGET_ARCH_S390