Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: src/ppc/constants-ppc.cc

Issue 571173003: PowerPC specific sub-directories (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ppc/constants-ppc.h ('k') | src/ppc/cpu-ppc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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 #include "src/v8.h"
6
7 #if V8_TARGET_ARCH_PPC
8
9 #include "src/ppc/constants-ppc.h"
10
11
12 namespace v8 {
13 namespace internal {
14
15 // These register names are defined in a way to match the native disassembler
16 // formatting. See for example the command "objdump -d <binary file>".
17 const char* Registers::names_[kNumRegisters] = {
18 "r0", "sp", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",
19 "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21",
20 "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "fp"};
21
22
23 // List of alias names which can be used when referring to PPC registers.
24 const Registers::RegisterAlias Registers::aliases_[] = {{10, "sl"},
25 {11, "r11"},
26 {12, "r12"},
27 {13, "r13"},
28 {14, "r14"},
29 {15, "r15"},
30 {kNoRegister, NULL}};
31
32
33 const char* Registers::Name(int reg) {
34 const char* result;
35 if ((0 <= reg) && (reg < kNumRegisters)) {
36 result = names_[reg];
37 } else {
38 result = "noreg";
39 }
40 return result;
41 }
42
43
44 const char* FPRegisters::names_[kNumFPRegisters] = {
45 "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10",
46 "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", "d21",
47 "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31"};
48
49
50 const char* FPRegisters::Name(int reg) {
51 DCHECK((0 <= reg) && (reg < kNumFPRegisters));
52 return names_[reg];
53 }
54
55
56 int FPRegisters::Number(const char* name) {
57 for (int i = 0; i < kNumFPRegisters; i++) {
58 if (strcmp(names_[i], name) == 0) {
59 return i;
60 }
61 }
62
63 // No register with the requested name found.
64 return kNoRegister;
65 }
66
67
68 int Registers::Number(const char* name) {
69 // Look through the canonical names.
70 for (int i = 0; i < kNumRegisters; i++) {
71 if (strcmp(names_[i], name) == 0) {
72 return i;
73 }
74 }
75
76 // Look through the alias names.
77 int i = 0;
78 while (aliases_[i].reg != kNoRegister) {
79 if (strcmp(aliases_[i].name, name) == 0) {
80 return aliases_[i].reg;
81 }
82 i++;
83 }
84
85 // No register with the requested name found.
86 return kNoRegister;
87 }
88 }
89 } // namespace v8::internal
90
91 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/constants-ppc.h ('k') | src/ppc/cpu-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698