[AArch64] Disallow vector operand if FPR128 Q register is required.
authorSander de Smalen <sander.desmalen@arm.com>
Tue, 8 May 2018 10:01:04 +0000 (10:01 +0000)
committerSander de Smalen <sander.desmalen@arm.com>
Tue, 8 May 2018 10:01:04 +0000 (10:01 +0000)
commit20eede7093eb828968731ed7becafe6fd91c6749
tree02bc631a23abf7af5b11ca6fb681174a6f56d05b
parent7563624fcba42032e95442bb4e8f439f5edf7669
[AArch64] Disallow vector operand if FPR128 Q register is required.

Patch https://reviews.llvm.org/D41445 changed the behaviour of 'isReg()'
to also return 'true' if the parsed register operand is a vector
register. Code in the AsmMatcher checks if a register is a subclass of the
expected register class. However, even though both parsed registers map
to the same physical register, the 'v' register is of kind 'NeonVector',
where 'q' is of type Scalar, where isSubclass() does not distinguish
between the two cases.

The solution is to use an AsmOperand instead of the register directly,
and use the PredicateMethod to distinguish the two operands.

This fixes for example:
  ldr v0, [x0]    // 'v0' is an invalid operand for this instruction
  ldr q0, [x0]    // valid

Reviewers: aemerson, Gerolf, SjoerdMeijer, javed.absar

Reviewed By: aemerson

Differential Revision: https://reviews.llvm.org/D46310

llvm-svn: 331755
llvm/lib/Target/AArch64/AArch64InstrFormats.td
llvm/lib/Target/AArch64/AArch64InstrInfo.td
llvm/lib/Target/AArch64/AArch64RegisterInfo.td
llvm/test/MC/AArch64/basic-a64-diagnostics.s