[PATCH] D71494: [SystemZ] Improve verification of MachineOperands.

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 15:00:00 PST 2019


jonpa created this revision.
jonpa added a reviewer: uweigand.
Herald added subscribers: llvm-commits, dmgreen, hiraditya.
Herald added a project: LLVM.

Now that the machine verifier will check for cases of register/immediate MachineOperands and their correspondence to the MC instruction descriptor, this patch adds the operand types to the descriptors where they were previously missing. All MCOI::OPERAND_UNKNOWN operand types have been handled to get a known type, except for G_... (global isel) instructions.

This involves:

- Immediate operands becoming MCOI::OPERAND_IMMEDIATE
- Addressing modes, which due to the complex Tablegen modelling already present now get MCOI::OPERAND_MEMORY as their type. All the addressing mode individual operands (registers and displacements) get this type, so their consistency with the actual built MachineOperand objects must be checked in SystemZInstrInfo::verifyInstruction(). It would have been nice to instead directly give the types MCOI::OPERAND_REGISTER and MCOI_OPERAND_IMMEDIATE, but I did not manage to do so.
- PC-relative operands get MCOI::OPERAND_PCREL.

(In the test, the MVCLoop instruction with a register instead of imm64 causes isImm() to trigger an assert on trunk, but the test checks that this is caught by the Machine verifier with the patch.)


https://reviews.llvm.org/D71494

Files:
  llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
  llvm/lib/Target/SystemZ/SystemZInstrInfo.h
  llvm/lib/Target/SystemZ/SystemZOperands.td
  llvm/test/CodeGen/SystemZ/mverify-optypes.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71494.233885.patch
Type: text/x-patch
Size: 7014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191213/f82c825a/attachment.bin>


More information about the llvm-commits mailing list