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

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

Issue 385069: Fix some style issues in the ARM code.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month 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
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 reg++; 329 reg++;
330 rlist >>= 1; 330 rlist >>= 1;
331 } 331 }
332 Print("}"); 332 Print("}");
333 return 5; 333 return 5;
334 } 334 }
335 UNREACHABLE(); 335 UNREACHABLE();
336 return -1; 336 return -1;
337 } 337 }
338 338
339
339 // Handle all VFP register based formatting in this function to reduce the 340 // Handle all VFP register based formatting in this function to reduce the
340 // complexity of FormatOption. 341 // complexity of FormatOption.
341 int Decoder::FormatVFPRegister(Instr* instr, const char* format) { 342 int Decoder::FormatVFPRegister(Instr* instr, const char* format) {
342 ASSERT((format[0] == 'S') || (format[0] == 'D')); 343 ASSERT((format[0] == 'S') || (format[0] == 'D'));
343 344
344 if (format[1] == 'n') { 345 if (format[1] == 'n') {
345 int reg = instr->VnField(); 346 int reg = instr->VnField();
346 if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->NField())); 347 if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->NField()));
347 if (format[0] == 'D') PrintDRegister(reg); 348 if (format[0] == 'D') PrintDRegister(reg);
348 return 2; 349 return 2;
349 } else if (format[1] == 'm') { 350 } else if (format[1] == 'm') {
350 int reg = instr->VmField(); 351 int reg = instr->VmField();
351 if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->MField())); 352 if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->MField()));
352 if (format[0] == 'D') PrintDRegister(reg); 353 if (format[0] == 'D') PrintDRegister(reg);
353 return 2; 354 return 2;
354 } else if (format[1] == 'd') { 355 } else if (format[1] == 'd') {
355 int reg = instr->VdField(); 356 int reg = instr->VdField();
356 if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->DField())); 357 if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->DField()));
357 if (format[0] == 'D') PrintDRegister(reg); 358 if (format[0] == 'D') PrintDRegister(reg);
358 return 2; 359 return 2;
359 } 360 }
360 361
361 UNREACHABLE(); 362 UNREACHABLE();
362 return -1; 363 return -1;
363 } 364 }
364 365
366
365 int Decoder::FormatVFPinstruction(Instr* instr, const char* format) { 367 int Decoder::FormatVFPinstruction(Instr* instr, const char* format) {
366 Print(format); 368 Print(format);
367 return 0; 369 return 0;
368 } 370 }
369 371
370 372
371
372
373 // FormatOption takes a formatting string and interprets it based on 373 // FormatOption takes a formatting string and interprets it based on
374 // the current instructions. The format string points to the first 374 // the current instructions. The format string points to the first
375 // character of the option string (the option escape has already been 375 // character of the option string (the option escape has already been
376 // consumed by the caller.) FormatOption returns the number of 376 // consumed by the caller.) FormatOption returns the number of
377 // characters that were consumed from the formatting string. 377 // characters that were consumed from the formatting string.
378 int Decoder::FormatOption(Instr* instr, const char* format) { 378 int Decoder::FormatOption(Instr* instr, const char* format) {
379 switch (format[0]) { 379 switch (format[0]) {
380 case 'a': { // 'a: accumulate multiplies 380 case 'a': { // 'a: accumulate multiplies
381 if (instr->Bit(21) == 0) { 381 if (instr->Bit(21) == 0) {
382 Print("ul"); 382 Print("ul");
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 break; 890 break;
891 } 891 }
892 } 892 }
893 return; 893 return;
894 } 894 }
895 Format(instr, "break 'msg"); 895 Format(instr, "break 'msg");
896 } 896 }
897 897
898 898
899 // void Decoder::DecodeTypeVFP(Instr* instr) 899 // void Decoder::DecodeTypeVFP(Instr* instr)
900 // Implements the following 900 // Implements the following VFP instructions:
901 // VFP instructions 901 // fmsr: Sn = Rt
902 // fmsr :Sn = Rt 902 // fmrs: Rt = Sn
903 // fmrs :Rt = Sn
904 // fsitod: Dd = Sm 903 // fsitod: Dd = Sm
905 // ftosid: Sd = Dm 904 // ftosid: Sd = Dm
906 // Dd = faddd(Dn, Dm) 905 // Dd = faddd(Dn, Dm)
907 // Dd = fsubd(Dn, Dm) 906 // Dd = fsubd(Dn, Dm)
908 // Dd = fmuld(Dn, Dm) 907 // Dd = fmuld(Dn, Dm)
909 // Dd = fdivd(Dn, Dm) 908 // Dd = fdivd(Dn, Dm)
910 // vcmp(Dd, Dm) 909 // vcmp(Dd, Dm)
911 // VMRS 910 // VMRS
912 void Decoder::DecodeTypeVFP(Instr* instr) { 911 void Decoder::DecodeTypeVFP(Instr* instr) {
913 ASSERT((instr->TypeField() == 7) && (instr->Bit(24) == 0x0) ); 912 ASSERT((instr->TypeField() == 7) && (instr->Bit(24) == 0x0) );
(...skipping 30 matching lines...) Expand all
944 Format(instr, "vcmp.f64'cond 'Dd, 'Dm"); 943 Format(instr, "vcmp.f64'cond 'Dd, 'Dm");
945 } else if ((instr->Bits(23, 20) == 0xF) && 944 } else if ((instr->Bits(23, 20) == 0xF) &&
946 (instr->Bits(19, 16) == 0x1) && 945 (instr->Bits(19, 16) == 0x1) &&
947 (instr->Bits(11, 8) == 0xA) && 946 (instr->Bits(11, 8) == 0xA) &&
948 (instr->Bits(7, 5) == 0x0) && 947 (instr->Bits(7, 5) == 0x0) &&
949 (instr->Bit(4) == 0x1) && 948 (instr->Bit(4) == 0x1) &&
950 (instr->Bits(3, 0) == 0x0)) { 949 (instr->Bits(3, 0) == 0x0)) {
951 if (instr->Bits(15, 12) == 0xF) 950 if (instr->Bits(15, 12) == 0xF)
952 Format(instr, "vmrs'cond APSR, FPSCR"); 951 Format(instr, "vmrs'cond APSR, FPSCR");
953 else 952 else
954 Unknown(instr); // not used by V8 953 Unknown(instr); // Not used by V8.
955 } else { 954 } else {
956 Unknown(instr); // not used by V8 955 Unknown(instr); // Not used by V8.
957 } 956 }
958 } else if (instr->Bit(21) == 1) { 957 } else if (instr->Bit(21) == 1) {
959 if ((instr->Bit(20) == 0x1) && 958 if ((instr->Bit(20) == 0x1) &&
960 (instr->Bits(11, 9) == 0x5) && 959 (instr->Bits(11, 9) == 0x5) &&
961 (instr->Bit(8) == 0x1) && 960 (instr->Bit(8) == 0x1) &&
962 (instr->Bit(6) == 0) && 961 (instr->Bit(6) == 0) &&
963 (instr->Bit(4) == 0)) { 962 (instr->Bit(4) == 0)) {
964 Format(instr, "vadd.f64'cond 'Dd, 'Dn, 'Dm"); 963 Format(instr, "vadd.f64'cond 'Dd, 'Dn, 'Dm");
965 } else if ((instr->Bit(20) == 0x1) && 964 } else if ((instr->Bit(20) == 0x1) &&
966 (instr->Bits(11, 9) == 0x5) && 965 (instr->Bits(11, 9) == 0x5) &&
967 (instr->Bit(8) == 0x1) && 966 (instr->Bit(8) == 0x1) &&
968 (instr->Bit(6) == 1) && 967 (instr->Bit(6) == 1) &&
969 (instr->Bit(4) == 0)) { 968 (instr->Bit(4) == 0)) {
970 Format(instr, "vsub.f64'cond 'Dd, 'Dn, 'Dm"); 969 Format(instr, "vsub.f64'cond 'Dd, 'Dn, 'Dm");
971 } else if ((instr->Bit(20) == 0x0) && 970 } else if ((instr->Bit(20) == 0x0) &&
972 (instr->Bits(11, 9) == 0x5) && 971 (instr->Bits(11, 9) == 0x5) &&
973 (instr->Bit(8) == 0x1) && 972 (instr->Bit(8) == 0x1) &&
974 (instr->Bit(6) == 0) && 973 (instr->Bit(6) == 0) &&
975 (instr->Bit(4) == 0)) { 974 (instr->Bit(4) == 0)) {
976 Format(instr, "vmul.f64'cond 'Dd, 'Dn, 'Dm"); 975 Format(instr, "vmul.f64'cond 'Dd, 'Dn, 'Dm");
977 } else { 976 } else {
978 Unknown(instr); // not used by V8 977 Unknown(instr); // Not used by V8.
979 } 978 }
980 } else { 979 } else {
981 if ((instr->Bit(20) == 0x0) && 980 if ((instr->Bit(20) == 0x0) &&
982 (instr->Bits(11, 8) == 0xA) && 981 (instr->Bits(11, 8) == 0xA) &&
983 (instr->Bits(6, 5) == 0x0) && 982 (instr->Bits(6, 5) == 0x0) &&
984 (instr->Bit(4) == 1) && 983 (instr->Bit(4) == 1) &&
985 (instr->Bits(3, 0) == 0x0)) { 984 (instr->Bits(3, 0) == 0x0)) {
986 Format(instr, "vmov'cond 'Sn, 'rt"); 985 Format(instr, "vmov'cond 'Sn, 'rt");
987 } else if ((instr->Bit(20) == 0x1) && 986 } else if ((instr->Bit(20) == 0x1) &&
988 (instr->Bits(11, 8) == 0xA) && 987 (instr->Bits(11, 8) == 0xA) &&
989 (instr->Bits(6, 5) == 0x0) && 988 (instr->Bits(6, 5) == 0x0) &&
990 (instr->Bit(4) == 1) && 989 (instr->Bit(4) == 1) &&
991 (instr->Bits(3, 0) == 0x0)) { 990 (instr->Bits(3, 0) == 0x0)) {
992 Format(instr, "vmov'cond 'rt, 'Sn"); 991 Format(instr, "vmov'cond 'rt, 'Sn");
993 } else { 992 } else {
994 Unknown(instr); // not used by V8 993 Unknown(instr); // Not used by V8.
995 } 994 }
996 } 995 }
997 } 996 }
998 997
999 998
1000 999 // Decode Type 6 coprocessor instructions.
1001 // Decode Type 6 coprocessor instructions
1002 // Dm = fmdrr(Rt, Rt2) 1000 // Dm = fmdrr(Rt, Rt2)
1003 // <Rt, Rt2> = fmrrd(Dm) 1001 // <Rt, Rt2> = fmrrd(Dm)
1004 void Decoder::DecodeType6CoprocessorIns(Instr* instr) { 1002 void Decoder::DecodeType6CoprocessorIns(Instr* instr) {
1005 ASSERT((instr->TypeField() == 6)); 1003 ASSERT((instr->TypeField() == 6));
1006 1004
1007 if (instr->Bit(23) == 1) { 1005 if (instr->Bit(23) == 1) {
1008 Unknown(instr); // not used by V8 1006 Unknown(instr); // Not used by V8.
1009 } else if (instr->Bit(22) == 1) { 1007 } else if (instr->Bit(22) == 1) {
1010 if ((instr->Bits(27, 24) == 0xC) && 1008 if ((instr->Bits(27, 24) == 0xC) &&
1011 (instr->Bit(22) == 1) && 1009 (instr->Bit(22) == 1) &&
1012 (instr->Bits(11, 8) == 0xB) && 1010 (instr->Bits(11, 8) == 0xB) &&
1013 (instr->Bits(7, 6) == 0x0) && 1011 (instr->Bits(7, 6) == 0x0) &&
1014 (instr->Bit(4) == 1)) { 1012 (instr->Bit(4) == 1)) {
1015 if (instr->Bit(20) == 0) { 1013 if (instr->Bit(20) == 0) {
1016 Format(instr, "vmov'cond 'Dm, 'rt, 'rn"); 1014 Format(instr, "vmov'cond 'Dm, 'rt, 'rn");
1017 } else if (instr->Bit(20) == 1) { 1015 } else if (instr->Bit(20) == 1) {
1018 Format(instr, "vmov'cond 'rt, 'rn, 'Dm"); 1016 Format(instr, "vmov'cond 'rt, 'rn, 'Dm");
1019 } 1017 }
1020 } else { 1018 } else {
1021 Unknown(instr); // not used by V8 1019 Unknown(instr); // Not used by V8.
1022 } 1020 }
1023 } else if (instr->Bit(21) == 1) { 1021 } else if (instr->Bit(21) == 1) {
1024 Unknown(instr); // not used by V8 1022 Unknown(instr); // Not used by V8.
1025 } else { 1023 } else {
1026 Unknown(instr); // not used by V8 1024 Unknown(instr); // Not used by V8.
1027 } 1025 }
1028 } 1026 }
1029 1027
1030 1028
1031 // Disassemble the instruction at *instr_ptr into the output buffer. 1029 // Disassemble the instruction at *instr_ptr into the output buffer.
1032 int Decoder::InstructionDecode(byte* instr_ptr) { 1030 int Decoder::InstructionDecode(byte* instr_ptr) {
1033 Instr* instr = Instr::At(instr_ptr); 1031 Instr* instr = Instr::At(instr_ptr);
1034 // Print raw instruction bytes. 1032 // Print raw instruction bytes.
1035 out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, 1033 out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_,
1036 "%08x ", 1034 "%08x ",
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 buffer[0] = '\0'; 1158 buffer[0] = '\0';
1161 byte* prev_pc = pc; 1159 byte* prev_pc = pc;
1162 pc += d.InstructionDecode(buffer, pc); 1160 pc += d.InstructionDecode(buffer, pc);
1163 fprintf(f, "%p %08x %s\n", 1161 fprintf(f, "%p %08x %s\n",
1164 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); 1162 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start());
1165 } 1163 }
1166 } 1164 }
1167 1165
1168 1166
1169 } // namespace disasm 1167 } // namespace disasm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698