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

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

Issue 1381383002: PPC: Remove register index/code indirection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 months 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
« no previous file with comments | « src/ppc/constants-ppc.h ('k') | src/ppc/deoptimizer-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
1 // Copyright 2014 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_PPC 5 #if V8_TARGET_ARCH_PPC
6 6
7 #include "src/ppc/constants-ppc.h" 7 #include "src/ppc/constants-ppc.h"
8 8
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 // These register names are defined in a way to match the native disassembler 13 // These register names are defined in a way to match the native disassembler
14 // formatting. See for example the command "objdump -d <binary file>". 14 // formatting. See for example the command "objdump -d <binary file>".
15 const char* Registers::names_[kNumRegisters] = { 15 const char* Registers::names_[kNumRegisters] = {
16 "r0", "sp", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", 16 "r0", "sp", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",
17 "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21", 17 "r11", "ip", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21",
18 "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "fp"}; 18 "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "fp"};
19 19
20 20
21 // List of alias names which can be used when referring to PPC registers. 21 const char* DoubleRegisters::names_[kNumDoubleRegisters] = {
22 const Registers::RegisterAlias Registers::aliases_[] = {{10, "sl"},
23 {11, "r11"},
24 {12, "r12"},
25 {13, "r13"},
26 {14, "r14"},
27 {15, "r15"},
28 {kNoRegister, NULL}};
29
30
31 const char* Registers::Name(int reg) {
32 const char* result;
33 if ((0 <= reg) && (reg < kNumRegisters)) {
34 result = names_[reg];
35 } else {
36 result = "noreg";
37 }
38 return result;
39 }
40
41
42 const char* FPRegisters::names_[kNumFPRegisters] = {
43 "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", 22 "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10",
44 "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", "d21", 23 "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", "d21",
45 "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31"}; 24 "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31"};
46 25
47 26
48 const char* FPRegisters::Name(int reg) { 27 int DoubleRegisters::Number(const char* name) {
49 DCHECK((0 <= reg) && (reg < kNumFPRegisters)); 28 for (int i = 0; i < kNumDoubleRegisters; i++) {
50 return names_[reg];
51 }
52
53
54 int FPRegisters::Number(const char* name) {
55 for (int i = 0; i < kNumFPRegisters; i++) {
56 if (strcmp(names_[i], name) == 0) { 29 if (strcmp(names_[i], name) == 0) {
57 return i; 30 return i;
58 } 31 }
59 } 32 }
60 33
61 // No register with the requested name found. 34 // No register with the requested name found.
62 return kNoRegister; 35 return kNoRegister;
63 } 36 }
64 37
65 38
66 int Registers::Number(const char* name) { 39 int Registers::Number(const char* name) {
67 // Look through the canonical names. 40 // Look through the canonical names.
68 for (int i = 0; i < kNumRegisters; i++) { 41 for (int i = 0; i < kNumRegisters; i++) {
69 if (strcmp(names_[i], name) == 0) { 42 if (strcmp(names_[i], name) == 0) {
70 return i; 43 return i;
71 } 44 }
72 } 45 }
73 46
74 // Look through the alias names.
75 int i = 0;
76 while (aliases_[i].reg != kNoRegister) {
77 if (strcmp(aliases_[i].name, name) == 0) {
78 return aliases_[i].reg;
79 }
80 i++;
81 }
82
83 // No register with the requested name found. 47 // No register with the requested name found.
84 return kNoRegister; 48 return kNoRegister;
85 } 49 }
86 } // namespace internal 50 } // namespace internal
87 } // namespace v8 51 } // namespace v8
88 52
89 #endif // V8_TARGET_ARCH_PPC 53 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/constants-ppc.h ('k') | src/ppc/deoptimizer-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698