OSDN Git Service

[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)
commit3372396f7080f9ea0c335dab0441c65a39a048f1
tree4f8740fea293656a16038ebb4685b3f008f75c6a
parentf100a5dc31e462f95d93680313d8f166edde8509
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331755 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AArch64/AArch64InstrFormats.td
lib/Target/AArch64/AArch64InstrInfo.td
lib/Target/AArch64/AArch64RegisterInfo.td
test/MC/AArch64/basic-a64-diagnostics.s