10#if V8_TARGET_ARCH_LOONG64
47 void Print(
const char* str);
53 void PrintRj(Instruction*
instr);
54 void PrintRk(Instruction*
instr);
56 void PrintFj(Instruction*
instr);
57 void PrintFk(Instruction*
instr);
58 void PrintFd(Instruction*
instr);
59 void PrintFa(Instruction*
instr);
60 void PrintSa2(Instruction*
instr);
61 void PrintSa3(Instruction*
instr);
62 void PrintUi5(Instruction*
instr);
63 void PrintUi6(Instruction*
instr);
64 void PrintUi12(Instruction*
instr);
65 void PrintMsbw(Instruction*
instr);
66 void PrintLsbw(Instruction*
instr);
67 void PrintMsbd(Instruction*
instr);
68 void PrintLsbd(Instruction*
instr);
70 void PrintSi12(Instruction*
instr);
71 void PrintSi14(Instruction*
instr);
72 void PrintSi16(Instruction*
instr);
73 void PrintSi20(Instruction*
instr);
74 void PrintXi12(Instruction*
instr);
75 void PrintXi20(Instruction*
instr);
76 void PrintCj(Instruction*
instr);
77 void PrintCd(Instruction*
instr);
78 void PrintCa(Instruction*
instr);
80 void PrintHint5(Instruction*
instr);
81 void PrintHint15(Instruction*
instr);
82 void PrintPCOffs16(Instruction*
instr);
83 void PrintPCOffs21(Instruction*
instr);
84 void PrintPCOffs26(Instruction*
instr);
85 void PrintOffs16(Instruction*
instr);
86 void PrintOffs21(Instruction*
instr);
87 void PrintOffs26(Instruction*
instr);
91 int FormatFPURegister(Instruction*
instr,
const char* option);
93 void Format(Instruction*
instr,
const char* format);
95 int DecodeBreakInstr(Instruction*
instr);
99 void DecodeTypekOp6(Instruction*
instr);
100 void DecodeTypekOp7(Instruction*
instr);
101 void DecodeTypekOp8(Instruction*
instr);
102 void DecodeTypekOp10(Instruction*
instr);
103 void DecodeTypekOp12(Instruction*
instr);
104 void DecodeTypekOp14(Instruction*
instr);
105 int DecodeTypekOp17(Instruction*
instr);
106 void DecodeTypekOp22(Instruction*
instr);
114#define STRING_STARTS_WITH(string, compare_string) \
115 (strncmp(string, compare_string, strlen(compare_string)) == 0)
135void Decoder::PrintRj(Instruction*
instr) {
140void Decoder::PrintRk(Instruction*
instr) {
155void Decoder::PrintFj(Instruction*
instr) {
156 int freg =
instr->FjValue();
160void Decoder::PrintFk(Instruction*
instr) {
161 int freg =
instr->FkValue();
165void Decoder::PrintFd(Instruction*
instr) {
166 int freg =
instr->FdValue();
170void Decoder::PrintFa(Instruction*
instr) {
171 int freg =
instr->FaValue();
176void Decoder::PrintSa2(Instruction*
instr) {
177 int sa =
instr->Sa2Value();
178 uint32_t opcode = (
instr->InstructionBits() >> 18) << 18;
185void Decoder::PrintSa3(Instruction*
instr) {
186 int sa =
instr->Sa3Value();
190void Decoder::PrintUi5(Instruction*
instr) {
191 int ui =
instr->Ui5Value();
195void Decoder::PrintUi6(Instruction*
instr) {
196 int ui =
instr->Ui6Value();
200void Decoder::PrintUi12(Instruction*
instr) {
201 int ui =
instr->Ui12Value();
205void Decoder::PrintXi12(Instruction*
instr) {
206 int xi =
instr->Ui12Value();
210void Decoder::PrintXi20(Instruction*
instr) {
211 int xi =
instr->Si20Value();
215void Decoder::PrintMsbd(Instruction*
instr) {
216 int msbd =
instr->MsbdValue();
220void Decoder::PrintLsbd(Instruction*
instr) {
221 int lsbd =
instr->LsbdValue();
225void Decoder::PrintMsbw(Instruction*
instr) {
226 int msbw =
instr->MsbwValue();
230void Decoder::PrintLsbw(Instruction*
instr) {
231 int lsbw =
instr->LsbwValue();
235void Decoder::PrintSi12(Instruction*
instr) {
238 si,
instr->Si12Value());
241void Decoder::PrintSi14(Instruction*
instr) {
245 si,
instr->Si14Value() << 2);
248void Decoder::PrintSi16(Instruction*
instr) {
251 si,
instr->Si16Value());
254void Decoder::PrintSi20(Instruction*
instr) {
257 si,
instr->Si20Value());
260void Decoder::PrintCj(Instruction*
instr) {
261 int cj =
instr->CjValue();
265void Decoder::PrintCd(Instruction*
instr) {
266 int cd =
instr->CdValue();
270void Decoder::PrintCa(Instruction*
instr) {
271 int ca =
instr->CaValue();
275void Decoder::PrintCode(Instruction*
instr) {
276 int code =
instr->CodeValue();
281void Decoder::PrintHint5(Instruction*
instr) {
282 int hint =
instr->Hint5Value();
287void Decoder::PrintHint15(Instruction*
instr) {
288 int hint =
instr->Hint15Value();
293void Decoder::PrintPCOffs16(Instruction*
instr) {
295 int offs =
instr->Offs16Value();
296 int target = ((offs << n_bits) << (32 -
kOffsLowBits - n_bits)) >>
303void Decoder::PrintPCOffs21(Instruction*
instr) {
305 int offs =
instr->Offs21Value();
314void Decoder::PrintPCOffs26(Instruction*
instr) {
316 int offs =
instr->Offs26Value();
325void Decoder::PrintOffs16(Instruction*
instr) {
326 int offs =
instr->Offs16Value();
331void Decoder::PrintOffs21(Instruction*
instr) {
332 int offs =
instr->Offs21Value();
337void Decoder::PrintOffs26(Instruction*
instr) {
338 int offs =
instr->Offs26Value();
347 if (format[1] ==
'j') {
351 }
else if (format[1] ==
'k') {
355 }
else if (format[1] ==
'd') {
365int Decoder::FormatFPURegister(Instruction*
instr,
const char* format) {
367 if (format[1] ==
'j') {
371 }
else if (format[1] ==
'k') {
375 }
else if (format[1] ==
'd') {
379 }
else if (format[1] ==
'a') {
415 return FormatFPURegister(
instr, format);
418 if (format[4] ==
'5') {
422 }
else if (format[4] ==
'1') {
444 if (format[3] ==
'w') {
447 }
else if (format[3] ==
'd') {
454 if (format[1] ==
'f') {
455 if (format[4] ==
'1') {
459 }
else if (format[4] ==
'2') {
460 if (format[5] ==
'1') {
464 }
else if (format[5] ==
'6') {
474 if (format[6] ==
'1') {
476 PrintPCOffs16(
instr);
478 }
else if (format[6] ==
'2') {
479 if (format[7] ==
'1') {
481 PrintPCOffs21(
instr);
483 }
else if (format[7] ==
'6') {
485 PrintPCOffs26(
instr);
497 if (format[2] ==
'2') {
500 }
else if (format[2] ==
'3') {
506 if (format[2] ==
'2') {
510 }
else if (format[2] ==
'1') {
535 if (format[2] ==
'5') {
539 }
else if (format[2] ==
'6') {
543 }
else if (format[2] ==
'1') {
551 if (format[2] ==
'2') {
555 }
else if (format[3] ==
'2') {
572 char cur = *format++;
588int Decoder::DecodeBreakInstr(Instruction*
instr) {
608void Decoder::DecodeTypekOp6(Instruction*
instr) {
609 switch (
instr->Bits(31, 26) << 26) {
621 Format(
instr,
"bcnez fcc'cj, 'offs21 -> 'pcoffs21");
623 Format(
instr,
"bceqz fcc'cj, 'offs21 -> 'pcoffs21");
635 Format(
instr,
"beq 'rj, 'rd, 'offs16 -> 'pcoffs16");
638 Format(
instr,
"bne 'rj, 'rd, 'offs16 -> 'pcoffs16");
641 Format(
instr,
"blt 'rj, 'rd, 'offs16 -> 'pcoffs16");
644 Format(
instr,
"bge 'rj, 'rd, 'offs16 -> 'pcoffs16");
647 Format(
instr,
"bltu 'rj, 'rd, 'offs16 -> 'pcoffs16");
650 Format(
instr,
"bgeu 'rj, 'rd, 'offs16 -> 'pcoffs16");
657void Decoder::DecodeTypekOp7(Instruction*
instr) {
658 switch (
instr->Bits(31, 25) << 25) {
682void Decoder::DecodeTypekOp8(Instruction*
instr) {
683 switch (
instr->Bits(31, 24) << 24) {
713void Decoder::DecodeTypekOp10(Instruction*
instr) {
714 switch (
instr->Bits(31, 22) << 22) {
716 if (
instr->Bit(21) != 0) {
717 if (
instr->Bit(15) == 0) {
720 Format(
instr,
"bstrpick.w 'rd, 'rj, 'msbw, 'lsbw");
729 Format(
instr,
"bstrpick.d 'rd, 'rj, 'msbd, 'lsbd");
805void Decoder::DecodeTypekOp12(Instruction*
instr) {
806 switch (
instr->Bits(31, 20) << 20) {
832 switch (
instr->Bits(19, 15)) {
901 switch (
instr->Bits(19, 15)) {
977void Decoder::DecodeTypekOp14(Instruction*
instr) {
978 switch (
instr->Bits(31, 18) << 18) {
1023int Decoder::DecodeTypekOp17(Instruction*
instr) {
1024 switch (
instr->Bits(31, 15) << 15) {
1140 return DecodeBreakInstr(
instr);
1366void Decoder::DecodeTypekOp22(Instruction*
instr) {
1367 switch (
instr->Bits(31, 10) << 10) {
1604 "%08x ",
instr->InstructionBits());
1605 switch (
instr->InstructionType()) {
1607 DecodeTypekOp6(
instr);
1611 DecodeTypekOp7(
instr);
1615 DecodeTypekOp8(
instr);
1619 DecodeTypekOp10(
instr);
1623 DecodeTypekOp12(
instr);
1627 DecodeTypekOp14(
instr);
1631 return DecodeTypekOp17(
instr);
1634 DecodeTypekOp22(
instr);
1686 uint8_t* instruction) {
1688 return d.InstructionDecode(instruction);
1694 UnimplementedOpcodeAction unimplemented_action) {
1695 NameConverter converter;
1697 for (uint8_t*
pc = begin;
pc <
end;) {
1700 uint8_t* prev_pc =
pc;
1701 pc += d.InstructionDecode(buffer,
pc);
1707#undef STRING_STARTS_WITH
static V8_EXPORT_PRIVATE void Disassemble(FILE *f, uint8_t *begin, uint8_t *end, UnimplementedOpcodeAction unimplemented_action=kAbortOnUnimplementedOpcode)
V8_EXPORT_PRIVATE int InstructionDecode(v8::base::Vector< char > buffer, uint8_t *instruction)
int ConstantPoolSizeAt(uint8_t *instruction)
Disassembler(const NameConverter &converter, UnimplementedOpcodeAction unimplemented_opcode_action=kAbortOnUnimplementedOpcode)
const NameConverter & converter_
virtual const char * NameOfAddress(uint8_t *addr) const
virtual const char * NameOfXMMRegister(int reg) const
virtual const char * NameInCode(uint8_t *addr) const
virtual const char * NameOfConstant(uint8_t *addr) const
v8::base::EmbeddedVector< char, 128 > tmp_buffer_
virtual const char * NameOfByteCPURegister(int reg) const
virtual const char * NameOfCPURegister(int reg) const
constexpr T * begin() const
void Format(Instruction *instr, const char *format)
void PrintFPUStatusRegister(int freg)
void PrintFPURegister(int freg)
int InstructionDecode(uint8_t *instruction)
void Unknown(Instruction *instr)
const disasm::NameConverter & converter_
void PrintRegister(int reg)
void PrintRd(Instruction *instr)
void PrintChar(const char ch)
v8::base::Vector< char > out_buffer_
int FormatOption(Instruction *instr, const char *option)
int FormatRegister(Instruction *instr, const char *option)
void Print(const char *str)
Decoder & operator=(const Decoder &)=delete
static const char * Name(int reg)
static Instruction * At(Address pc)
static const char * Name(int reg)
#define STRING_STARTS_WITH(string, compare_string)
int SNPrintF(Vector< char > str, const char *format,...)
void PrintCode(Isolate *isolate, DirectHandle< Code > code, OptimizedCompilationInfo *info)
constexpr UnconditionalBranchOp BL
void PrintF(const char *format,...)
const int kOffs26HighBits
constexpr uint8_t kInstrSize
const int kOffs21HighBits
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)