This is an archive of the discontinued LLVM Phabricator instance.

[SystemZ] Improve verification of MachineOperands.
ClosedPublic

Authored by jonpa on Dec 13 2019, 2:53 PM.

Details

Reviewers
uweigand
Summary

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.)

Diff Detail

Event Timeline

jonpa created this revision.Dec 13 2019, 2:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 13 2019, 2:53 PM
uweigand accepted this revision.Dec 16 2019, 4:16 AM

LGTM, thanks!

This revision is now accepted and ready to land.Dec 16 2019, 4:16 AM