6#if defined(TARGET_ARCH_RISCV32) || defined(TARGET_ARCH_RISCV64)
15#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)
21class RISCVDisassembler {
23 explicit RISCVDisassembler(
char*
buffer,
31 bool Supports(
Extension extension)
const {
32 return extensions_.Includes(extension);
38 intptr_t Disassemble(
uword pc) {
39 uint16_t parcel = *
reinterpret_cast<uint16_t*
>(pc);
42 DisassembleInstruction(instr);
43 return instr.length();
45 uint32_t parcel =
LoadUnaligned(
reinterpret_cast<uint32_t*
>(pc));
47 DisassembleInstruction(instr);
48 return instr.length();
53 void DisassembleInstruction(Instr instr);
54 void DisassembleInstruction(CInstr instr);
55 void DisassembleLUI(Instr instr);
56 void DisassembleAUIPC(Instr instr);
57 void DisassembleJAL(Instr instr);
58 void DisassembleJALR(Instr instr);
59 void DisassembleBRANCH(Instr instr);
60 void DisassembleLOAD(Instr instr);
61 void DisassembleSTORE(Instr instr);
62 void DisassembleOPIMM(Instr instr);
63 void DisassembleOPIMM32(Instr instr);
64 void DisassembleOP(Instr instr);
65 void DisassembleOP_0(Instr instr);
66 void DisassembleOP_SUB(Instr instr);
67 void DisassembleOP_MULDIV(Instr instr);
68 void DisassembleOP_SHADD(Instr instr);
69 void DisassembleOP_MINMAXCLMUL(Instr instr);
70 void DisassembleOP_ROTATE(Instr instr);
71 void DisassembleOP_BCLRBEXT(Instr instr);
72 void DisassembleOP32(Instr instr);
73 void DisassembleOP32_0(Instr instr);
74 void DisassembleOP32_SUB(Instr instr);
75 void DisassembleOP32_MULDIV(Instr instr);
76 void DisassembleOP32_SHADD(Instr instr);
77 void DisassembleOP32_ADDUW(Instr instr);
78 void DisassembleOP32_ROTATE(Instr instr);
79 void DisassembleMISCMEM(Instr instr);
80 void DisassembleSYSTEM(Instr instr);
81 void DisassembleAMO(Instr instr);
82 void DisassembleAMO8(Instr instr);
83 void DisassembleAMO16(Instr instr);
84 void DisassembleAMO32(Instr instr);
85 void DisassembleAMO64(Instr instr);
86 void DisassembleLOADFP(Instr instr);
87 void DisassembleSTOREFP(Instr instr);
88 void DisassembleFMADD(Instr instr);
89 void DisassembleFMSUB(Instr instr);
90 void DisassembleFNMADD(Instr instr);
91 void DisassembleFNMSUB(Instr instr);
92 void DisassembleOPFP(Instr instr);
94 void UnknownInstruction(Instr instr);
95 void UnknownInstruction(CInstr instr);
97 void Print(
const char*
format, Instr instr, ExtensionSet extension);
98 void Print(
const char*
format, CInstr instr, ExtensionSet extension);
99 const char* PrintOption(
const char*
format, Instr instr);
100 const char* PrintOption(
const char*
format, CInstr instr);
109 buffer_[buffer_pos_] =
'\0';
112 const ExtensionSet extensions_;
118void RISCVDisassembler::DisassembleInstruction(Instr instr) {
119 switch (instr.opcode()) {
121 DisassembleLUI(instr);
124 DisassembleAUIPC(instr);
127 DisassembleJAL(instr);
130 DisassembleJALR(instr);
133 DisassembleBRANCH(instr);
136 DisassembleLOAD(instr);
139 DisassembleSTORE(instr);
142 DisassembleOPIMM(instr);
145 DisassembleOPIMM32(instr);
148 DisassembleOP(instr);
151 DisassembleOP32(instr);
154 DisassembleMISCMEM(instr);
157 DisassembleSYSTEM(instr);
160 DisassembleAMO(instr);
163 DisassembleLOADFP(instr);
166 DisassembleSTOREFP(instr);
169 DisassembleFMADD(instr);
172 DisassembleFMSUB(instr);
175 DisassembleFNMADD(instr);
178 DisassembleFNMSUB(instr);
181 DisassembleOPFP(instr);
184 if ((instr.encoding() == 0) ||
185 (instr.encoding() ==
static_cast<uint32_t
>(-1))) {
186 Print(
"trap", instr,
RV_I);
189 UnknownInstruction(instr);
193void RISCVDisassembler::DisassembleInstruction(CInstr instr) {
194 switch (instr.opcode()) {
196 Print(
"lw 'rd, 'spload4imm(sp)", instr,
RV_C);
200 Print(
"flw 'frd, 'spload4imm(sp)", instr,
RV_C |
RV_F);
204 Print(
"ld 'rd, 'spload8imm(sp)", instr,
RV_C);
208 Print(
"fld 'frd, 'spload8imm(sp)", instr,
RV_C |
RV_D);
211 Print(
"sw 'rs2, 'spstore4imm(sp)", instr,
RV_C);
215 Print(
"fsw 'frs2, 'spstore4imm(sp)", instr,
RV_C |
RV_F);
219 Print(
"sd 'rs2, 'spstore8imm(sp)", instr,
RV_C);
223 Print(
"fsd 'frs2, 'spstore8imm(sp)", instr,
RV_C |
RV_D);
226 Print(
"lw 'rdp, 'mem4imm('rs1p)", instr,
RV_C);
230 Print(
"flw 'frdp, 'mem4imm('rs1p)", instr,
RV_C |
RV_F);
234 Print(
"ld 'rdp, 'mem8imm('rs1p)", instr,
RV_C);
238 Print(
"fld 'frdp, 'mem8imm('rs1p)", instr,
RV_C |
RV_D);
241 Print(
"sw 'rs2p, 'mem4imm('rs1p)", instr,
RV_C);
245 Print(
"fsw 'frs2p, 'mem4imm('rs1p)", instr,
RV_C |
RV_F);
249 Print(
"sd 'rs2p, 'mem8imm('rs1p)", instr,
RV_C);
253 Print(
"fsd 'frs2p, 'mem8imm('rs1p)", instr,
RV_C |
RV_F);
256 Print(
"j 'jimm", instr,
RV_C);
260 Print(
"jal 'jimm", instr,
RV_C);
264 if ((instr.encoding() & (
C_JALR ^
C_JR)) != 0) {
265 if ((instr.rs1() ==
ZR) && (instr.rs2() ==
ZR)) {
266 Print(
"ebreak", instr,
RV_C);
267 }
else if (instr.rs2() ==
ZR) {
268 Print(
"jalr 'rs1", instr,
RV_C);
270 Print(
"add 'rd, 'rs1, 'rs2", instr,
RV_C);
273 if (instr.rd() !=
ZR && instr.rs2() !=
ZR) {
274 Print(
"mv 'rd, 'rs2", instr,
RV_C);
275 }
else if (instr.rs2() !=
ZR) {
276 UnknownInstruction(instr);
277 }
else if (instr.rs1() ==
RA) {
278 Print(
"ret", instr,
RV_C);
280 Print(
"jr 'rs1", instr,
RV_C);
285 Print(
"beqz 'rs1p, 'bimm", instr,
RV_C);
288 Print(
"bnez 'rs1p, 'bimm", instr,
RV_C);
291 Print(
"li 'rd, 'iimm", instr,
RV_C);
294 if (instr.rd() ==
SP) {
295 Print(
"addi 'rd, 'rs1, 'i16imm", instr,
RV_C);
297 Print(
"lui 'rd, 'uimm", instr,
RV_C);
301 if ((instr.rd() ==
ZR) && (instr.rs1() ==
ZR) && (instr.i_imm() == 0)) {
302 Print(
"nop", instr,
RV_C);
304 Print(
"addi 'rd, 'rs1, 'iimm", instr,
RV_C);
309 if (instr.i_imm() == 0) {
310 Print(
"sext.w 'rd, 'rs1", instr,
RV_C);
312 Print(
"addiw 'rd, 'rs1, 'iimm", instr,
RV_C);
317 if (instr.i4spn_imm() == 0) {
318 UnknownInstruction(instr);
320 Print(
"addi 'rdp, sp, 'i4spnimm", instr,
RV_C);
324 if (instr.i_imm() == 0) {
325 UnknownInstruction(instr);
327 Print(
"slli 'rd, 'rs1, 'iimm", instr,
RV_C);
333 if (instr.i_imm() == 0) {
334 UnknownInstruction(instr);
336 Print(
"srli 'rs1p, 'rs1p, 'iimm", instr,
RV_C);
340 if (instr.i_imm() == 0) {
341 UnknownInstruction(instr);
343 Print(
"srai 'rs1p, 'rs1p, 'iimm", instr,
RV_C);
347 Print(
"andi 'rs1p, 'rs1p, 'iimm", instr,
RV_C);
352 Print(
"and 'rs1p, 'rs1p, 'rs2p", instr,
RV_C);
355 Print(
"or 'rs1p, 'rs1p, 'rs2p", instr,
RV_C);
358 Print(
"xor 'rs1p, 'rs1p, 'rs2p", instr,
RV_C);
361 Print(
"sub 'rs1p, 'rs1p, 'rs2p", instr,
RV_C);
365 Print(
"addw 'rs1p, 'rs1p, 'rs2p", instr,
RV_C);
368 Print(
"subw 'rs1p, 'rs1p, 'rs2p", instr,
RV_C);
372 UnknownInstruction(instr);
376 UnknownInstruction(instr);
380 if ((instr.encoding() == 0) ||
381 (instr.encoding() ==
static_cast<uint16_t
>(-1))) {
382 Print(
"trap", instr,
RV_C);
385 UnknownInstruction(instr);
389void RISCVDisassembler::DisassembleLUI(Instr instr) {
390 Print(
"lui 'rd, 'uimm", instr,
RV_I);
393void RISCVDisassembler::DisassembleAUIPC(Instr instr) {
394 Print(
"auipc 'rd, 'uimm", instr,
RV_I);
397void RISCVDisassembler::DisassembleJAL(Instr instr) {
398 if (instr.rd() ==
ZR) {
399 Print(
"j 'jimm", instr,
RV_I);
400 }
else if (instr.rd() ==
RA) {
401 Print(
"jal 'jimm", instr,
RV_I);
403 Print(
"jal 'rd, 'jimm", instr,
RV_I);
407void RISCVDisassembler::DisassembleJALR(Instr instr) {
408 if (instr.rd() ==
ZR) {
409 if ((instr.rs1() ==
RA) && (instr.itype_imm() == 0)) {
410 Print(
"ret", instr,
RV_I);
411 }
else if (instr.itype_imm() == 0) {
412 Print(
"jr 'rs1", instr,
RV_I);
414 Print(
"jr 'iimm('rs1)", instr,
RV_I);
416 }
else if (instr.rd() ==
RA) {
417 if (instr.itype_imm() == 0) {
418 Print(
"jalr 'rs1", instr,
RV_I);
420 Print(
"jalr 'iimm('rs1)", instr,
RV_I);
423 if (instr.itype_imm() == 0) {
424 Print(
"jalr 'rd, 'rs1", instr,
RV_I);
426 Print(
"jalr 'rd, 'iimm('rs1)", instr,
RV_I);
431void RISCVDisassembler::DisassembleBRANCH(Instr instr) {
432 switch (instr.funct3()) {
434 if (instr.rs2() ==
ZR) {
435 Print(
"beqz 'rs1, 'bimm", instr,
RV_I);
437 Print(
"beq 'rs1, 'rs2, 'bimm", instr,
RV_I);
441 if (instr.rs2() ==
ZR) {
442 Print(
"bnez 'rs1, 'bimm", instr,
RV_I);
444 Print(
"bne 'rs1, 'rs2, 'bimm", instr,
RV_I);
448 if (instr.rs2() ==
ZR) {
449 Print(
"bltz 'rs1, 'bimm", instr,
RV_I);
450 }
else if (instr.rs1() ==
ZR) {
451 Print(
"bgtz 'rs2, 'bimm", instr,
RV_I);
453 Print(
"blt 'rs1, 'rs2, 'bimm", instr,
RV_I);
457 if (instr.rs2() ==
ZR) {
458 Print(
"bgez 'rs1, 'bimm", instr,
RV_I);
459 }
else if (instr.rs1() ==
ZR) {
460 Print(
"blez 'rs2, 'bimm", instr,
RV_I);
462 Print(
"ble 'rs2, 'rs1, 'bimm", instr,
RV_I);
466 Print(
"bltu 'rs1, 'rs2, 'bimm", instr,
RV_I);
469 Print(
"bleu 'rs2, 'rs1, 'bimm", instr,
RV_I);
472 UnknownInstruction(instr);
476void RISCVDisassembler::DisassembleLOAD(Instr instr) {
477 switch (instr.funct3()) {
479 Print(
"lb 'rd, 'iimm('rs1)", instr,
RV_I);
482 Print(
"lh 'rd, 'iimm('rs1)", instr,
RV_I);
485 Print(
"lw 'rd, 'iimm('rs1)", instr,
RV_I);
488 Print(
"lbu 'rd, 'iimm('rs1)", instr,
RV_I);
491 Print(
"lhu 'rd, 'iimm('rs1)", instr,
RV_I);
495 Print(
"lwu 'rd, 'iimm('rs1)", instr,
RV_I);
498 Print(
"ld 'rd, 'iimm('rs1)", instr,
RV_I);
502 UnknownInstruction(instr);
506void RISCVDisassembler::DisassembleLOADFP(Instr instr) {
507 switch (instr.funct3()) {
509 Print(
"flw 'frd, 'iimm('rs1)", instr,
RV_F);
512 Print(
"fld 'frd, 'iimm('rs1)", instr,
RV_D);
515 UnknownInstruction(instr);
519void RISCVDisassembler::DisassembleSTORE(Instr instr) {
520 switch (instr.funct3()) {
522 Print(
"sb 'rs2, 'simm('rs1)", instr,
RV_I);
525 Print(
"sh 'rs2, 'simm('rs1)", instr,
RV_I);
528 Print(
"sw 'rs2, 'simm('rs1)", instr,
RV_I);
532 Print(
"sd 'rs2, 'simm('rs1)", instr,
RV_I);
536 UnknownInstruction(instr);
540void RISCVDisassembler::DisassembleSTOREFP(Instr instr) {
541 switch (instr.funct3()) {
543 Print(
"fsw 'frs2, 'simm('rs1)", instr,
RV_F);
546 Print(
"fsd 'frs2, 'simm('rs1)", instr,
RV_D);
549 UnknownInstruction(instr);
553void RISCVDisassembler::DisassembleOPIMM(Instr instr) {
554 switch (instr.funct3()) {
556 if ((instr.rd() ==
ZR) && (instr.rs1() ==
ZR) &&
557 (instr.itype_imm() == 0)) {
558 Print(
"nop", instr,
RV_I);
559 }
else if (instr.itype_imm() == 0) {
560 Print(
"mv 'rd, 'rs1", instr,
RV_I);
561 }
else if (instr.rs1() ==
ZR) {
562 Print(
"li 'rd, 'iimm", instr,
RV_I);
564 Print(
"addi 'rd, 'rs1, 'iimm", instr,
RV_I);
568 Print(
"slti 'rd, 'rs1, 'iimm", instr,
RV_I);
571 if (instr.itype_imm() == 1) {
572 Print(
"seqz 'rd, 'rs1", instr,
RV_I);
574 Print(
"sltiu 'rd, 'rs1, 'iimm", instr,
RV_I);
578 if (instr.itype_imm() == -1) {
579 Print(
"not 'rd, 'rs1", instr,
RV_I);
581 Print(
"xori 'rd, 'rs1, 'iimm", instr,
RV_I);
585 Print(
"ori 'rd, 'rs1, 'iimm", instr,
RV_I);
588 Print(
"andi 'rd, 'rs1, 'iimm", instr,
RV_I);
591 if (instr.funct7() ==
COUNT) {
592 if (instr.shamt() == 0b00000) {
593 Print(
"clz 'rd, 'rs1", instr,
RV_Zbb);
594 }
else if (instr.shamt() == 0b00001) {
595 Print(
"ctz 'rd, 'rs1", instr,
RV_Zbb);
596 }
else if (instr.shamt() == 0b00010) {
597 Print(
"cpop 'rd, 'rs1", instr,
RV_Zbb);
598 }
else if (instr.shamt() == 0b00100) {
599 Print(
"sext.b 'rd, 'rs1", instr,
RV_Zbb);
600 }
else if (instr.shamt() == 0b00101) {
601 Print(
"sext.h 'rd, 'rs1", instr,
RV_Zbb);
603 UnknownInstruction(instr);
605 }
else if ((instr.funct7() & 0b1111110) ==
BCLRBEXT) {
606 Print(
"bclri 'rd, 'rs1, 'shamt", instr,
RV_Zbs);
607 }
else if ((instr.funct7() & 0b1111110) ==
BINV) {
608 Print(
"binvi 'rd, 'rs1, 'shamt", instr,
RV_Zbs);
609 }
else if ((instr.funct7() & 0b1111110) ==
BSET) {
610 Print(
"bseti 'rd, 'rs1, 'shamt", instr,
RV_Zbs);
612 Print(
"slli 'rd, 'rs1, 'shamt", instr,
RV_I);
616 if ((instr.funct7() & 0b1111110) ==
SRA) {
617 Print(
"srai 'rd, 'rs1, 'shamt", instr,
RV_I);
618 }
else if ((instr.funct7() & 0b1111110) ==
ROTATE) {
619 Print(
"rori 'rd, 'rs1, 'shamt", instr,
RV_Zbb);
620 }
else if (instr.funct7() == 0b0010100) {
621 Print(
"orc.b 'rd, 'rs1", instr,
RV_Zbb);
623 }
else if (instr.funct7() == 0b0110100) {
624 Print(
"rev8 'rd, 'rs1", instr,
RV_Zbb);
626 }
else if (instr.funct7() == 0b0110101) {
627 Print(
"rev8 'rd, 'rs1", instr,
RV_Zbb);
629 }
else if ((instr.funct7() & 0b1111110) ==
BCLRBEXT) {
630 Print(
"bexti 'rd, 'rs1, 'shamt", instr,
RV_Zbs);
632 Print(
"srli 'rd, 'rs1, 'shamt", instr,
RV_I);
636 UnknownInstruction(instr);
640void RISCVDisassembler::DisassembleOPIMM32(Instr instr) {
641 switch (instr.funct3()) {
644 if (instr.itype_imm() == 0) {
645 Print(
"sext.w 'rd, 'rs1", instr,
RV_I);
647 Print(
"addiw 'rd, 'rs1, 'iimm", instr,
RV_I);
651 if (instr.funct7() ==
SLLIUW) {
652 Print(
"slli.uw 'rd, 'rs1, 'shamt", instr,
RV_Zba);
653 }
else if (instr.funct7() ==
COUNT) {
654 if (instr.shamt() == 0b00000) {
655 Print(
"clzw 'rd, 'rs1", instr,
RV_Zbb);
656 }
else if (instr.shamt() == 0b00001) {
657 Print(
"ctzw 'rd, 'rs1", instr,
RV_Zbb);
658 }
else if (instr.shamt() == 0b00010) {
659 Print(
"cpopw 'rd, 'rs1", instr,
RV_Zbb);
661 UnknownInstruction(instr);
664 Print(
"slliw 'rd, 'rs1, 'shamt", instr,
RV_I);
668 if (instr.funct7() ==
SRA) {
669 Print(
"sraiw 'rd, 'rs1, 'shamt", instr,
RV_I);
670 }
else if (instr.funct7() ==
ROTATE) {
671 Print(
"roriw 'rd, 'rs1, 'shamt", instr,
RV_Zbb);
673 Print(
"srliw 'rd, 'rs1, 'shamt", instr,
RV_I);
678 UnknownInstruction(instr);
682void RISCVDisassembler::DisassembleOP(Instr instr) {
683 switch (instr.funct7()) {
685 DisassembleOP_0(instr);
688 DisassembleOP_SUB(instr);
691 DisassembleOP_MULDIV(instr);
694 DisassembleOP_SHADD(instr);
697 DisassembleOP_MINMAXCLMUL(instr);
700 DisassembleOP_ROTATE(instr);
703 DisassembleOP_BCLRBEXT(instr);
706 Print(
"binv 'rd, 'rs1, 'rs2", instr,
RV_Zbs);
709 Print(
"bset 'rd, 'rs1, 'rs2", instr,
RV_Zbs);
713 Print(
"zext.h 'rd, 'rs1", instr,
RV_Zbb);
717 UnknownInstruction(instr);
721void RISCVDisassembler::DisassembleOP_0(Instr instr) {
722 switch (instr.funct3()) {
724 Print(
"add 'rd, 'rs1, 'rs2", instr,
RV_I);
727 Print(
"sll 'rd, 'rs1, 'rs2", instr,
RV_I);
730 if (instr.rs2() ==
ZR) {
731 Print(
"sltz 'rd, 'rs1", instr,
RV_I);
732 }
else if (instr.rs1() ==
ZR) {
733 Print(
"sgtz 'rd, 'rs2", instr,
RV_I);
735 Print(
"slt 'rd, 'rs1, 'rs2", instr,
RV_I);
739 if (instr.rs1() ==
ZR) {
740 Print(
"snez 'rd, 'rs2", instr,
RV_I);
742 Print(
"sltu 'rd, 'rs1, 'rs2", instr,
RV_I);
746 Print(
"xor 'rd, 'rs1, 'rs2", instr,
RV_I);
749 Print(
"srl 'rd, 'rs1, 'rs2", instr,
RV_I);
752 Print(
"or 'rd, 'rs1, 'rs2", instr,
RV_I);
755 Print(
"and 'rd, 'rs1, 'rs2", instr,
RV_I);
758 UnknownInstruction(instr);
762void RISCVDisassembler::DisassembleOP_SUB(Instr instr) {
763 switch (instr.funct3()) {
765 if (instr.rs1() ==
ZR) {
766 Print(
"neg 'rd, 'rs2", instr,
RV_I);
768 Print(
"sub 'rd, 'rs1, 'rs2", instr,
RV_I);
772 Print(
"sra 'rd, 'rs1, 'rs2", instr,
RV_I);
775 Print(
"andn 'rd, 'rs1, 'rs2", instr,
RV_Zbb);
778 Print(
"orn 'rd, 'rs1, 'rs2", instr,
RV_Zbb);
781 Print(
"xnor 'rd, 'rs1, 'rs2", instr,
RV_Zbb);
784 UnknownInstruction(instr);
788void RISCVDisassembler::DisassembleOP_MULDIV(Instr instr) {
789 switch (instr.funct3()) {
791 Print(
"mul 'rd, 'rs1, 'rs2", instr,
RV_M);
794 Print(
"mulh 'rd, 'rs1, 'rs2", instr,
RV_M);
797 Print(
"mulhsu 'rd, 'rs1, 'rs2", instr,
RV_M);
800 Print(
"mulhu 'rd, 'rs1, 'rs2", instr,
RV_M);
803 Print(
"div 'rd, 'rs1, 'rs2", instr,
RV_M);
806 Print(
"divu 'rd, 'rs1, 'rs2", instr,
RV_M);
809 Print(
"rem 'rd, 'rs1, 'rs2", instr,
RV_M);
812 Print(
"remu 'rd, 'rs1, 'rs2", instr,
RV_M);
815 UnknownInstruction(instr);
819void RISCVDisassembler::DisassembleOP_SHADD(Instr instr) {
820 switch (instr.funct3()) {
822 Print(
"sh1add 'rd, 'rs1, 'rs2", instr,
RV_Zba);
825 Print(
"sh2add 'rd, 'rs1, 'rs2", instr,
RV_Zba);
828 Print(
"sh3add 'rd, 'rs1, 'rs2", instr,
RV_Zba);
831 UnknownInstruction(instr);
835void RISCVDisassembler::DisassembleOP_MINMAXCLMUL(Instr instr) {
836 switch (instr.funct3()) {
838 Print(
"max 'rd, 'rs1, 'rs2", instr,
RV_Zbb);
841 Print(
"maxu 'rd, 'rs1, 'rs2", instr,
RV_Zbb);
844 Print(
"min 'rd, 'rs1, 'rs2", instr,
RV_Zbb);
847 Print(
"minu 'rd, 'rs1, 'rs2", instr,
RV_Zbb);
850 Print(
"clmul 'rd, 'rs1, 'rs2", instr,
RV_Zbc);
853 Print(
"clmulh 'rd, 'rs1, 'rs2", instr,
RV_Zbc);
856 Print(
"clmulr 'rd, 'rs1, 'rs2", instr,
RV_Zbc);
859 UnknownInstruction(instr);
863void RISCVDisassembler::DisassembleOP_ROTATE(Instr instr) {
864 switch (instr.funct3()) {
866 Print(
"ror 'rd, 'rs1, 'rs2", instr,
RV_Zbb);
869 Print(
"rol 'rd, 'rs1, 'rs2", instr,
RV_Zbb);
872 UnknownInstruction(instr);
876void RISCVDisassembler::DisassembleOP_BCLRBEXT(Instr instr) {
877 switch (instr.funct3()) {
879 Print(
"bclr 'rd, 'rs1, 'rs2", instr,
RV_Zbs);
882 Print(
"bext 'rd, 'rs1, 'rs2", instr,
RV_Zbs);
885 UnknownInstruction(instr);
889void RISCVDisassembler::DisassembleOP32(Instr instr) {
890 switch (instr.funct7()) {
892 DisassembleOP32_0(instr);
895 DisassembleOP32_SUB(instr);
898 DisassembleOP32_MULDIV(instr);
901 DisassembleOP32_SHADD(instr);
904 DisassembleOP32_ADDUW(instr);
907 DisassembleOP32_ROTATE(instr);
910 UnknownInstruction(instr);
914void RISCVDisassembler::DisassembleOP32_0(Instr instr) {
915 switch (instr.funct3()) {
918 Print(
"addw 'rd, 'rs1, 'rs2", instr,
RV_I);
921 Print(
"sllw 'rd, 'rs1, 'rs2", instr,
RV_I);
924 Print(
"srlw 'rd, 'rs1, 'rs2", instr,
RV_I);
929 UnknownInstruction(instr);
933void RISCVDisassembler::DisassembleOP32_SUB(Instr instr) {
934 switch (instr.funct3()) {
937 if (instr.rs1() ==
ZR) {
938 Print(
"negw 'rd, 'rs2", instr,
RV_I);
940 Print(
"subw 'rd, 'rs1, 'rs2", instr,
RV_I);
944 Print(
"sraw 'rd, 'rs1, 'rs2", instr,
RV_I);
948 UnknownInstruction(instr);
952void RISCVDisassembler::DisassembleOP32_MULDIV(Instr instr) {
953 switch (instr.funct3()) {
956 Print(
"mulw 'rd, 'rs1, 'rs2", instr,
RV_M);
959 Print(
"divw 'rd, 'rs1, 'rs2", instr,
RV_M);
962 Print(
"divuw 'rd, 'rs1, 'rs2", instr,
RV_M);
965 Print(
"remw 'rd, 'rs1, 'rs2", instr,
RV_M);
968 Print(
"remuw 'rd, 'rs1, 'rs2", instr,
RV_M);
972 UnknownInstruction(instr);
976void RISCVDisassembler::DisassembleOP32_SHADD(Instr instr) {
977 switch (instr.funct3()) {
979 Print(
"sh1add.uw 'rd, 'rs1, 'rs2", instr,
RV_Zba);
982 Print(
"sh2add.uw 'rd, 'rs1, 'rs2", instr,
RV_Zba);
985 Print(
"sh3add.uw 'rd, 'rs1, 'rs2", instr,
RV_Zba);
988 UnknownInstruction(instr);
992void RISCVDisassembler::DisassembleOP32_ADDUW(Instr instr) {
993 switch (instr.funct3()) {
996 Print(
"add.uw 'rd, 'rs1, 'rs2", instr,
RV_Zba);
999 Print(
"zext.h 'rd, 'rs1", instr,
RV_Zbb);
1003 UnknownInstruction(instr);
1007void RISCVDisassembler::DisassembleOP32_ROTATE(Instr instr) {
1008 switch (instr.funct3()) {
1010 Print(
"rorw 'rd, 'rs1, 'rs2", instr,
RV_Zbb);
1013 Print(
"rolw 'rd, 'rs1, 'rs2", instr,
RV_Zbb);
1016 UnknownInstruction(instr);
1020void RISCVDisassembler::DisassembleMISCMEM(Instr instr) {
1021 switch (instr.funct3()) {
1023 Print(
"fence'predsucc", instr,
RV_I);
1026 Print(
"fence.i", instr,
RV_I);
1029 UnknownInstruction(instr);
1033void RISCVDisassembler::DisassembleSYSTEM(Instr instr) {
1034 switch (instr.funct3()) {
1036 switch (instr.funct12()) {
1038 if (instr.rs1() ==
ZR) {
1039 Print(
"ecall", instr,
RV_I);
1041 Print(
"SimulatorPrintObject 'rs1", instr,
RV_I);
1045 Print(
"ebreak", instr,
RV_I);
1048 UnknownInstruction(instr);
1052 if (instr.rd() ==
ZR) {
1053 Print(
"csrw 'csr, 'rs1", instr,
RV_I);
1055 Print(
"csrrw 'rd, 'csr, 'rs1", instr,
RV_I);
1059 if (instr.rs1() ==
ZR) {
1060 Print(
"csrr 'rd, 'csr", instr,
RV_I);
1061 }
else if (instr.rd() ==
ZR) {
1062 Print(
"csrs 'csr, 'rs1", instr,
RV_I);
1064 Print(
"csrrs 'rd, 'csr, 'rs1", instr,
RV_I);
1068 if (instr.rd() ==
ZR) {
1069 Print(
"csrc 'csr, 'rs1", instr,
RV_I);
1071 Print(
"csrrc 'rd, 'csr, 'rs1", instr,
RV_I);
1075 if (instr.rd() ==
ZR) {
1076 Print(
"csrwi 'csr, 'zimm", instr,
RV_I);
1078 Print(
"csrrwi 'rd, 'csr, 'zimm", instr,
RV_I);
1082 if (instr.rd() ==
ZR) {
1083 Print(
"csrsi 'csr, 'zimm", instr,
RV_I);
1085 Print(
"csrrsi 'rd, 'csr, 'zimm", instr,
RV_I);
1089 if (instr.rd() ==
ZR) {
1090 Print(
"csrci 'csr, 'zimm", instr,
RV_I);
1092 Print(
"csrrci 'rd, 'csr, 'zimm", instr,
RV_I);
1096 UnknownInstruction(instr);
1100void RISCVDisassembler::DisassembleAMO(Instr instr) {
1101 switch (instr.funct3()) {
1103 DisassembleAMO8(instr);
1106 DisassembleAMO16(instr);
1109 DisassembleAMO32(instr);
1112 DisassembleAMO64(instr);
1115 UnknownInstruction(instr);
1119void RISCVDisassembler::DisassembleAMO8(Instr instr) {
1120 switch (instr.funct5()) {
1122 Print(
"lb'order 'rd, ('rs1)", instr,
RV_Zalasr);
1125 Print(
"sb'order 'rs2, ('rs1)", instr,
RV_Zalasr);
1128 UnknownInstruction(instr);
1132void RISCVDisassembler::DisassembleAMO16(Instr instr) {
1133 switch (instr.funct5()) {
1135 Print(
"lh'order 'rd, ('rs1)", instr,
RV_Zalasr);
1138 Print(
"sh'order 'rs2, ('rs1)", instr,
RV_Zalasr);
1141 UnknownInstruction(instr);
1145void RISCVDisassembler::DisassembleAMO32(Instr instr) {
1146 switch (instr.funct5()) {
1148 Print(
"lr.w'order 'rd, ('rs1)", instr,
RV_A);
1151 Print(
"sc.w'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1154 Print(
"amoswap.w'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1157 Print(
"amoadd.w'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1160 Print(
"amoxor.w'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1163 Print(
"amoand.w'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1166 Print(
"amoor.w'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1169 Print(
"amomin.w'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1172 Print(
"amomax.w'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1175 Print(
"amominu.w'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1178 Print(
"amomaxu.w'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1181 Print(
"lw'order 'rd, ('rs1)", instr,
RV_Zalasr);
1184 Print(
"sw'order 'rs2, ('rs1)", instr,
RV_Zalasr);
1187 UnknownInstruction(instr);
1191void RISCVDisassembler::DisassembleAMO64(Instr instr) {
1192 switch (instr.funct5()) {
1195 Print(
"lr.d'order 'rd, ('rs1)", instr,
RV_A);
1198 Print(
"sc.d'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1201 Print(
"amoswap.d'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1204 Print(
"amoadd.d'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1207 Print(
"amoxor.d'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1210 Print(
"amoand.d'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1213 Print(
"amoor.d'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1216 Print(
"amomin.d'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1219 Print(
"amomax.d'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1222 Print(
"amominu.d'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1225 Print(
"amomaxu.d'order 'rd, 'rs2, ('rs1)", instr,
RV_A);
1228 Print(
"ld'order 'rd, ('rs1)", instr,
RV_Zalasr);
1231 Print(
"sd'order 'rs2, ('rs1)", instr,
RV_Zalasr);
1235 UnknownInstruction(instr);
1239void RISCVDisassembler::DisassembleFMADD(Instr instr) {
1240 switch (instr.funct2()) {
1242 Print(
"fmadd.s 'frd, 'frs1, 'frs2, 'frs3'round", instr,
RV_F);
1245 Print(
"fmadd.d 'frd, 'frs1, 'frs2, 'frs3'round", instr,
RV_D);
1248 UnknownInstruction(instr);
1252void RISCVDisassembler::DisassembleFMSUB(Instr instr) {
1253 switch (instr.funct2()) {
1255 Print(
"fmsub.s 'frd, 'frs1, 'frs2, 'frs3'round", instr,
RV_F);
1258 Print(
"fmsub.d 'frd, 'frs1, 'frs2, 'frs3'round", instr,
RV_D);
1261 UnknownInstruction(instr);
1265void RISCVDisassembler::DisassembleFNMADD(Instr instr) {
1266 switch (instr.funct2()) {
1268 Print(
"fnmadd.s 'frd, 'frs1, 'frs2, 'frs3'round", instr,
RV_F);
1271 Print(
"fnmadd.d 'frd, 'frs1, 'frs2, 'frs3'round", instr,
RV_D);
1274 UnknownInstruction(instr);
1278void RISCVDisassembler::DisassembleFNMSUB(Instr instr) {
1279 switch (instr.funct2()) {
1281 Print(
"fnmsub.s 'frd, 'frs1, 'frs2, 'frs3'round", instr,
RV_F);
1284 Print(
"fnmsub.d 'frd, 'frs1, 'frs2, 'frs3'round", instr,
RV_D);
1287 UnknownInstruction(instr);
1291void RISCVDisassembler::DisassembleOPFP(Instr instr) {
1292 switch (instr.funct7()) {
1294 Print(
"fadd.s 'frd, 'frs1, 'frs2'round", instr,
RV_F);
1297 Print(
"fsub.s 'frd, 'frs1, 'frs2'round", instr,
RV_F);
1300 Print(
"fmul.s 'frd, 'frs1, 'frs2'round", instr,
RV_F);
1303 Print(
"fdiv.s 'frd, 'frs1, 'frs2'round", instr,
RV_F);
1306 Print(
"fsqrt.s 'frd, 'frs1'round", instr,
RV_F);
1309 switch (instr.funct3()) {
1311 if (instr.frs1() == instr.frs2()) {
1312 Print(
"fmv.s 'frd, 'frs1", instr,
RV_F);
1314 Print(
"fsgnj.s 'frd, 'frs1, 'frs2", instr,
RV_F);
1318 if (instr.frs1() == instr.frs2()) {
1319 Print(
"fneg.s 'frd, 'frs1", instr,
RV_F);
1321 Print(
"fsgnjn.s 'frd, 'frs1, 'frs2", instr,
RV_F);
1325 if (instr.frs1() == instr.frs2()) {
1326 Print(
"fabs.s 'frd, 'frs1", instr,
RV_F);
1328 Print(
"fsgnjx.s 'frd, 'frs1, 'frs2", instr,
RV_F);
1332 UnknownInstruction(instr);
1337 switch (instr.funct3()) {
1339 Print(
"fmin.s 'frd, 'frs1, 'frs2", instr,
RV_F);
1342 Print(
"fmax.s 'frd, 'frs1, 'frs2", instr,
RV_F);
1345 UnknownInstruction(instr);
1350 switch (instr.funct3()) {
1352 Print(
"feq.s 'rd, 'frs1, 'frs2", instr,
RV_F);
1355 Print(
"flt.s 'rd, 'frs1, 'frs2", instr,
RV_F);
1358 Print(
"fle.s 'rd, 'frs1, 'frs2", instr,
RV_F);
1361 UnknownInstruction(instr);
1366 switch (instr.funct3()) {
1368 Print(
"fclass.s 'rd, 'frs1", instr,
RV_F);
1371 Print(
"fmv.x.w 'rd, 'frs1", instr,
RV_F);
1374 UnknownInstruction(instr);
1378 switch (
static_cast<FcvtRs2>(instr.rs2())) {
1380 Print(
"fcvt.w.s 'rd, 'frs1'round", instr,
RV_F);
1383 Print(
"fcvt.wu.s 'rd, 'frs1'round", instr,
RV_F);
1387 Print(
"fcvt.l.s 'rd, 'frs1'round", instr,
RV_F);
1390 Print(
"fcvt.lu.s 'rd, 'frs1'round", instr,
RV_F);
1394 UnknownInstruction(instr);
1398 switch (
static_cast<FcvtRs2>(instr.rs2())) {
1400 Print(
"fcvt.s.w 'frd, 'rs1'round", instr,
RV_F);
1403 Print(
"fcvt.s.wu 'frd, 'rs1'round", instr,
RV_F);
1407 Print(
"fcvt.s.l 'frd, 'rs1'round", instr,
RV_F);
1410 Print(
"fcvt.s.lu 'frd, 'rs1'round", instr,
RV_F);
1414 UnknownInstruction(instr);
1418 Print(
"fmv.w.x 'frd, 'rs1", instr,
RV_F);
1421 Print(
"fadd.d 'frd, 'frs1, 'frs2'round", instr,
RV_D);
1424 Print(
"fsub.d 'frd, 'frs1, 'frs2'round", instr,
RV_D);
1427 Print(
"fmul.d 'frd, 'frs1, 'frs2'round", instr,
RV_D);
1430 Print(
"fdiv.d 'frd, 'frs1, 'frs2'round", instr,
RV_D);
1433 Print(
"fsqrt.d 'frd, 'frs1'round", instr,
RV_D);
1436 switch (instr.funct3()) {
1438 if (instr.frs1() == instr.frs2()) {
1439 Print(
"fmv.d 'frd, 'frs1", instr,
RV_D);
1441 Print(
"fsgnj.d 'frd, 'frs1, 'frs2", instr,
RV_D);
1445 if (instr.frs1() == instr.frs2()) {
1446 Print(
"fneg.d 'frd, 'frs1", instr,
RV_D);
1448 Print(
"fsgnjn.d 'frd, 'frs1, 'frs2", instr,
RV_D);
1452 if (instr.frs1() == instr.frs2()) {
1453 Print(
"fabs.d 'frd, 'frs1", instr,
RV_D);
1455 Print(
"fsgnjx.d 'frd, 'frs1, 'frs2", instr,
RV_D);
1459 UnknownInstruction(instr);
1464 switch (instr.funct3()) {
1466 Print(
"fmin.d 'frd, 'frs1, 'frs2", instr,
RV_D);
1469 Print(
"fmax.d 'frd, 'frs1, 'frs2", instr,
RV_D);
1472 UnknownInstruction(instr);
1477 switch (instr.rs2()) {
1479 Print(
"fcvt.s.d 'frd, 'frs1'round", instr,
RV_D);
1482 UnknownInstruction(instr);
1487 switch (instr.rs2()) {
1489 Print(
"fcvt.d.s 'frd, 'frs1'round", instr,
RV_D);
1492 UnknownInstruction(instr);
1497 switch (instr.funct3()) {
1499 Print(
"feq.d 'rd, 'frs1, 'frs2", instr,
RV_D);
1502 Print(
"flt.d 'rd, 'frs1, 'frs2", instr,
RV_D);
1505 Print(
"fle.d 'rd, 'frs1, 'frs2", instr,
RV_D);
1508 UnknownInstruction(instr);
1513 switch (instr.funct3()) {
1515 Print(
"fclass.d 'rd, 'frs1", instr,
RV_D);
1519 Print(
"fmv.x.d 'rd, 'frs1", instr,
RV_D);
1523 UnknownInstruction(instr);
1527 switch (
static_cast<FcvtRs2>(instr.rs2())) {
1529 Print(
"fcvt.w.d 'rd, 'frs1'round", instr,
RV_D);
1532 Print(
"fcvt.wu.d 'rd, 'frs1'round", instr,
RV_D);
1536 Print(
"fcvt.l.d 'rd, 'frs1'round", instr,
RV_D);
1539 Print(
"fcvt.lu.d 'rd, 'frs1'round", instr,
RV_D);
1543 UnknownInstruction(instr);
1547 switch (
static_cast<FcvtRs2>(instr.rs2())) {
1549 Print(
"fcvt.d.w 'frd, 'rs1'round", instr,
RV_D);
1552 Print(
"fcvt.d.wu 'frd, 'rs1'round", instr,
RV_D);
1556 Print(
"fcvt.d.l 'frd, 'rs1'round", instr,
RV_D);
1559 Print(
"fcvt.d.lu 'frd, 'rs1'round", instr,
RV_D);
1563 UnknownInstruction(instr);
1568 Print(
"fmv.d.x 'frd, 'rs1", instr,
RV_D);
1572 UnknownInstruction(instr);
1576void RISCVDisassembler::UnknownInstruction(Instr instr) {
1577 if (instr.encoding() == 0) {
1578 Print(
"trap", instr,
RV_I);
1584void RISCVDisassembler::UnknownInstruction(CInstr instr) {
1585 if (instr.encoding() == 0) {
1586 Print(
"trap", instr,
RV_I);
1592void RISCVDisassembler::Print(
const char*
format,
1597 while (
format[0] !=
'\0') {
1609void RISCVDisassembler::Print(
const char*
format,
1614 while (
format[0] !=
'\0') {
1626#define STRING_STARTS_WITH(string, compare_string) \
1627 (strncmp(string, compare_string, strlen(compare_string)) == 0)
1629const char* RISCVDisassembler::PrintOption(
const char*
format, Instr instr) {
1630 if (STRING_STARTS_WITH(
format,
"rd")) {
1633 }
else if (STRING_STARTS_WITH(
format,
"rs1")) {
1636 }
else if (STRING_STARTS_WITH(
format,
"rs2")) {
1639 }
else if (STRING_STARTS_WITH(
format,
"shamt")) {
1640 Printf(
"0x%x", instr.shamt());
1642 }
else if (STRING_STARTS_WITH(
format,
"jimm")) {
1643 Printf(
"%+" Pd,
static_cast<intptr_t
>(instr.jtype_imm()));
1645 }
else if (STRING_STARTS_WITH(
format,
"uimm")) {
1647 Printf(
"%" Pd,
static_cast<intptr_t
>(instr.utype_imm()));
1649 }
else if (STRING_STARTS_WITH(
format,
"iimm")) {
1650 Printf(
"%" Pd,
static_cast<intptr_t
>(instr.itype_imm()));
1652 }
else if (STRING_STARTS_WITH(
format,
"simm")) {
1653 Printf(
"%" Pd,
static_cast<intptr_t
>(instr.stype_imm()));
1655 }
else if (STRING_STARTS_WITH(
format,
"bimm")) {
1656 Printf(
"%+" Pd,
static_cast<intptr_t
>(instr.btype_imm()));
1658 }
else if (STRING_STARTS_WITH(
format,
"zimm")) {
1659 Printf(
"%" Pd,
static_cast<intptr_t
>(instr.zimm()));
1661 }
else if (STRING_STARTS_WITH(
format,
"csr")) {
1662 Printf(
"0x%" Px,
static_cast<intptr_t
>(instr.csr()));
1664 }
else if (STRING_STARTS_WITH(
format,
"order")) {
1665 switch (instr.memory_order()) {
1666 case std::memory_order_relaxed:
1668 case std::memory_order_acquire:
1671 case std::memory_order_release:
1674 case std::memory_order_acq_rel:
1681 }
else if (STRING_STARTS_WITH(
format,
"round")) {
1682 switch (instr.rounding()) {
1702 Printf(
"<invalid rounding mode>");
1705 }
else if (STRING_STARTS_WITH(
format,
"predsucc")) {
1708 if ((pred != HartEffects::kAll) || (succ != HartEffects::kAll)) {
1710 if ((pred & HartEffects::kInput) != 0) Printf(
"i");
1715 if ((succ & HartEffects::kInput) != 0) Printf(
"i");
1721 }
else if (STRING_STARTS_WITH(
format,
"frd")) {
1724 }
else if (STRING_STARTS_WITH(
format,
"frs1")) {
1727 }
else if (STRING_STARTS_WITH(
format,
"frs2")) {
1730 }
else if (STRING_STARTS_WITH(
format,
"frs3")) {
1739const char* RISCVDisassembler::PrintOption(
const char*
format, CInstr instr) {
1740 if (STRING_STARTS_WITH(
format,
"rdp")) {
1743 }
else if (STRING_STARTS_WITH(
format,
"rs1p")) {
1746 }
else if (STRING_STARTS_WITH(
format,
"rs2p")) {
1749 }
else if (STRING_STARTS_WITH(
format,
"rd")) {
1752 }
else if (STRING_STARTS_WITH(
format,
"rs1")) {
1755 }
else if (STRING_STARTS_WITH(
format,
"rs2")) {
1758 }
else if (STRING_STARTS_WITH(
format,
"frdp")) {
1761 }
else if (STRING_STARTS_WITH(
format,
"frs1p")) {
1764 }
else if (STRING_STARTS_WITH(
format,
"frs2p")) {
1767 }
else if (STRING_STARTS_WITH(
format,
"frd")) {
1770 }
else if (STRING_STARTS_WITH(
format,
"frs1")) {
1773 }
else if (STRING_STARTS_WITH(
format,
"frs2")) {
1776 }
else if (STRING_STARTS_WITH(
format,
"spload4imm")) {
1777 Printf(
"%" Pd,
static_cast<intptr_t
>(instr.spload4_imm()));
1779 }
else if (STRING_STARTS_WITH(
format,
"spload8imm")) {
1780 Printf(
"%" Pd,
static_cast<intptr_t
>(instr.spload8_imm()));
1782 }
else if (STRING_STARTS_WITH(
format,
"spstore4imm")) {
1783 Printf(
"%" Pd,
static_cast<intptr_t
>(instr.spstore4_imm()));
1785 }
else if (STRING_STARTS_WITH(
format,
"spstore8imm")) {
1786 Printf(
"%" Pd,
static_cast<intptr_t
>(instr.spstore8_imm()));
1788 }
else if (STRING_STARTS_WITH(
format,
"mem4imm")) {
1789 Printf(
"%" Pd,
static_cast<intptr_t
>(instr.mem4_imm()));
1791 }
else if (STRING_STARTS_WITH(
format,
"mem8imm")) {
1792 Printf(
"%" Pd,
static_cast<intptr_t
>(instr.mem8_imm()));
1794 }
else if (STRING_STARTS_WITH(
format,
"jimm")) {
1795 Printf(
"%+" Pd,
static_cast<intptr_t
>(instr.j_imm()));
1797 }
else if (STRING_STARTS_WITH(
format,
"bimm")) {
1798 Printf(
"%+" Pd,
static_cast<intptr_t
>(instr.b_imm()));
1800 }
else if (STRING_STARTS_WITH(
format,
"iimm")) {
1801 Printf(
"%" Pd,
static_cast<intptr_t
>(instr.i_imm()));
1803 }
else if (STRING_STARTS_WITH(
format,
"uimm")) {
1805 Printf(
"%" Pd,
static_cast<intptr_t
>(instr.u_imm()));
1807 }
else if (STRING_STARTS_WITH(
format,
"i16imm")) {
1808 Printf(
"%" Pd,
static_cast<intptr_t
>(instr.i16_imm()));
1810 }
else if (STRING_STARTS_WITH(
format,
"i4spnimm")) {
1811 Printf(
"%" Pd,
static_cast<intptr_t
>(instr.i4spn_imm()));
1822 intptr_t human_size,
1823 int* out_instr_size,
1827 RISCVDisassembler decoder(human_buffer, human_size,
1828 FLAG_use_compressed_instructions ?
RV_GC :
RV_G);
1829 int instr_size = decoder.Disassemble(pc);
1830 if (instr_size == 2) {
1832 *
reinterpret_cast<uint16_t*
>(pc));
1833 }
else if (instr_size == 4) {
1837 if (out_instr_size !=
nullptr) {
1838 *out_instr_size = instr_size;
1842 if (!
code.IsNull()) {
static uint32_t buffer_size(uint32_t offset, uint32_t maxAlignment)
static void DecodeInstruction(char *hex_buffer, intptr_t hex_size, char *human_buffer, intptr_t human_size, int *out_instr_len, const Code &code, Object **object, uword pc)
static int SNPrint(char *str, size_t size, const char *format,...) PRINTF_ATTRIBUTE(3
static int static int VSNPrint(char *str, size_t size, const char *format, va_list args)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format
SK_API sk_sp< SkShader > Empty()
static constexpr Extension RV_F(3)
bool IsCInstruction(uint16_t parcel)
static constexpr Extension RV_Zbc(9)
static constexpr ExtensionSet RV_GC
const char *const fpu_reg_names[kNumberOfFpuRegisters]
static constexpr Extension RV_Zalasr(10)
bool DecodeLoadObjectFromPoolOrThread(uword pc, const Code &code, Object *obj)
static T LoadUnaligned(const T *ptr)
static constexpr Extension RV_A(2)
const char *const cpu_reg_names[kNumberOfCpuRegisters]
static constexpr Extension RV_Zba(6)
static constexpr Extension RV_M(1)
static constexpr Extension RV_C(5)
static constexpr Extension RV_Zbs(8)
static constexpr ExtensionSet RV_G
static constexpr Extension RV_D(4)
static constexpr Extension RV_I(0)
static constexpr Extension RV_Zbb(7)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer