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

Side by Side Diff: src/mips64/disasm-mips64.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 | « src/mips/disasm-mips.cc ('k') | test/cctest/test-disasm-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 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 int InstructionDecode(byte* instruction); 60 int InstructionDecode(byte* instruction);
61 61
62 private: 62 private:
63 // Bottleneck functions to print into the out_buffer. 63 // Bottleneck functions to print into the out_buffer.
64 void PrintChar(const char ch); 64 void PrintChar(const char ch);
65 void Print(const char* str); 65 void Print(const char* str);
66 66
67 // Printing of common values. 67 // Printing of common values.
68 void PrintRegister(int reg); 68 void PrintRegister(int reg);
69 void PrintFPURegister(int freg); 69 void PrintFPURegister(int freg);
70 void PrintFPUStatusRegister(int freg);
70 void PrintRs(Instruction* instr); 71 void PrintRs(Instruction* instr);
71 void PrintRt(Instruction* instr); 72 void PrintRt(Instruction* instr);
72 void PrintRd(Instruction* instr); 73 void PrintRd(Instruction* instr);
73 void PrintFs(Instruction* instr); 74 void PrintFs(Instruction* instr);
74 void PrintFt(Instruction* instr); 75 void PrintFt(Instruction* instr);
75 void PrintFd(Instruction* instr); 76 void PrintFd(Instruction* instr);
76 void PrintSa(Instruction* instr); 77 void PrintSa(Instruction* instr);
77 void PrintSd(Instruction* instr); 78 void PrintSd(Instruction* instr);
78 void PrintSs1(Instruction* instr); 79 void PrintSs1(Instruction* instr);
79 void PrintSs2(Instruction* instr); 80 void PrintSs2(Instruction* instr);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 PrintRegister(reg); 184 PrintRegister(reg);
184 } 185 }
185 186
186 187
187 // Print the FPUregister name according to the active name converter. 188 // Print the FPUregister name according to the active name converter.
188 void Decoder::PrintFPURegister(int freg) { 189 void Decoder::PrintFPURegister(int freg) {
189 Print(converter_.NameOfXMMRegister(freg)); 190 Print(converter_.NameOfXMMRegister(freg));
190 } 191 }
191 192
192 193
194 void Decoder::PrintFPUStatusRegister(int freg) {
195 switch (freg) {
196 case kFCSRRegister:
197 Print("FCSR");
198 break;
199 default:
200 Print(converter_.NameOfXMMRegister(freg));
201 }
202 }
203
204
193 void Decoder::PrintFs(Instruction* instr) { 205 void Decoder::PrintFs(Instruction* instr) {
194 int freg = instr->RsValue(); 206 int freg = instr->RsValue();
195 PrintFPURegister(freg); 207 PrintFPURegister(freg);
196 } 208 }
197 209
198 210
199 void Decoder::PrintFt(Instruction* instr) { 211 void Decoder::PrintFt(Instruction* instr) {
200 int freg = instr->RtValue(); 212 int freg = instr->RtValue();
201 PrintFPURegister(freg); 213 PrintFPURegister(freg);
202 } 214 }
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 } 486 }
475 UNREACHABLE(); 487 UNREACHABLE();
476 return -1; 488 return -1;
477 } 489 }
478 490
479 491
480 // Handle all FPUregister based formatting in this function to reduce the 492 // Handle all FPUregister based formatting in this function to reduce the
481 // complexity of FormatOption. 493 // complexity of FormatOption.
482 int Decoder::FormatFPURegister(Instruction* instr, const char* format) { 494 int Decoder::FormatFPURegister(Instruction* instr, const char* format) {
483 DCHECK(format[0] == 'f'); 495 DCHECK(format[0] == 'f');
484 if (format[1] == 's') { // 'fs: fs register. 496 if ((CTC1 == instr->RsFieldRaw()) || (CFC1 == instr->RsFieldRaw())) {
485 int reg = instr->FsValue(); 497 if (format[1] == 's') { // 'fs: fs register.
486 PrintFPURegister(reg); 498 int reg = instr->FsValue();
487 return 2; 499 PrintFPUStatusRegister(reg);
488 } else if (format[1] == 't') { // 'ft: ft register. 500 return 2;
489 int reg = instr->FtValue(); 501 } else if (format[1] == 't') { // 'ft: ft register.
490 PrintFPURegister(reg); 502 int reg = instr->FtValue();
491 return 2; 503 PrintFPUStatusRegister(reg);
492 } else if (format[1] == 'd') { // 'fd: fd register. 504 return 2;
493 int reg = instr->FdValue(); 505 } else if (format[1] == 'd') { // 'fd: fd register.
494 PrintFPURegister(reg); 506 int reg = instr->FdValue();
495 return 2; 507 PrintFPUStatusRegister(reg);
496 } else if (format[1] == 'r') { // 'fr: fr register. 508 return 2;
497 int reg = instr->FrValue(); 509 } else if (format[1] == 'r') { // 'fr: fr register.
498 PrintFPURegister(reg); 510 int reg = instr->FrValue();
499 return 2; 511 PrintFPUStatusRegister(reg);
512 return 2;
513 }
514 } else {
515 if (format[1] == 's') { // 'fs: fs register.
516 int reg = instr->FsValue();
517 PrintFPURegister(reg);
518 return 2;
519 } else if (format[1] == 't') { // 'ft: ft register.
520 int reg = instr->FtValue();
521 PrintFPURegister(reg);
522 return 2;
523 } else if (format[1] == 'd') { // 'fd: fd register.
524 int reg = instr->FdValue();
525 PrintFPURegister(reg);
526 return 2;
527 } else if (format[1] == 'r') { // 'fr: fr register.
528 int reg = instr->FrValue();
529 PrintFPURegister(reg);
530 return 2;
531 }
500 } 532 }
501 UNREACHABLE(); 533 UNREACHABLE();
502 return -1; 534 return -1;
503 } 535 }
504 536
505 537
506 // FormatOption takes a formatting string and interprets it based on 538 // FormatOption takes a formatting string and interprets it based on
507 // the current instructions. The format string points to the first 539 // the current instructions. The format string points to the first
508 // character of the option string (the option escape has already been 540 // character of the option string (the option escape has already been
509 // consumed by the caller.) FormatOption returns the number of 541 // consumed by the caller.) FormatOption returns the number of
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); 1971 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start());
1940 } 1972 }
1941 } 1973 }
1942 1974
1943 1975
1944 #undef UNSUPPORTED 1976 #undef UNSUPPORTED
1945 1977
1946 } // namespace disasm 1978 } // namespace disasm
1947 1979
1948 #endif // V8_TARGET_ARCH_MIPS64 1980 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/disasm-mips.cc ('k') | test/cctest/test-disasm-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698