@@ -57,6 +57,7 @@ LLVMInitializeVEDisassembler() {
5757 createVEDisassembler);
5858}
5959
60+ // clang-format off
6061static const unsigned I32RegDecoderTable[] = {
6162 VE::SW0, VE::SW1, VE::SW2, VE::SW3, VE::SW4, VE::SW5, VE::SW6,
6263 VE::SW7, VE::SW8, VE::SW9, VE::SW10, VE::SW11, VE::SW12, VE::SW13,
@@ -127,6 +128,8 @@ static const unsigned MiscRegDecoderTable[] = {
127128 VE::PMC4, VE::PMC5, VE::PMC6, VE::PMC7,
128129 VE::PMC8, VE::PMC9, VE::PMC10, VE::PMC11,
129130 VE::PMC12, VE::PMC13, VE::PMC14};
131+ // clang-format off
132+
130133
131134static DecodeStatus DecodeI32RegisterClass (MCInst &Inst, unsigned RegNo,
132135 uint64_t Address,
@@ -214,106 +217,6 @@ static DecodeStatus DecodeMISCRegisterClass(MCInst &Inst, unsigned RegNo,
214217 return MCDisassembler::Success;
215218}
216219
217- static DecodeStatus DecodeASX (MCInst &Inst, uint64_t insn, uint64_t Address,
218- const MCDisassembler *Decoder);
219- static DecodeStatus DecodeLoadI32 (MCInst &Inst, uint64_t insn, uint64_t Address,
220- const MCDisassembler *Decoder);
221- static DecodeStatus DecodeStoreI32 (MCInst &Inst, uint64_t insn,
222- uint64_t Address,
223- const MCDisassembler *Decoder);
224- static DecodeStatus DecodeLoadI64 (MCInst &Inst, uint64_t insn, uint64_t Address,
225- const MCDisassembler *Decoder);
226- static DecodeStatus DecodeStoreI64 (MCInst &Inst, uint64_t insn,
227- uint64_t Address,
228- const MCDisassembler *Decoder);
229- static DecodeStatus DecodeLoadF32 (MCInst &Inst, uint64_t insn, uint64_t Address,
230- const MCDisassembler *Decoder);
231- static DecodeStatus DecodeStoreF32 (MCInst &Inst, uint64_t insn,
232- uint64_t Address,
233- const MCDisassembler *Decoder);
234- static DecodeStatus DecodeLoadASI64 (MCInst &Inst, uint64_t insn,
235- uint64_t Address,
236- const MCDisassembler *Decoder);
237- static DecodeStatus DecodeStoreASI64 (MCInst &Inst, uint64_t insn,
238- uint64_t Address,
239- const MCDisassembler *Decoder);
240- static DecodeStatus DecodeTS1AMI64 (MCInst &Inst, uint64_t insn,
241- uint64_t Address,
242- const MCDisassembler *Decoder);
243- static DecodeStatus DecodeTS1AMI32 (MCInst &Inst, uint64_t insn,
244- uint64_t Address,
245- const MCDisassembler *Decoder);
246- static DecodeStatus DecodeCASI64 (MCInst &Inst, uint64_t insn, uint64_t Address,
247- const MCDisassembler *Decoder);
248- static DecodeStatus DecodeCASI32 (MCInst &Inst, uint64_t insn, uint64_t Address,
249- const MCDisassembler *Decoder);
250- static DecodeStatus DecodeCall (MCInst &Inst, uint64_t insn, uint64_t Address,
251- const MCDisassembler *Decoder);
252- static DecodeStatus DecodeSIMM7 (MCInst &Inst, uint64_t insn, uint64_t Address,
253- const MCDisassembler *Decoder);
254- static DecodeStatus DecodeSIMM32 (MCInst &Inst, uint64_t insn, uint64_t Address,
255- const MCDisassembler *Decoder);
256- static DecodeStatus DecodeCCOperand (MCInst &Inst, uint64_t insn,
257- uint64_t Address,
258- const MCDisassembler *Decoder);
259- static DecodeStatus DecodeRDOperand (MCInst &Inst, uint64_t insn,
260- uint64_t Address,
261- const MCDisassembler *Decoder);
262- static DecodeStatus DecodeBranchCondition (MCInst &Inst, uint64_t insn,
263- uint64_t Address,
264- const MCDisassembler *Decoder);
265- static DecodeStatus DecodeBranchConditionAlways (MCInst &Inst, uint64_t insn,
266- uint64_t Address,
267- const MCDisassembler *Decoder);
268-
269- #include " VEGenDisassemblerTables.inc"
270-
271- // / Read four bytes from the ArrayRef and return 32 bit word.
272- static DecodeStatus readInstruction64 (ArrayRef<uint8_t > Bytes, uint64_t Address,
273- uint64_t &Size, uint64_t &Insn,
274- bool IsLittleEndian) {
275- // We want to read exactly 8 Bytes of data.
276- if (Bytes.size () < 8 ) {
277- Size = 0 ;
278- return MCDisassembler::Fail;
279- }
280-
281- Insn = IsLittleEndian
282- ? ((uint64_t )Bytes[0 ] << 0 ) | ((uint64_t )Bytes[1 ] << 8 ) |
283- ((uint64_t )Bytes[2 ] << 16 ) | ((uint64_t )Bytes[3 ] << 24 ) |
284- ((uint64_t )Bytes[4 ] << 32 ) | ((uint64_t )Bytes[5 ] << 40 ) |
285- ((uint64_t )Bytes[6 ] << 48 ) | ((uint64_t )Bytes[7 ] << 56 )
286- : ((uint64_t )Bytes[7 ] << 0 ) | ((uint64_t )Bytes[6 ] << 8 ) |
287- ((uint64_t )Bytes[5 ] << 16 ) | ((uint64_t )Bytes[4 ] << 24 ) |
288- ((uint64_t )Bytes[3 ] << 32 ) | ((uint64_t )Bytes[2 ] << 40 ) |
289- ((uint64_t )Bytes[1 ] << 48 ) | ((uint64_t )Bytes[0 ] << 56 );
290-
291- return MCDisassembler::Success;
292- }
293-
294- DecodeStatus VEDisassembler::getInstruction (MCInst &Instr, uint64_t &Size,
295- ArrayRef<uint8_t > Bytes,
296- uint64_t Address,
297- raw_ostream &CStream) const {
298- uint64_t Insn;
299- bool isLittleEndian = getContext ().getAsmInfo ()->isLittleEndian ();
300- DecodeStatus Result =
301- readInstruction64 (Bytes, Address, Size, Insn, isLittleEndian);
302- if (Result == MCDisassembler::Fail)
303- return MCDisassembler::Fail;
304-
305- // Calling the auto-generated decoder function.
306-
307- Result = decodeInstruction (DecoderTableVE64, Instr, Insn, Address, this , STI);
308-
309- if (Result != MCDisassembler::Fail) {
310- Size = 8 ;
311- return Result;
312- }
313-
314- return MCDisassembler::Fail;
315- }
316-
317220typedef DecodeStatus (*DecodeFunc)(MCInst &MI, unsigned RegNo, uint64_t Address,
318221 const MCDisassembler *Decoder);
319222
@@ -629,3 +532,51 @@ static DecodeStatus DecodeBranchConditionAlways(MCInst &MI, uint64_t insn,
629532 // Decode MEMri.
630533 return DecodeAS (MI, insn, Address, Decoder);
631534}
535+
536+ #include " VEGenDisassemblerTables.inc"
537+
538+ // / Read four bytes from the ArrayRef and return 32 bit word.
539+ static DecodeStatus readInstruction64 (ArrayRef<uint8_t > Bytes, uint64_t Address,
540+ uint64_t &Size, uint64_t &Insn,
541+ bool IsLittleEndian) {
542+ // We want to read exactly 8 Bytes of data.
543+ if (Bytes.size () < 8 ) {
544+ Size = 0 ;
545+ return MCDisassembler::Fail;
546+ }
547+
548+ Insn = IsLittleEndian
549+ ? ((uint64_t )Bytes[0 ] << 0 ) | ((uint64_t )Bytes[1 ] << 8 ) |
550+ ((uint64_t )Bytes[2 ] << 16 ) | ((uint64_t )Bytes[3 ] << 24 ) |
551+ ((uint64_t )Bytes[4 ] << 32 ) | ((uint64_t )Bytes[5 ] << 40 ) |
552+ ((uint64_t )Bytes[6 ] << 48 ) | ((uint64_t )Bytes[7 ] << 56 )
553+ : ((uint64_t )Bytes[7 ] << 0 ) | ((uint64_t )Bytes[6 ] << 8 ) |
554+ ((uint64_t )Bytes[5 ] << 16 ) | ((uint64_t )Bytes[4 ] << 24 ) |
555+ ((uint64_t )Bytes[3 ] << 32 ) | ((uint64_t )Bytes[2 ] << 40 ) |
556+ ((uint64_t )Bytes[1 ] << 48 ) | ((uint64_t )Bytes[0 ] << 56 );
557+
558+ return MCDisassembler::Success;
559+ }
560+
561+ DecodeStatus VEDisassembler::getInstruction (MCInst &Instr, uint64_t &Size,
562+ ArrayRef<uint8_t > Bytes,
563+ uint64_t Address,
564+ raw_ostream &CStream) const {
565+ uint64_t Insn;
566+ bool isLittleEndian = getContext ().getAsmInfo ()->isLittleEndian ();
567+ DecodeStatus Result =
568+ readInstruction64 (Bytes, Address, Size, Insn, isLittleEndian);
569+ if (Result == MCDisassembler::Fail)
570+ return MCDisassembler::Fail;
571+
572+ // Calling the auto-generated decoder function.
573+
574+ Result = decodeInstruction (DecoderTableVE64, Instr, Insn, Address, this , STI);
575+
576+ if (Result != MCDisassembler::Fail) {
577+ Size = 8 ;
578+ return Result;
579+ }
580+
581+ return MCDisassembler::Fail;
582+ }
0 commit comments