OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/mips64/constants-mips64.h" | 7 #include "src/mips64/constants-mips64.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 while (aliases_[i].creg != kInvalidRegister) { | 114 while (aliases_[i].creg != kInvalidRegister) { |
115 if (strcmp(aliases_[i].name, name) == 0) { | 115 if (strcmp(aliases_[i].name, name) == 0) { |
116 return aliases_[i].creg; | 116 return aliases_[i].creg; |
117 } | 117 } |
118 i++; | 118 i++; |
119 } | 119 } |
120 | 120 |
121 // No Cregister with the reguested name found. | 121 // No Cregister with the reguested name found. |
122 return kInvalidFPURegister; | 122 return kInvalidFPURegister; |
123 } | 123 } |
| 124 |
| 125 const char* MSARegisters::names_[kNumMSARegisters] = { |
| 126 "w0", "w1", "w2", "w3", "w4", "w5", "w6", "w7", "w8", "w9", "w10", |
| 127 "w11", "w12", "w13", "w14", "w15", "w16", "w17", "w18", "w19", "w20", "w21", |
| 128 "w22", "w23", "w24", "w25", "w26", "w27", "w28", "w29", "w30", "w31"}; |
| 129 |
| 130 const MSARegisters::RegisterAlias MSARegisters::aliases_[] = { |
| 131 {kInvalidRegister, NULL}}; |
| 132 |
| 133 const char* MSARegisters::Name(int creg) { |
| 134 const char* result; |
| 135 if ((0 <= creg) && (creg < kNumMSARegisters)) { |
| 136 result = names_[creg]; |
| 137 } else { |
| 138 result = "nocreg"; |
| 139 } |
| 140 return result; |
| 141 } |
| 142 |
| 143 int MSARegisters::Number(const char* name) { |
| 144 // Look through the canonical names. |
| 145 for (int i = 0; i < kNumMSARegisters; i++) { |
| 146 if (strcmp(names_[i], name) == 0) { |
| 147 return i; |
| 148 } |
| 149 } |
| 150 |
| 151 // Look through the alias names. |
| 152 int i = 0; |
| 153 while (aliases_[i].creg != kInvalidRegister) { |
| 154 if (strcmp(aliases_[i].name, name) == 0) { |
| 155 return aliases_[i].creg; |
| 156 } |
| 157 i++; |
| 158 } |
| 159 |
| 160 // No Cregister with the reguested name found. |
| 161 return kInvalidMSARegister; |
| 162 } |
| 163 |
124 } // namespace internal | 164 } // namespace internal |
125 } // namespace v8 | 165 } // namespace v8 |
126 | 166 |
127 #endif // V8_TARGET_ARCH_MIPS64 | 167 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |