9#ifndef LLDB_SOURCE_PLUGINS_INSTRUCTION_RISCV_RISCVCINSTRUCTION_H
10#define LLDB_SOURCE_PLUGINS_INSTRUCTION_RISCV_RISCVCINSTRUCTION_H
24 operator int() {
return rd; }
35 return RxC{(inst & 0x7C) >> 2,
false};
54 uint16_t offset = ((inst << 4) & 0xc0)
55 | ((inst >> 7) & 0x20)
56 | ((inst >> 2) & 0x1c);
58 return RESERVED{inst};
64 uint16_t offset = ((inst << 4) & 0x1c0)
65 | ((inst >> 7) & 0x20)
66 | ((inst >> 2) & 0x18);
68 return RESERVED{inst};
73 uint16_t offset = ((inst >> 1) & 0xc0)
74 | ((inst >> 7) & 0x3c);
79 uint16_t offset = ((inst >> 1) & 0x1c0)
80 | ((inst >> 7) & 0x38);
85 uint16_t offset = ((inst << 1) & 0x40)
86 | ((inst >> 7) & 0x38)
87 | ((inst >> 4) & 0x4);
92 uint16_t offset = ((inst << 1) & 0xc0)
93 | ((inst >> 7) & 0x38);
98 uint16_t offset = ((inst << 1) & 0x40)
99 | ((inst >> 7) & 0x38)
100 | ((inst >> 4) & 0x4);
105 uint16_t offset = ((inst << 1) & 0xc0)
106 | ((inst >> 7) & 0x38);
111 uint16_t offset = ((inst >> 1) & 0x800)
112 | ((inst << 2) & 0x400)
113 | ((inst >> 1) & 0x300)
114 | ((inst << 1) & 0x80)
115 | ((inst >> 1) & 0x40)
116 | ((inst << 3) & 0x20)
117 | ((inst >> 7) & 0x10)
118 | ((inst >> 2) & 0xe);
119 if ((offset & 0x800) == 0)
120 return JAL{
Rd{0}, uint32_t(offset)};
121 return JAL{
Rd{0}, uint32_t(int32_t(int16_t(offset | 0xf000)))};
127 return RESERVED{inst};
128 return JALR{
Rd{0}, rs1, 0};
135 return JALR{
Rd{1}, rs1, 0};
139 return ((inst >> 4) & 0x100)
140 | ((inst << 1) & 0xc0)
141 | ((inst << 3) & 0x20)
142 | ((inst >> 7) & 0x18)
143 | ((inst >> 2) & 0x6);
148 uint16_t offset =
BOffset(inst);
149 if ((offset & 0x100) == 0)
150 return B{rs1,
Rs{0}, uint32_t(offset), 0b001};
151 return B{rs1,
Rs{0}, uint32_t(int32_t(int16_t(offset | 0xfe00))), 0b001};
156 uint16_t offset =
BOffset(inst);
157 if ((offset & 0x100) == 0)
158 return B{rs1,
Rs{0}, uint32_t(offset), 0b000};
159 return B{rs1,
Rs{0}, uint32_t(int32_t(int16_t(offset | 0xfe00))), 0b000};
164 uint16_t imm = ((inst >> 7) & 0x20) | ((inst >> 2) & 0x1f);
165 if ((imm & 0x20) == 0)
166 return ADDI{rd,
Rs{0}, uint32_t(imm)};
167 return ADDI{rd,
Rs{0}, uint32_t(int32_t(int8_t(imm | 0xc0)))};
175 uint16_t nzimm = ((inst >> 3) & 0x200)
176 | ((inst >> 2) & 0x10)
177 | ((inst << 1) & 0x40)
178 | ((inst << 4) & 0x180)
179 | ((inst << 3) & 0x20);
181 return RESERVED{inst};
182 if ((nzimm & 0x200) == 0)
185 uint32_t(int32_t(int16_t(nzimm | 0xfc00)))};
188 ((uint32_t(inst) << 5) & 0x20000) | ((uint32_t(inst) << 10) & 0x1f000);
189 if ((imm & 0x20000) == 0)
191 return LUI{rd, uint32_t(int32_t(imm | 0xfffc0000))};
198 uint16_t imm = ((inst >> 7) & 0x20) | ((inst >> 2) & 0x1f);
199 if ((imm & 0x20) == 0)
200 return ADDI{rd, rd, uint32_t(imm)};
201 return ADDI{rd, rd, uint32_t(int32_t(int8_t(imm | 0xc0)))};
207 return RESERVED{inst};
208 uint16_t imm = ((inst >> 7) & 0x20) | ((inst >> 2) & 0x1f);
209 if ((imm & 0x20) == 0)
210 return ADDIW{rd, rd, uint32_t(imm)};
211 return ADDIW{rd, rd, uint32_t(int32_t(int8_t(imm | 0xc0)))};
216 uint16_t nzuimm = ((inst >> 1) & 0x3c0)
217 | ((inst >> 7) & 0x30)
218 | ((inst >> 2) & 0x8)
219 | ((inst >> 4) & 0x4);
221 if (rd == 0 && nzuimm == 0)
222 return INVALID{inst};
224 return RESERVED{inst};
230 uint16_t shamt = ((inst >> 7) & 0x20) | ((inst >> 2) & 0x1f);
231 if (rd == 0 || shamt == 0)
233 return SLLI{rd, rd, uint8_t(shamt)};
238 uint16_t shamt = ((inst >> 7) & 0x20) | ((inst >> 2) & 0x1f);
241 return SRLI{rd, rd, uint8_t(shamt)};
246 uint16_t shamt = ((inst >> 7) & 0x20) | ((inst >> 2) & 0x1f);
249 return SRAI{rd, rd, uint8_t(shamt)};
254 uint16_t imm = ((inst >> 7) & 0x20) | ((inst >> 2) & 0x1f);
255 if ((imm & 0x20) == 0)
256 return ANDI{rd, rd, uint32_t(imm)};
257 return ANDI{rd, rd, uint32_t(int32_t(int8_t(imm | 0xc0)))};
265 return ADD{rd,
Rs{0}, rs2};
303 uint16_t offset = ((inst << 1) & 0x40)
304 | ((inst >> 7) & 0x38)
305 | ((inst >> 4) & 0x4);
310 uint16_t offset = ((inst << 1) & 0x40)
311 | ((inst >> 7) & 0x38)
312 | ((inst >> 4) & 0x4);
318 uint16_t offset = ((inst << 4) & 0xc0)
319 | ((inst >> 7) & 0x20)
320 | ((inst >> 2) & 0x1c);
325 uint16_t offset = ((inst >> 1) & 0xc0)
326 | ((inst >> 7) & 0x3c);
332 uint16_t offset = ((inst << 4) & 0x1c0)
333 | ((inst >> 7) & 0x20)
334 | ((inst >> 2) & 0x18);
339 uint16_t offset = ((inst >> 1) & 0x1c0)
340 | ((inst >> 7) & 0x38);
345 uint16_t offset = ((inst << 1) & 0xc0)
346 | ((inst >> 7) & 0x38);
351 uint16_t offset = ((inst << 1) & 0xc0)
352 | ((inst >> 7) & 0x38);
A class that represents a running process on the host machine.
constexpr RxC DecodeCR_RS2(uint32_t inst)
RISCVInst DecodeC_LD(uint32_t inst)
RISCVInst DecodeC_SLLI(uint32_t inst)
RISCVInst DecodeC_LW(uint32_t inst)
constexpr RxC DecodeCB_RS1(uint32_t inst)
constexpr RxC DecodeCR_RS1(uint32_t inst)
constexpr RxC DecodeCB_RD(uint32_t inst)
constexpr RxC DecodeCA_RS1(uint32_t inst)
RISCVInst DecodeC_SUBW(uint32_t inst)
RISCVInst DecodeC_ADDW(uint32_t inst)
RISCVInst DecodeC_SRLI(uint32_t inst)
RISCVInst DecodeC_J(uint32_t inst)
constexpr RxC DecodeCA_RS2(uint32_t inst)
std::variant< LUI, AUIPC, JAL, JALR, B, LB, LH, LW, LBU, LHU, SB, SH, SW, ADDI, SLTI, SLTIU, XORI, ORI, ANDI, ADD, SUB, SLL, SLT, SLTU, XOR, SRL, SRA, OR, AND, LWU, LD, SD, SLLI, SRLI, SRAI, ADDIW, SLLIW, SRLIW, SRAIW, ADDW, SUBW, SLLW, SRLW, SRAW, MUL, MULH, MULHSU, MULHU, DIV, DIVU, REM, REMU, MULW, DIVW, DIVUW, REMW, REMUW, LR_W, SC_W, AMOSWAP_W, AMOADD_W, AMOXOR_W, AMOAND_W, AMOOR_W, AMOMIN_W, AMOMAX_W, AMOMINU_W, AMOMAXU_W, LR_D, SC_D, AMOSWAP_D, AMOADD_D, AMOXOR_D, AMOAND_D, AMOOR_D, AMOMIN_D, AMOMAX_D, AMOMINU_D, AMOMAXU_D, FLW, FSW, FMADD_S, FMSUB_S, FNMADD_S, FNMSUB_S, FADD_S, FSUB_S, FMUL_S, FDIV_S, FSQRT_S, FSGNJ_S, FSGNJN_S, FSGNJX_S, FMIN_S, FMAX_S, FCVT_W_S, FCVT_WU_S, FMV_X_W, FEQ_S, FLT_S, FLE_S, FCLASS_S, FCVT_S_W, FCVT_S_WU, FMV_W_X, FCVT_L_S, FCVT_LU_S, FCVT_S_L, FCVT_S_LU, FLD, FSD, FMADD_D, FMSUB_D, FNMSUB_D, FNMADD_D, FADD_D, FSUB_D, FMUL_D, FDIV_D, FSQRT_D, FSGNJ_D, FSGNJN_D, FSGNJX_D, FMIN_D, FMAX_D, FCVT_S_D, FCVT_D_S, FEQ_D, FLT_D, FLE_D, FCLASS_D, FCVT_W_D, FCVT_WU_D, FCVT_D_W, FCVT_D_WU, FCVT_L_D, FCVT_LU_D, FMV_X_D, FCVT_D_L, FCVT_D_LU, FMV_D_X, INVALID, EBREAK, RESERVED, HINT, NOP > RISCVInst
RISCVInst DecodeC_ADDI(uint32_t inst)
RISCVInst DecodeC_OR(uint32_t inst)
RISCVInst DecodeC_SWSP(uint32_t inst)
RISCVInst DecodeC_XOR(uint32_t inst)
constexpr RxC DecodeCL_RD(uint32_t inst)
RISCVInst DecodeC_LUI_ADDI16SP(uint32_t inst)
RISCVInst DecodeC_FLDSP(uint32_t inst)
constexpr RxC DecodeCR_RD(uint32_t inst)
RISCVInst DecodeC_SW(uint32_t inst)
RISCVInst DecodeC_SUB(uint32_t inst)
constexpr RxC DecodeCI_RS1(uint32_t inst)
constexpr RxC DecodeCSS_RS2(uint32_t inst)
RISCVInst DecodeC_BEQZ(uint32_t inst)
RISCVInst DecodeC_FLWSP(uint32_t inst)
RISCVInst DecodeC_FSD(uint32_t inst)
RISCVInst DecodeC_ADD(uint32_t inst)
RISCVInst DecodeC_AND(uint32_t inst)
RISCVInst DecodeC_SRAI(uint32_t inst)
RISCVInst DecodeC_JR(uint32_t inst)
RISCVInst DecodeC_JALR(uint32_t inst)
RISCVInst DecodeC_FSWSP(uint32_t inst)
RISCVInst DecodeC_LWSP(uint32_t inst)
constexpr RxC DecodeCA_RD(uint32_t inst)
constexpr RxC DecodeCL_RS1(uint32_t inst)
constexpr uint16_t BOffset(uint32_t inst)
constexpr RxC DecodeCS_RS2(uint32_t inst)
RISCVInst DecodeC_FLD(uint32_t inst)
constexpr uint32_t DecodeRD(uint32_t inst)
RISCVInst DecodeC_MV(uint32_t inst)
constexpr RxC DecodeCS_RS1(uint32_t inst)
RISCVInst DecodeC_FSDSP(uint32_t inst)
RISCVInst DecodeC_LDSP(uint32_t inst)
RISCVInst DecodeC_FLW(uint32_t inst)
RISCVInst DecodeC_ANDI(uint32_t inst)
constexpr RxC DecodeCIW_RD(uint32_t inst)
RISCVInst DecodeC_ADDI4SPN(uint32_t inst)
RISCVInst DecodeC_FSW(uint32_t inst)
RISCVInst DecodeC_SDSP(uint32_t inst)
RISCVInst DecodeC_SD(uint32_t inst)
RISCVInst DecodeC_LI(uint32_t inst)
RISCVInst DecodeC_BNEZ(uint32_t inst)
RISCVInst DecodeC_ADDIW(uint32_t inst)
constexpr RxC DecodeCI_RD(uint32_t inst)
Unified RISC-V C register encoding.