llvm.org GIT mirror llvm / f106d17
ARMDisassembler: loop over ARM decode tables Loop over the ARM decode tables; this is a clean-up to reduce some code duplication. Differential Revision: https://reviews.llvm.org/D30814 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297608 91177308-0d34-0410-b5e6-96231b3b80d8 Sjoerd Meijer 3 years ago
1 changed file(s) with 22 addition(s) and 59 deletion(s). Raw diff Collapse all Expand all
461461 return checkDecodedInstruction(MI, Size, Address, OS, CS, Insn, Result);
462462 }
463463
464 // VFP and NEON instructions, similarly, are shared between ARM
465 // and Thumb modes.
466 Result = decodeInstruction(DecoderTableVFP32, MI, Insn, Address, this, STI);
467 if (Result != MCDisassembler::Fail) {
468 Size = 4;
469 return Result;
470 }
471
472 Result = decodeInstruction(DecoderTableVFPV832, MI, Insn, Address, this, STI);
473 if (Result != MCDisassembler::Fail) {
474 Size = 4;
475 return Result;
476 }
477
478 Result =
479 decodeInstruction(DecoderTableNEONData32, MI, Insn, Address, this, STI);
480 if (Result != MCDisassembler::Fail) {
481 Size = 4;
482 // Add a fake predicate operand, because we share these instruction
483 // definitions with Thumb2 where these instructions are predicable.
484 if (!DecodePredicateOperand(MI, 0xE, Address, this))
485 return MCDisassembler::Fail;
486 return Result;
487 }
488
489 Result = decodeInstruction(DecoderTableNEONLoadStore32, MI, Insn, Address,
490 this, STI);
491 if (Result != MCDisassembler::Fail) {
492 Size = 4;
493 // Add a fake predicate operand, because we share these instruction
494 // definitions with Thumb2 where these instructions are predicable.
495 if (!DecodePredicateOperand(MI, 0xE, Address, this))
496 return MCDisassembler::Fail;
497 return Result;
498 }
499
500 Result =
501 decodeInstruction(DecoderTableNEONDup32, MI, Insn, Address, this, STI);
502 if (Result != MCDisassembler::Fail) {
503 Size = 4;
504 // Add a fake predicate operand, because we share these instruction
505 // definitions with Thumb2 where these instructions are predicable.
506 if (!DecodePredicateOperand(MI, 0xE, Address, this))
507 return MCDisassembler::Fail;
508 return Result;
509 }
510
511 Result =
512 decodeInstruction(DecoderTablev8NEON32, MI, Insn, Address, this, STI);
513 if (Result != MCDisassembler::Fail) {
514 Size = 4;
515 return Result;
516 }
517
518 Result =
519 decodeInstruction(DecoderTablev8Crypto32, MI, Insn, Address, this, STI);
520 if (Result != MCDisassembler::Fail) {
521 Size = 4;
522 return Result;
464 struct DecodeTable {
465 const uint8_t *P;
466 bool DecodePred;
467 };
468
469 const DecodeTable Tables[] = {
470 {DecoderTableVFP32, false}, {DecoderTableVFPV832, false},
471 {DecoderTableNEONData32, true}, {DecoderTableNEONLoadStore32, true},
472 {DecoderTableNEONDup32, true}, {DecoderTablev8NEON32, false},
473 {DecoderTablev8Crypto32, false},
474 };
475
476 for (auto Table : Tables) {
477 Result = decodeInstruction(Table.P, MI, Insn, Address, this, STI);
478 if (Result != MCDisassembler::Fail) {
479 Size = 4;
480 // Add a fake predicate operand, because we share these instruction
481 // definitions with Thumb2 where these instructions are predicable.
482 if (Table.DecodePred && !DecodePredicateOperand(MI, 0xE, Address, this))
483 return MCDisassembler::Fail;
484 return Result;
485 }
523486 }
524487
525488 Size = 0;