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

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

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