31 #if V8_TARGET_ARCH_PPC 33 #include "src/base/platform/platform.h" 34 #include "src/disasm.h" 35 #include "src/macro-assembler.h" 36 #include "src/ppc/constants-ppc.h" 37 #include "src/register-configuration.h" 50 : converter_(converter), out_buffer_(out_buffer), out_buffer_pos_(0) {
51 out_buffer_[out_buffer_pos_] =
'\0';
58 int InstructionDecode(byte* instruction);
62 void PrintChar(
const char ch);
63 void Print(
const char* str);
66 void PrintRegister(
int reg);
67 void PrintDRegister(
int reg);
68 int FormatFPRegister(Instruction* instr,
const char* format);
69 void PrintSoftwareInterrupt(SoftwareInterruptCodes svc);
72 int FormatRegister(Instruction* instr,
const char* option);
73 int FormatOption(Instruction* instr,
const char* option);
74 void Format(Instruction* instr,
const char* format);
75 void Unknown(Instruction* instr);
76 void UnknownFormat(Instruction* instr,
const char* opcname);
78 void DecodeExt1(Instruction* instr);
79 void DecodeExt2(Instruction* instr);
80 void DecodeExt3(Instruction* instr);
81 void DecodeExt4(Instruction* instr);
82 void DecodeExt5(Instruction* instr);
83 void DecodeExt6(Instruction* instr);
86 Vector<char> out_buffer_;
89 DISALLOW_COPY_AND_ASSIGN(Decoder);
94 #define STRING_STARTS_WITH(string, compare_string) \ 95 (strncmp(string, compare_string, strlen(compare_string)) == 0) 99 void Decoder::PrintChar(
const char ch) { out_buffer_[out_buffer_pos_++] = ch; }
103 void Decoder::Print(
const char* str) {
105 while (cur !=
'\0' && (out_buffer_pos_ < (out_buffer_.length() - 1))) {
109 out_buffer_[out_buffer_pos_] = 0;
114 void Decoder::PrintRegister(
int reg) {
115 Print(converter_.NameOfCPURegister(reg));
120 void Decoder::PrintDRegister(
int reg) {
121 Print(RegisterName(DoubleRegister::from_code(reg)));
127 void Decoder::PrintSoftwareInterrupt(SoftwareInterruptCodes svc) {
129 case kCallRtRedirected:
130 Print(
"call rt redirected");
136 if (svc >= kStopCode) {
137 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d - 0x%x",
138 svc & kStopCodeMask, svc & kStopCodeMask);
140 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", svc);
149 int Decoder::FormatRegister(Instruction* instr,
const char* format) {
150 DCHECK_EQ(format[0],
'r');
152 if ((format[1] ==
't') || (format[1] ==
's')) {
153 int reg = instr->RTValue();
156 }
else if (format[1] ==
'a') {
157 int reg = instr->RAValue();
160 }
else if (format[1] ==
'b') {
161 int reg = instr->RBValue();
172 int Decoder::FormatFPRegister(Instruction* instr,
const char* format) {
173 DCHECK_EQ(format[0],
'D');
177 if (format[1] ==
't') {
178 reg = instr->RTValue();
179 }
else if (format[1] ==
'a') {
180 reg = instr->RAValue();
181 }
else if (format[1] ==
'b') {
182 reg = instr->RBValue();
183 }
else if (format[1] ==
'c') {
184 reg = instr->RCValue();
200 int Decoder::FormatOption(Instruction* instr,
const char* format) {
203 if (instr->Bit(10) == 1) {
209 if (instr->Bit(0) == 1) {
217 return FormatRegister(instr, format);
220 return FormatFPRegister(instr, format);
223 int32_t value = (instr->Bits(15, 0) << 16) >> 16;
224 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", value);
228 int32_t value = instr->Bits(15, 0);
229 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", value);
234 if (instr->Bit(0) == 1) {
241 if (instr->Bit(1) == 1) {
247 int code = instr->Bits(20, 18);
250 SNPrintF(out_buffer_ + out_buffer_pos_,
" cr%d", code);
256 DCHECK(STRING_STARTS_WITH(format,
"target"));
257 if ((format[6] ==
'2') && (format[7] ==
'6')) {
258 int off = ((instr->Bits(25, 2)) << 8) >> 6;
259 out_buffer_pos_ += SNPrintF(
260 out_buffer_ + out_buffer_pos_,
"%+d -> %s", off,
261 converter_.NameOfAddress(reinterpret_cast<byte*>(instr) + off));
263 }
else if ((format[6] ==
'1') && (format[7] ==
'6')) {
264 int off = ((instr->Bits(15, 2)) << 18) >> 16;
265 out_buffer_pos_ += SNPrintF(
266 out_buffer_ + out_buffer_pos_,
"%+d -> %s", off,
267 converter_.NameOfAddress(reinterpret_cast<byte*>(instr) + off));
272 DCHECK_EQ(format[1],
'h');
274 int32_t opcode = instr->OpcodeValue() << 26;
275 int32_t sh = instr->Bits(15, 11);
276 if (opcode == EXT5 ||
277 (opcode == EXT2 && instr->Bits(10, 2) << 2 == SRADIX)) {
279 value = (sh | (instr->Bit(1) << 5));
282 value = (sh << 26) >> 26;
284 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", value);
289 if (format[1] ==
'e') {
290 if (instr->OpcodeValue() << 26 != EXT5) {
292 value = (instr->Bits(10, 6) << 26) >> 26;
295 value = (instr->Bits(10, 6) | (instr->Bit(5) << 5));
297 }
else if (format[1] ==
'b') {
298 if (instr->OpcodeValue() << 26 != EXT5) {
300 value = (instr->Bits(5, 1) << 26) >> 26;
303 value = (instr->Bits(10, 6) | (instr->Bit(5) << 5));
308 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", value);
312 #if V8_TARGET_ARCH_PPC64 314 int32_t value = SIGN_EXT_IMM16(instr->Bits(15, 0) & ~3);
315 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", value);
332 void Decoder::Format(Instruction* instr,
const char* format) {
333 char cur = *format++;
334 while ((cur != 0) && (out_buffer_pos_ < (out_buffer_.length() - 1))) {
336 format += FormatOption(instr, format);
338 out_buffer_[out_buffer_pos_++] = cur;
342 out_buffer_[out_buffer_pos_] =
'\0';
348 #define VERIFY(condition) \ 349 if (!(condition)) { \ 357 void Decoder::Unknown(Instruction* instr) { Format(instr,
"unknown"); }
363 void Decoder::UnknownFormat(Instruction* instr,
const char* name) {
365 snprintf(buffer,
sizeof(buffer),
"%s (unknown-format)", name);
366 Format(instr, buffer);
370 void Decoder::DecodeExt1(Instruction* instr) {
371 switch (EXT1 | (instr->BitField(10, 1))) {
373 UnknownFormat(instr,
"mcrf");
377 int bo = instr->BitField(25, 21);
378 int bi = instr->Bits(20, 16);
379 CRBit cond =
static_cast<CRBit
>(bi & (CRWIDTH - 1));
382 UnknownFormat(instr,
"bclrx-dcbnzf");
386 UnknownFormat(instr,
"bclrx-dcbezf");
392 Format(instr,
"bnelr'l'cr");
395 Format(instr,
"blelr'l'cr");
398 Format(instr,
"bgelr'l'cr");
401 Format(instr,
"bnsolr'l'cr");
407 UnknownFormat(instr,
"bclrx-dcbbzt");
411 UnknownFormat(instr,
"bclrx-dcbnezt");
417 Format(instr,
"beqlr'l'cr");
420 Format(instr,
"bgtlr'l'cr");
423 Format(instr,
"bltlr'l'cr");
426 Format(instr,
"bsolr'l'cr");
432 UnknownFormat(instr,
"bclrx-dcbnz");
436 UnknownFormat(instr,
"bclrx-dcbez");
440 Format(instr,
"blr'l");
447 switch (instr->BitField(25, 21)) {
449 UnknownFormat(instr,
"bcctrx-dcbnzf");
453 UnknownFormat(instr,
"bcctrx-dcbezf");
457 UnknownFormat(instr,
"bcctrx-bf");
461 UnknownFormat(instr,
"bcctrx-dcbnzt");
465 UnknownFormat(instr,
"bcctrx-dcbezf");
469 UnknownFormat(instr,
"bcctrx-bt");
473 UnknownFormat(instr,
"bcctrx-dcbnz");
477 UnknownFormat(instr,
"bcctrx-dcbez");
481 if (instr->Bit(0) == 1) {
482 Format(instr,
"bctrl");
484 Format(instr,
"bctr");
488 default: { UNREACHABLE(); }
493 Format(instr,
"crnor (stuff)");
497 Format(instr,
"rfi (stuff)");
501 Format(instr,
"crandc (stuff)");
505 Format(instr,
"isync (stuff)");
509 Format(instr,
"crxor (stuff)");
513 UnknownFormat(instr,
"crnand");
517 UnknownFormat(instr,
"crand");
521 UnknownFormat(instr,
"creqv");
525 UnknownFormat(instr,
"crorc");
529 UnknownFormat(instr,
"cror");
539 void Decoder::DecodeExt2(Instruction* instr) {
541 switch (EXT2 | (instr->BitField(10, 1))) {
543 Format(instr,
"srw'. 'ra, 'rs, 'rb");
546 #if V8_TARGET_ARCH_PPC64 548 Format(instr,
"srd'. 'ra, 'rs, 'rb");
553 Format(instr,
"sraw'. 'ra, 'rs, 'rb");
556 #if V8_TARGET_ARCH_PPC64 558 Format(instr,
"srad'. 'ra, 'rs, 'rb");
563 Format(instr,
"sync");
567 Format(instr,
"modsw 'rt, 'ra, 'rb");
571 Format(instr,
"moduw 'rt, 'ra, 'rb");
574 #if V8_TARGET_ARCH_PPC64 576 Format(instr,
"modsd 'rt, 'ra, 'rb");
580 Format(instr,
"modud 'rt, 'ra, 'rb");
585 Format(instr,
"srawi'. 'ra,'rs,'sh");
589 Format(instr,
"extsh'. 'ra, 'rs");
592 #if V8_TARGET_ARCH_PPC64 594 Format(instr,
"extsw'. 'ra, 'rs");
599 Format(instr,
"extsb'. 'ra, 'rs");
603 Format(instr,
"lfsx 'Dt, 'ra, 'rb");
607 Format(instr,
"lfsux 'Dt, 'ra, 'rb");
611 Format(instr,
"lfdx 'Dt, 'ra, 'rb");
615 Format(instr,
"lfdux 'Dt, 'ra, 'rb");
619 Format(instr,
"stfsx 'rs, 'ra, 'rb");
623 Format(instr,
"stfsux 'rs, 'ra, 'rb");
627 Format(instr,
"stfdx 'rs, 'ra, 'rb");
631 Format(instr,
"stfdux 'rs, 'ra, 'rb");
635 Format(instr,
"popcntw 'ra, 'rs");
638 #if V8_TARGET_ARCH_PPC64 640 Format(instr,
"popcntd 'ra, 'rs");
646 switch (EXT2 | (instr->BitField(10, 2))) {
648 Format(instr,
"sradi'. 'ra,'rs,'sh");
653 switch (EXT2 | (instr->BitField(10, 0))) {
655 Format(instr,
"stbcx 'rs, 'ra, 'rb");
659 Format(instr,
"sthcx 'rs, 'ra, 'rb");
663 Format(instr,
"stwcx 'rs, 'ra, 'rb");
667 Format(instr,
"stdcx 'rs, 'ra, 'rb");
673 switch (EXT2 | (instr->BitField(9, 1))) {
675 #if V8_TARGET_ARCH_PPC64 676 if (instr->Bit(21)) {
678 Format(instr,
"cmp 'ra, 'rb");
679 #if V8_TARGET_ARCH_PPC64 681 Format(instr,
"cmpw 'ra, 'rb");
687 Format(instr,
"slw'. 'ra, 'rs, 'rb");
690 #if V8_TARGET_ARCH_PPC64 692 Format(instr,
"sld'. 'ra, 'rs, 'rb");
697 Format(instr,
"subfc'. 'rt, 'ra, 'rb");
701 Format(instr,
"subfe'. 'rt, 'ra, 'rb");
705 Format(instr,
"addc'. 'rt, 'ra, 'rb");
709 Format(instr,
"adde'. 'rt, 'ra, 'rb");
713 Format(instr,
"cntlzw'. 'ra, 'rs");
716 #if V8_TARGET_ARCH_PPC64 718 Format(instr,
"cntlzd'. 'ra, 'rs");
723 Format(instr,
"and'. 'ra, 'rs, 'rb");
727 Format(instr,
"andc'. 'ra, 'rs, 'rb");
731 #if V8_TARGET_ARCH_PPC64 732 if (instr->Bit(21)) {
734 Format(instr,
"cmpl 'ra, 'rb");
735 #if V8_TARGET_ARCH_PPC64 737 Format(instr,
"cmplw 'ra, 'rb");
743 Format(instr,
"neg'. 'rt, 'ra");
747 Format(instr,
"nor'. 'rt, 'ra, 'rb");
751 Format(instr,
"subf'. 'rt, 'ra, 'rb");
755 Format(instr,
"mulhw'o'. 'rt, 'ra, 'rb");
759 Format(instr,
"addze'. 'rt, 'ra");
763 Format(instr,
"mullw'o'. 'rt, 'ra, 'rb");
766 #if V8_TARGET_ARCH_PPC64 768 Format(instr,
"mulld'o'. 'rt, 'ra, 'rb");
773 Format(instr,
"divw'o'. 'rt, 'ra, 'rb");
777 Format(instr,
"divwu'o'. 'rt, 'ra, 'rb");
780 #if V8_TARGET_ARCH_PPC64 782 Format(instr,
"divd'o'. 'rt, 'ra, 'rb");
787 Format(instr,
"add'o 'rt, 'ra, 'rb");
791 Format(instr,
"xor'. 'ra, 'rs, 'rb");
795 if (instr->RTValue() == instr->RBValue()) {
796 Format(instr,
"mr 'ra, 'rb");
798 Format(instr,
"or 'ra, 'rs, 'rb");
803 int spr = instr->Bits(20, 11);
805 Format(instr,
"mflr 'rt");
807 Format(instr,
"mfspr 'rt ??");
812 int spr = instr->Bits(20, 11);
814 Format(instr,
"mtlr 'rt");
815 }
else if (288 == spr) {
816 Format(instr,
"mtctr 'rt");
818 Format(instr,
"mtspr 'rt ??");
823 Format(instr,
"mfcr 'rt");
827 Format(instr,
"stwx 'rs, 'ra, 'rb");
831 Format(instr,
"stwux 'rs, 'ra, 'rb");
835 Format(instr,
"stbx 'rs, 'ra, 'rb");
839 Format(instr,
"stbux 'rs, 'ra, 'rb");
843 Format(instr,
"sthx 'rs, 'ra, 'rb");
847 Format(instr,
"sthux 'rs, 'ra, 'rb");
851 Format(instr,
"lwzx 'rt, 'ra, 'rb");
855 Format(instr,
"lwzux 'rt, 'ra, 'rb");
859 Format(instr,
"lwax 'rt, 'ra, 'rb");
863 Format(instr,
"lbzx 'rt, 'ra, 'rb");
867 Format(instr,
"lbzux 'rt, 'ra, 'rb");
871 Format(instr,
"lhzx 'rt, 'ra, 'rb");
875 Format(instr,
"lhzux 'rt, 'ra, 'rb");
879 Format(instr,
"lhax 'rt, 'ra, 'rb");
883 Format(instr,
"lbarx 'rt, 'ra, 'rb");
887 Format(instr,
"lharx 'rt, 'ra, 'rb");
891 Format(instr,
"lwarx 'rt, 'ra, 'rb");
894 #if V8_TARGET_ARCH_PPC64 896 Format(instr,
"ldx 'rt, 'ra, 'rb");
900 Format(instr,
"ldux 'rt, 'ra, 'rb");
904 Format(instr,
"ldarx 'rt, 'ra, 'rb");
908 Format(instr,
"stdx 'rt, 'ra, 'rb");
912 Format(instr,
"stdux 'rt, 'ra, 'rb");
916 Format(instr,
"mffprd 'ra, 'Dt");
920 Format(instr,
"mffprwz 'ra, 'Dt");
924 Format(instr,
"mtfprd 'Dt, 'ra");
928 Format(instr,
"mtfprwa 'Dt, 'ra");
932 Format(instr,
"mtfprwz 'Dt, 'ra");
938 switch (EXT2 | (instr->BitField(5, 1))) {
940 Format(instr,
"isel 'rt, 'ra, 'rb");
950 void Decoder::DecodeExt3(Instruction* instr) {
951 switch (EXT3 | (instr->BitField(10, 1))) {
953 Format(instr,
"fcfids'. 'Dt, 'Db");
957 Format(instr,
"fcfidus'.'Dt, 'Db");
967 void Decoder::DecodeExt4(Instruction* instr) {
968 switch (EXT4 | (instr->BitField(5, 1))) {
970 Format(instr,
"fdiv'. 'Dt, 'Da, 'Db");
974 Format(instr,
"fsub'. 'Dt, 'Da, 'Db");
978 Format(instr,
"fadd'. 'Dt, 'Da, 'Db");
982 Format(instr,
"fsqrt'. 'Dt, 'Db");
986 Format(instr,
"fsel'. 'Dt, 'Da, 'Dc, 'Db");
990 Format(instr,
"fmul'. 'Dt, 'Da, 'Dc");
994 Format(instr,
"fmsub'. 'Dt, 'Da, 'Dc, 'Db");
998 Format(instr,
"fmadd'. 'Dt, 'Da, 'Dc, 'Db");
1003 switch (EXT4 | (instr->BitField(10, 1))) {
1005 Format(instr,
"fcmpu 'Da, 'Db");
1009 Format(instr,
"frsp'. 'Dt, 'Db");
1013 Format(instr,
"fcfid'. 'Dt, 'Db");
1017 Format(instr,
"fcfidu'. 'Dt, 'Db");
1021 Format(instr,
"fctid 'Dt, 'Db");
1025 Format(instr,
"fctidz 'Dt, 'Db");
1029 Format(instr,
"fctidu 'Dt, 'Db");
1033 Format(instr,
"fctiduz 'Dt, 'Db");
1037 Format(instr,
"fctiw'. 'Dt, 'Db");
1041 Format(instr,
"fctiwz'. 'Dt, 'Db");
1045 Format(instr,
"fmr'. 'Dt, 'Db");
1049 Format(instr,
"mtfsfi'. ?,?");
1053 Format(instr,
"mffs'. 'Dt");
1057 Format(instr,
"mtfsf'. 'Db ?,?,?");
1061 Format(instr,
"fabs'. 'Dt, 'Db");
1065 Format(instr,
"frin. 'Dt, 'Db");
1069 Format(instr,
"friz. 'Dt, 'Db");
1073 Format(instr,
"frip. 'Dt, 'Db");
1077 Format(instr,
"frim. 'Dt, 'Db");
1081 Format(instr,
"fneg'. 'Dt, 'Db");
1085 Format(instr,
"mcrfs ?,?");
1089 Format(instr,
"mtfsb0'. ?");
1093 Format(instr,
"mtfsb1'. ?");
1103 void Decoder::DecodeExt5(Instruction* instr) {
1104 switch (EXT5 | (instr->BitField(4, 2))) {
1106 Format(instr,
"rldicl'. 'ra, 'rs, 'sh, 'mb");
1110 Format(instr,
"rldicr'. 'ra, 'rs, 'sh, 'me");
1114 Format(instr,
"rldic'. 'ra, 'rs, 'sh, 'mb");
1118 Format(instr,
"rldimi'. 'ra, 'rs, 'sh, 'mb");
1122 switch (EXT5 | (instr->BitField(4, 1))) {
1124 Format(instr,
"rldcl'. 'ra, 'rs, 'sb, 'mb");
1131 void Decoder::DecodeExt6(Instruction* instr) {
1132 switch (EXT6 | (instr->BitField(10, 3))) {
1133 #define DECODE_XX3_INSTRUCTIONS(name, opcode_name, opcode_value) \ 1134 case opcode_name: { \ 1135 Format(instr, #name" 'Dt, 'Da, 'Db"); \ 1138 PPC_XX3_OPCODE_LIST(DECODE_XX3_INSTRUCTIONS)
1139 #undef DECODE_XX3_INSTRUCTIONS 1141 switch (EXT6 | (instr->BitField(10, 2))) {
1142 #define DECODE_XX2_INSTRUCTIONS(name, opcode_name, opcode_value) \ 1143 case opcode_name: { \ 1144 Format(instr, #name" 'Dt, 'Db"); \ 1147 PPC_XX2_OPCODE_LIST(DECODE_XX2_INSTRUCTIONS)
1149 #undef DECODE_XX3_INSTRUCTIONS 1156 int Decoder::InstructionDecode(byte* instr_ptr) {
1157 Instruction* instr = Instruction::At(instr_ptr);
1159 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%08x ",
1160 instr->InstructionBits());
1162 if (ABI_USES_FUNCTION_DESCRIPTORS && instr->InstructionBits() == 0) {
1165 Format(instr,
"constant");
1169 uint32_t opcode = instr->OpcodeValue() << 26;
1172 PrintSoftwareInterrupt(instr->SvcValue());
1176 UnknownFormat(instr,
"mulli");
1180 Format(instr,
"subfic 'rt, 'ra, 'int16");
1184 #if V8_TARGET_ARCH_PPC64 1185 if (instr->Bit(21)) {
1187 Format(instr,
"cmpli 'ra, 'uint16");
1188 #if V8_TARGET_ARCH_PPC64 1190 Format(instr,
"cmplwi 'ra, 'uint16");
1196 #if V8_TARGET_ARCH_PPC64 1197 if (instr->Bit(21)) {
1199 Format(instr,
"cmpi 'ra, 'int16");
1200 #if V8_TARGET_ARCH_PPC64 1202 Format(instr,
"cmpwi 'ra, 'int16");
1208 Format(instr,
"addic 'rt, 'ra, 'int16");
1212 UnknownFormat(instr,
"addicx");
1216 if (instr->RAValue() == 0) {
1218 Format(instr,
"li 'rt, 'int16");
1220 Format(instr,
"addi 'rt, 'ra, 'int16");
1225 if (instr->RAValue() == 0) {
1226 Format(instr,
"lis 'rt, 'int16");
1228 Format(instr,
"addis 'rt, 'ra, 'int16");
1233 int bo = instr->Bits(25, 21) << 21;
1234 int bi = instr->Bits(20, 16);
1235 CRBit cond =
static_cast<CRBit
>(bi & (CRWIDTH - 1));
1240 Format(instr,
"beq'l'a'cr 'target16");
1243 Format(instr,
"bgt'l'a'cr 'target16");
1246 Format(instr,
"blt'l'a'cr 'target16");
1249 Format(instr,
"bso'l'a'cr 'target16");
1257 Format(instr,
"bne'l'a'cr 'target16");
1260 Format(instr,
"ble'l'a'cr 'target16");
1263 Format(instr,
"bge'l'a'cr 'target16");
1266 Format(instr,
"bnso'l'a'cr 'target16");
1272 Format(instr,
"bdnz'l'a 'target16");
1276 Format(instr,
"bc'l'a'cr 'target16");
1282 UnknownFormat(instr,
"sc");
1286 Format(instr,
"b'l'a 'target26");
1294 Format(instr,
"rlwimi'. 'ra, 'rs, 'sh, 'me, 'mb");
1298 Format(instr,
"rlwinm'. 'ra, 'rs, 'sh, 'me, 'mb");
1302 Format(instr,
"rlwnm'. 'ra, 'rs, 'rb, 'me, 'mb");
1306 Format(instr,
"ori 'ra, 'rs, 'uint16");
1310 Format(instr,
"oris 'ra, 'rs, 'uint16");
1314 Format(instr,
"xori 'ra, 'rs, 'uint16");
1318 Format(instr,
"xoris 'ra, 'rs, 'uint16");
1322 Format(instr,
"andi. 'ra, 'rs, 'uint16");
1326 Format(instr,
"andis. 'ra, 'rs, 'uint16");
1334 Format(instr,
"lwz 'rt, 'int16('ra)");
1338 Format(instr,
"lwzu 'rt, 'int16('ra)");
1342 Format(instr,
"lbz 'rt, 'int16('ra)");
1346 Format(instr,
"lbzu 'rt, 'int16('ra)");
1350 Format(instr,
"stw 'rs, 'int16('ra)");
1354 Format(instr,
"stwu 'rs, 'int16('ra)");
1358 Format(instr,
"stb 'rs, 'int16('ra)");
1362 Format(instr,
"stbu 'rs, 'int16('ra)");
1366 Format(instr,
"lhz 'rt, 'int16('ra)");
1370 Format(instr,
"lhzu 'rt, 'int16('ra)");
1374 Format(instr,
"lha 'rt, 'int16('ra)");
1378 Format(instr,
"lhau 'rt, 'int16('ra)");
1382 Format(instr,
"sth 'rs, 'int16('ra)");
1386 Format(instr,
"sthu 'rs, 'int16('ra)");
1390 UnknownFormat(instr,
"lmw");
1394 UnknownFormat(instr,
"stmw");
1398 Format(instr,
"lfs 'Dt, 'int16('ra)");
1402 Format(instr,
"lfsu 'Dt, 'int16('ra)");
1406 Format(instr,
"lfd 'Dt, 'int16('ra)");
1410 Format(instr,
"lfdu 'Dt, 'int16('ra)");
1414 Format(instr,
"stfs 'Dt, 'int16('ra)");
1418 Format(instr,
"stfsu 'Dt, 'int16('ra)");
1422 Format(instr,
"stfd 'Dt, 'int16('ra)");
1426 Format(instr,
"stfdu 'Dt, 'int16('ra)");
1445 #if V8_TARGET_ARCH_PPC64 1447 switch (instr->Bits(1, 0)) {
1449 Format(instr,
"ld 'rt, 'd('ra)");
1452 Format(instr,
"ldu 'rt, 'd('ra)");
1455 Format(instr,
"lwa 'rt, 'd('ra)");
1461 if (instr->Bit(0) == 0) {
1462 Format(instr,
"std 'rs, 'd('ra)");
1464 Format(instr,
"stdu 'rs, 'd('ra)");
1486 const char* NameConverter::NameOfAddress(byte* addr)
const {
1487 v8::internal::SNPrintF(tmp_buffer_,
"%p", static_cast<void*>(addr));
1488 return tmp_buffer_.start();
1492 const char* NameConverter::NameOfConstant(byte* addr)
const {
1493 return NameOfAddress(addr);
1497 const char* NameConverter::NameOfCPURegister(
int reg)
const {
1498 return RegisterName(i::Register::from_code(reg));
1501 const char* NameConverter::NameOfByteCPURegister(
int reg)
const {
1506 const char* NameConverter::NameOfXMMRegister(
int reg)
const {
1510 const char* NameConverter::NameInCode(byte* addr)
const {
1520 byte* instruction) {
1522 return d.InstructionDecode(instruction);
1527 int Disassembler::ConstantPoolSizeAt(byte* instruction) {
return -1; }
1529 void Disassembler::Disassemble(FILE* f, byte* begin, byte* end,
1530 UnimplementedOpcodeAction unimplemented_action) {
1531 NameConverter converter;
1532 Disassembler d(converter, unimplemented_action);
1533 for (byte* pc = begin; pc < end;) {
1537 pc += d.InstructionDecode(buffer, pc);
1538 v8::internal::PrintF(f,
"%p %08x %s\n", static_cast<void*>(prev_pc),
1539 *reinterpret_cast<int32_t*>(prev_pc), buffer.start());
1546 #endif // V8_TARGET_ARCH_PPC