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

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

Issue 6759025: Version 3.2.6 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 9 years, 8 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
« no previous file with comments | « src/mips/constants-mips.h ('k') | src/mips/cpu-mips.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 13 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #if defined(V8_TARGET_ARCH_MIPS) 30 #if defined(V8_TARGET_ARCH_MIPS)
31 31
32 #include "constants-mips.h" 32 #include "constants-mips.h"
33 33
34 namespace assembler { 34 namespace v8 {
35 namespace mips { 35 namespace internal {
36
37 namespace v8i = v8::internal;
38 36
39 37
40 // ----------------------------------------------------------------------------- 38 // -----------------------------------------------------------------------------
41 // Registers 39 // Registers
42 40
43 41
44 // These register names are defined in a way to match the native disassembler 42 // These register names are defined in a way to match the native disassembler
45 // formatting. See for example the command "objdump -d <binary file>". 43 // formatting. See for example the command "objdump -d <binary file>".
46 const char* Registers::names_[kNumSimuRegisters] = { 44 const char* Registers::names_[kNumSimuRegisters] = {
47 "zero_reg", 45 "zero_reg",
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 return aliases_[i].reg; 93 return aliases_[i].reg;
96 } 94 }
97 i++; 95 i++;
98 } 96 }
99 97
100 // No register with the reguested name found. 98 // No register with the reguested name found.
101 return kInvalidRegister; 99 return kInvalidRegister;
102 } 100 }
103 101
104 102
105 const char* FPURegister::names_[kNumFPURegister] = { 103 const char* FPURegisters::names_[kNumFPURegisters] = {
106 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", 104 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11",
107 "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", "f20", "f21", 105 "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", "f20", "f21",
108 "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31" 106 "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"
109 }; 107 };
110 108
111 // List of alias names which can be used when referring to MIPS registers. 109 // List of alias names which can be used when referring to MIPS registers.
112 const FPURegister::RegisterAlias FPURegister::aliases_[] = { 110 const FPURegisters::RegisterAlias FPURegisters::aliases_[] = {
113 {kInvalidRegister, NULL} 111 {kInvalidRegister, NULL}
114 }; 112 };
115 113
116 const char* FPURegister::Name(int creg) { 114 const char* FPURegisters::Name(int creg) {
117 const char* result; 115 const char* result;
118 if ((0 <= creg) && (creg < kNumFPURegister)) { 116 if ((0 <= creg) && (creg < kNumFPURegisters)) {
119 result = names_[creg]; 117 result = names_[creg];
120 } else { 118 } else {
121 result = "nocreg"; 119 result = "nocreg";
122 } 120 }
123 return result; 121 return result;
124 } 122 }
125 123
126 124
127 int FPURegister::Number(const char* name) { 125 int FPURegisters::Number(const char* name) {
128 // Look through the canonical names. 126 // Look through the canonical names.
129 for (int i = 0; i < kNumSimuRegisters; i++) { 127 for (int i = 0; i < kNumFPURegisters; i++) {
130 if (strcmp(names_[i], name) == 0) { 128 if (strcmp(names_[i], name) == 0) {
131 return i; 129 return i;
132 } 130 }
133 } 131 }
134 132
135 // Look through the alias names. 133 // Look through the alias names.
136 int i = 0; 134 int i = 0;
137 while (aliases_[i].creg != kInvalidRegister) { 135 while (aliases_[i].creg != kInvalidRegister) {
138 if (strcmp(aliases_[i].name, name) == 0) { 136 if (strcmp(aliases_[i].name, name) == 0) {
139 return aliases_[i].creg; 137 return aliases_[i].creg;
140 } 138 }
141 i++; 139 i++;
142 } 140 }
143 141
144 // No Cregister with the reguested name found. 142 // No Cregister with the reguested name found.
145 return kInvalidFPURegister; 143 return kInvalidFPURegister;
146 } 144 }
147 145
148 146
149 // ----------------------------------------------------------------------------- 147 // -----------------------------------------------------------------------------
150 // Instruction 148 // Instruction
151 149
152 bool Instruction::IsForbiddenInBranchDelay() { 150 bool Instruction::IsForbiddenInBranchDelay() const {
153 int op = OpcodeFieldRaw(); 151 const int op = OpcodeFieldRaw();
154 switch (op) { 152 switch (op) {
155 case J: 153 case J:
156 case JAL: 154 case JAL:
157 case BEQ: 155 case BEQ:
158 case BNE: 156 case BNE:
159 case BLEZ: 157 case BLEZ:
160 case BGTZ: 158 case BGTZ:
161 case BEQL: 159 case BEQL:
162 case BNEL: 160 case BNEL:
163 case BLEZL: 161 case BLEZL:
(...skipping 18 matching lines...) Expand all
182 default: 180 default:
183 return false; 181 return false;
184 }; 182 };
185 break; 183 break;
186 default: 184 default:
187 return false; 185 return false;
188 }; 186 };
189 } 187 }
190 188
191 189
192 bool Instruction::IsLinkingInstruction() { 190 bool Instruction::IsLinkingInstruction() const {
193 int op = OpcodeFieldRaw(); 191 const int op = OpcodeFieldRaw();
194 switch (op) { 192 switch (op) {
195 case JAL: 193 case JAL:
196 case BGEZAL: 194 case REGIMM:
197 case BLTZAL: 195 switch (RtFieldRaw()) {
198 return true; 196 case BGEZAL:
197 case BLTZAL:
198 return true;
199 default:
200 return false;
201 };
199 case SPECIAL: 202 case SPECIAL:
200 switch (FunctionFieldRaw()) { 203 switch (FunctionFieldRaw()) {
201 case JALR: 204 case JALR:
202 return true; 205 return true;
203 default: 206 default:
204 return false; 207 return false;
205 }; 208 };
206 default: 209 default:
207 return false; 210 return false;
208 }; 211 };
209 } 212 }
210 213
211 214
212 bool Instruction::IsTrap() { 215 bool Instruction::IsTrap() const {
213 if (OpcodeFieldRaw() != SPECIAL) { 216 if (OpcodeFieldRaw() != SPECIAL) {
214 return false; 217 return false;
215 } else { 218 } else {
216 switch (FunctionFieldRaw()) { 219 switch (FunctionFieldRaw()) {
217 case BREAK: 220 case BREAK:
218 case TGE: 221 case TGE:
219 case TGEU: 222 case TGEU:
220 case TLT: 223 case TLT:
221 case TLTU: 224 case TLTU:
222 case TEQ: 225 case TEQ:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 case XOR: 260 case XOR:
258 case NOR: 261 case NOR:
259 case SLT: 262 case SLT:
260 case SLTU: 263 case SLTU:
261 case TGE: 264 case TGE:
262 case TGEU: 265 case TGEU:
263 case TLT: 266 case TLT:
264 case TLTU: 267 case TLTU:
265 case TEQ: 268 case TEQ:
266 case TNE: 269 case TNE:
270 case MOVZ:
271 case MOVN:
272 case MOVCI:
267 return kRegisterType; 273 return kRegisterType;
268 default: 274 default:
269 UNREACHABLE(); 275 UNREACHABLE();
270 }; 276 };
271 break; 277 break;
272 case SPECIAL2: 278 case SPECIAL2:
273 switch (FunctionFieldRaw()) { 279 switch (FunctionFieldRaw()) {
274 case MUL: 280 case MUL:
281 case CLZ:
282 return kRegisterType;
283 default:
284 UNREACHABLE();
285 };
286 break;
287 case SPECIAL3:
288 switch (FunctionFieldRaw()) {
289 case INS:
290 case EXT:
275 return kRegisterType; 291 return kRegisterType;
276 default: 292 default:
277 UNREACHABLE(); 293 UNREACHABLE();
278 }; 294 };
279 break; 295 break;
280 case COP1: // Coprocessor instructions 296 case COP1: // Coprocessor instructions
281 switch (FunctionFieldRaw()) { 297 switch (RsFieldRawNoAssert()) {
282 case BC1: // branch on coprocessor condition 298 case BC1: // branch on coprocessor condition
283 return kImmediateType; 299 return kImmediateType;
284 default: 300 default:
285 return kRegisterType; 301 return kRegisterType;
286 }; 302 };
287 break; 303 break;
288 // 16 bits Immediate type instructions. eg: addi dest, src, imm16 304 // 16 bits Immediate type instructions. eg: addi dest, src, imm16
289 case REGIMM: 305 case REGIMM:
290 case BEQ: 306 case BEQ:
291 case BNE: 307 case BNE:
292 case BLEZ: 308 case BLEZ:
293 case BGTZ: 309 case BGTZ:
294 case ADDI: 310 case ADDI:
295 case ADDIU: 311 case ADDIU:
296 case SLTI: 312 case SLTI:
297 case SLTIU: 313 case SLTIU:
298 case ANDI: 314 case ANDI:
299 case ORI: 315 case ORI:
300 case XORI: 316 case XORI:
301 case LUI: 317 case LUI:
302 case BEQL: 318 case BEQL:
303 case BNEL: 319 case BNEL:
304 case BLEZL: 320 case BLEZL:
305 case BGTZL: 321 case BGTZL:
306 case LB: 322 case LB:
323 case LH:
324 case LWL:
307 case LW: 325 case LW:
308 case LBU: 326 case LBU:
327 case LHU:
328 case LWR:
309 case SB: 329 case SB:
330 case SH:
331 case SWL:
310 case SW: 332 case SW:
333 case SWR:
311 case LWC1: 334 case LWC1:
312 case LDC1: 335 case LDC1:
313 case SWC1: 336 case SWC1:
314 case SDC1: 337 case SDC1:
315 return kImmediateType; 338 return kImmediateType;
316 // 26 bits immediate type instructions. eg: j imm26 339 // 26 bits immediate type instructions. eg: j imm26
317 case J: 340 case J:
318 case JAL: 341 case JAL:
319 return kJumpType; 342 return kJumpType;
320 default: 343 default:
321 UNREACHABLE(); 344 UNREACHABLE();
322 }; 345 };
323 return kUnsupported; 346 return kUnsupported;
324 } 347 }
325 348
326 } } // namespace assembler::mips 349
350 } } // namespace v8::internal
327 351
328 #endif // V8_TARGET_ARCH_MIPS 352 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/constants-mips.h ('k') | src/mips/cpu-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698