OSDN Git Service

[TableGen] Better error checking for TIED_TO constraints.
authorSimon Tatham <simon.tatham@arm.com>
Wed, 28 Nov 2018 11:43:49 +0000 (11:43 +0000)
committerSimon Tatham <simon.tatham@arm.com>
Wed, 28 Nov 2018 11:43:49 +0000 (11:43 +0000)
commit4b88badbb0cef7166548f45b153c71e877131a18
tree431d96f544596c7ad902fdbd802f5d23bae21c93
parent1fff1694a6539f2d5daf183f3b606063499fc99a
[TableGen] Better error checking for TIED_TO constraints.

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.

Reviewers: fhahn, lhames, nhaehnle, MatzeB

Reviewed By: MatzeB

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347743 91177308-0d34-0410-b5e6-96231b3b80d8
test/TableGen/ConstraintChecking.inc [new file with mode: 0644]
test/TableGen/ConstraintChecking1.td [new file with mode: 0644]
test/TableGen/ConstraintChecking2.td [new file with mode: 0644]
test/TableGen/ConstraintChecking3.td [new file with mode: 0644]
test/TableGen/ConstraintChecking4.td [new file with mode: 0644]
test/TableGen/ConstraintChecking5.td [new file with mode: 0644]
test/TableGen/ConstraintChecking6.td [new file with mode: 0644]
test/TableGen/ConstraintChecking7.td [new file with mode: 0644]
utils/TableGen/CodeGenInstruction.cpp
utils/TableGen/CodeGenInstruction.h