summaryrefslogtreecommitdiff
path: root/opcodes/aarch64-asm.c
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2018-10-03 18:51:11 +0100
committerTamar Christina <tamar.christina@arm.com>2018-10-03 18:51:58 +0100
commitbde90be2cddc06371ee80a258bf6855d0f346324 (patch)
tree21c071ccc885044550b711ab68eec36041193365 /opcodes/aarch64-asm.c
parent4f5d2536289c0aedc3234f1bff6e9f4284f267c5 (diff)
downloadbinutils-gdb-bde90be2cddc06371ee80a258bf6855d0f346324.tar.gz
AArch64: Constraint disassembler and assembler changes.
This patch wires in the new constraint verifiers into the assembler and disassembler. Because of this the MOVPRFX tests have to be split out from the generic SVE tests into their own tests so warnings can be ignored. These tests are only intended to test the encoding correctness and not the constraints. gas/ * testsuite/gas/aarch64/sve-movprfx.d: New test. * testsuite/gas/aarch64/sve-movprfx.s: New test. * testsuite/gas/aarch64/sve.d: Refactor. * testsuite/gas/aarch64/sve.s: Refactor. * testsuite/gas/aarch64/sysreg-diagnostic.d: Update. opcodes/ * aarch64-asm.c (aarch64_opcode_encode): Apply constraint verifier. * aarch64-dis.c (print_operands): Refactor to take notes. (print_verifier_notes): New. (print_aarch64_insn): Apply constraint verifier. (print_insn_aarch64_word): Update call to print_aarch64_insn. * aarch64-opc.c (aarch64_print_operand): Remove attribute, update notes format.
Diffstat (limited to 'opcodes/aarch64-asm.c')
-rw-r--r--opcodes/aarch64-asm.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/opcodes/aarch64-asm.c b/opcodes/aarch64-asm.c
index 35704cde1fe..b865d50d01a 100644
--- a/opcodes/aarch64-asm.c
+++ b/opcodes/aarch64-asm.c
@@ -1949,7 +1949,7 @@ aarch64_opcode_encode (const aarch64_opcode *opcode,
const aarch64_inst *inst_ori, aarch64_insn *code,
aarch64_opnd_qualifier_t *qlf_seq,
aarch64_operand_error *mismatch_detail,
- aarch64_instr_sequence* insn_sequence ATTRIBUTE_UNUSED)
+ aarch64_instr_sequence* insn_sequence)
{
int i;
const aarch64_opcode *aliased;
@@ -2036,6 +2036,38 @@ aarch64_opcode_encode (const aarch64_opcode *opcode,
variant. */
aarch64_encode_variant_using_iclass (inst);
+ /* Run a verifier if the instruction has one set. */
+ if (opcode->verifier)
+ {
+ enum err_type result = opcode->verifier (inst, *code, 0, TRUE,
+ mismatch_detail, insn_sequence);
+ switch (result)
+ {
+ case ERR_UND:
+ case ERR_UNP:
+ case ERR_NYI:
+ return FALSE;
+ default:
+ break;
+ }
+ }
+
+ /* Always run constrain verifiers, this is needed because constrains need to
+ maintain a global state. Regardless if the instruction has the flag set
+ or not. */
+ enum err_type result = verify_constraints (inst, *code, 0, TRUE,
+ mismatch_detail, insn_sequence);
+ switch (result)
+ {
+ case ERR_UND:
+ case ERR_UNP:
+ case ERR_NYI:
+ return FALSE;
+ default:
+ break;
+ }
+
+
encoding_exit:
DEBUG_TRACE ("exit with %s", opcode->name);