[PATCH] D53815: [TableGen] Better error checking for TIED_TO constraints.

Simon Tatham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 29 07:09:06 PDT 2018


simon_tatham created this revision.
simon_tatham added reviewers: fhahn, lhames, nhaehnle.
Herald added a subscriber: llvm-commits.

There are quite strong constraints on how you can use the TIED_TO
constraint between MC operands, many of which are currently not
checked until compiler run time.

MachineVerifier enforces that operands can only be tied together in
pairs (no three-way ties), and MachineInstr::tieOperands enforces that
one of the tied operands must be an output operand (def) and the other
must be an input operand (use).

Now we check these at TableGen time, so that if you violate any of
them in a new instruction definition, you find out immediately,
instead of having to wait until you compile something that makes code
generation hit one of those assertions.

Also in this commit, all the error reports in ParseConstraint now
include the name and source location of the def where the problem
happened, so that if you do trigger any of these errors, it's easier
to find the part of your TableGen input where you made the mistake.

The trunk sources already build successfully with this additional
error check, so I think no in-tree target has any of these problems.


Repository:
  rL LLVM

https://reviews.llvm.org/D53815

Files:
  test/TableGen/ConstraintChecking.inc
  test/TableGen/ConstraintChecking1.td
  test/TableGen/ConstraintChecking2.td
  test/TableGen/ConstraintChecking3.td
  test/TableGen/ConstraintChecking4.td
  test/TableGen/ConstraintChecking5.td
  test/TableGen/ConstraintChecking6.td
  test/TableGen/ConstraintChecking7.td
  utils/TableGen/CodeGenInstruction.cpp
  utils/TableGen/CodeGenInstruction.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53815.171492.patch
Type: text/x-patch
Size: 10451 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181029/e3244ff7/attachment-0001.bin>


More information about the llvm-commits mailing list