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

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

Issue 1481023002: MIPS: Fixup disasembler for ctc1 and cfc1 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 | « no previous file | src/mips64/disasm-mips64.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 // A Disassembler object is used to disassemble a block of code instruction by 5 // A Disassembler object is used to disassemble a block of code instruction by
6 // instruction. The default implementation of the NameConverter object can be 6 // instruction. The default implementation of the NameConverter object can be
7 // overriden to modify register names or to do symbol lookup on addresses. 7 // overriden to modify register names or to do symbol lookup on addresses.
8 // 8 //
9 // The example below will disassemble a block of code and print it to stdout. 9 // The example below will disassemble a block of code and print it to stdout.
10 // 10 //
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 int InstructionDecode(byte* instruction); 59 int InstructionDecode(byte* instruction);
60 60
61 private: 61 private:
62 // Bottleneck functions to print into the out_buffer. 62 // Bottleneck functions to print into the out_buffer.
63 void PrintChar(const char ch); 63 void PrintChar(const char ch);
64 void Print(const char* str); 64 void Print(const char* str);
65 65
66 // Printing of common values. 66 // Printing of common values.
67 void PrintRegister(int reg); 67 void PrintRegister(int reg);
68 void PrintFPURegister(int freg); 68 void PrintFPURegister(int freg);
69 void PrintFPUStatusRegister(int freg);
69 void PrintRs(Instruction* instr); 70 void PrintRs(Instruction* instr);
70 void PrintRt(Instruction* instr); 71 void PrintRt(Instruction* instr);
71 void PrintRd(Instruction* instr); 72 void PrintRd(Instruction* instr);
72 void PrintFs(Instruction* instr); 73 void PrintFs(Instruction* instr);
73 void PrintFt(Instruction* instr); 74 void PrintFt(Instruction* instr);
74 void PrintFd(Instruction* instr); 75 void PrintFd(Instruction* instr);
75 void PrintSa(Instruction* instr); 76 void PrintSa(Instruction* instr);
76 void PrintSd(Instruction* instr); 77 void PrintSd(Instruction* instr);
77 void PrintSs1(Instruction* instr); 78 void PrintSs1(Instruction* instr);
78 void PrintSs2(Instruction* instr); 79 void PrintSs2(Instruction* instr);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 PrintRegister(reg); 176 PrintRegister(reg);
176 } 177 }
177 178
178 179
179 // Print the FPUregister name according to the active name converter. 180 // Print the FPUregister name according to the active name converter.
180 void Decoder::PrintFPURegister(int freg) { 181 void Decoder::PrintFPURegister(int freg) {
181 Print(converter_.NameOfXMMRegister(freg)); 182 Print(converter_.NameOfXMMRegister(freg));
182 } 183 }
183 184
184 185
186 void Decoder::PrintFPUStatusRegister(int freg) {
187 switch (freg) {
188 case kFCSRRegister:
189 Print("FCSR");
190 break;
191 default:
192 Print(converter_.NameOfXMMRegister(freg));
193 }
194 }
195
196
185 void Decoder::PrintFs(Instruction* instr) { 197 void Decoder::PrintFs(Instruction* instr) {
186 int freg = instr->RsValue(); 198 int freg = instr->RsValue();
187 PrintFPURegister(freg); 199 PrintFPURegister(freg);
188 } 200 }
189 201
190 202
191 void Decoder::PrintFt(Instruction* instr) { 203 void Decoder::PrintFt(Instruction* instr) {
192 int freg = instr->RtValue(); 204 int freg = instr->RtValue();
193 PrintFPURegister(freg); 205 PrintFPURegister(freg);
194 } 206 }
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 } 481 }
470 UNREACHABLE(); 482 UNREACHABLE();
471 return -1; 483 return -1;
472 } 484 }
473 485
474 486
475 // Handle all FPUregister based formatting in this function to reduce the 487 // Handle all FPUregister based formatting in this function to reduce the
476 // complexity of FormatOption. 488 // complexity of FormatOption.
477 int Decoder::FormatFPURegister(Instruction* instr, const char* format) { 489 int Decoder::FormatFPURegister(Instruction* instr, const char* format) {
478 DCHECK(format[0] == 'f'); 490 DCHECK(format[0] == 'f');
479 if (format[1] == 's') { // 'fs: fs register. 491 if ((CTC1 == instr->RsFieldRaw()) || (CFC1 == instr->RsFieldRaw())) {
480 int reg = instr->FsValue(); 492 if (format[1] == 's') { // 'fs: fs register.
481 PrintFPURegister(reg); 493 int reg = instr->FsValue();
482 return 2; 494 PrintFPUStatusRegister(reg);
483 } else if (format[1] == 't') { // 'ft: ft register. 495 return 2;
484 int reg = instr->FtValue(); 496 } else if (format[1] == 't') { // 'ft: ft register.
485 PrintFPURegister(reg); 497 int reg = instr->FtValue();
486 return 2; 498 PrintFPUStatusRegister(reg);
487 } else if (format[1] == 'd') { // 'fd: fd register. 499 return 2;
488 int reg = instr->FdValue(); 500 } else if (format[1] == 'd') { // 'fd: fd register.
489 PrintFPURegister(reg); 501 int reg = instr->FdValue();
490 return 2; 502 PrintFPUStatusRegister(reg);
491 } else if (format[1] == 'r') { // 'fr: fr register. 503 return 2;
492 int reg = instr->FrValue(); 504 } else if (format[1] == 'r') { // 'fr: fr register.
493 PrintFPURegister(reg); 505 int reg = instr->FrValue();
494 return 2; 506 PrintFPUStatusRegister(reg);
507 return 2;
508 }
509 } else {
510 if (format[1] == 's') { // 'fs: fs register.
511 int reg = instr->FsValue();
512 PrintFPURegister(reg);
513 return 2;
514 } else if (format[1] == 't') { // 'ft: ft register.
515 int reg = instr->FtValue();
516 PrintFPURegister(reg);
517 return 2;
518 } else if (format[1] == 'd') { // 'fd: fd register.
519 int reg = instr->FdValue();
520 PrintFPURegister(reg);
521 return 2;
522 } else if (format[1] == 'r') { // 'fr: fr register.
523 int reg = instr->FrValue();
524 PrintFPURegister(reg);
525 return 2;
526 }
495 } 527 }
496 UNREACHABLE(); 528 UNREACHABLE();
497 return -1; 529 return -1;
498 } 530 }
499 531
500 532
501 // FormatOption takes a formatting string and interprets it based on 533 // FormatOption takes a formatting string and interprets it based on
502 // the current instructions. The format string points to the first 534 // the current instructions. The format string points to the first
503 // character of the option string (the option escape has already been 535 // character of the option string (the option escape has already been
504 // consumed by the caller.) FormatOption returns the number of 536 // consumed by the caller.) FormatOption returns the number of
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); 1744 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start());
1713 } 1745 }
1714 } 1746 }
1715 1747
1716 1748
1717 #undef UNSUPPORTED 1749 #undef UNSUPPORTED
1718 1750
1719 } // namespace disasm 1751 } // namespace disasm
1720 1752
1721 #endif // V8_TARGET_ARCH_MIPS 1753 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips64/disasm-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698