mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 21:32:39 +00:00
Try to include operand counts for mismatches in tablegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224068 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
29ae5b8a8c
commit
9dd31e8016
@ -1539,6 +1539,22 @@ static bool isOperandClass(const TreePatternNode *N, StringRef Class) {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void emitTooManyOperandsError(TreePattern &TP,
|
||||||
|
StringRef InstName,
|
||||||
|
unsigned Expected,
|
||||||
|
unsigned Actual) {
|
||||||
|
TP.error("Instruction '" + InstName + "' was provided " + Twine(Actual) +
|
||||||
|
" operands but expected only " + Twine(Expected) + "!");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void emitTooFewOperandsError(TreePattern &TP,
|
||||||
|
StringRef InstName,
|
||||||
|
unsigned Actual) {
|
||||||
|
TP.error("Instruction '" + InstName +
|
||||||
|
"' expects more than the provided " + Twine(Actual) + " operands!");
|
||||||
|
}
|
||||||
|
|
||||||
/// ApplyTypeConstraints - Apply all of the type constraints relevant to
|
/// ApplyTypeConstraints - Apply all of the type constraints relevant to
|
||||||
/// this node and its children in the tree. This returns true if it makes a
|
/// this node and its children in the tree. This returns true if it makes a
|
||||||
/// change, false otherwise. If a type contradiction is found, flag an error.
|
/// change, false otherwise. If a type contradiction is found, flag an error.
|
||||||
@ -1741,8 +1757,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
|
|||||||
|
|
||||||
// Verify that we didn't run out of provided operands.
|
// Verify that we didn't run out of provided operands.
|
||||||
if (ChildNo >= getNumChildren()) {
|
if (ChildNo >= getNumChildren()) {
|
||||||
TP.error("Instruction '" + getOperator()->getName() +
|
emitTooFewOperandsError(TP, getOperator()->getName(), getNumChildren());
|
||||||
"' expects more operands than were provided.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1766,8 +1781,8 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
|
|||||||
// And the remaining sub-operands against subsequent children.
|
// And the remaining sub-operands against subsequent children.
|
||||||
for (unsigned Arg = 1; Arg < NumArgs; ++Arg) {
|
for (unsigned Arg = 1; Arg < NumArgs; ++Arg) {
|
||||||
if (ChildNo >= getNumChildren()) {
|
if (ChildNo >= getNumChildren()) {
|
||||||
TP.error("Instruction '" + getOperator()->getName() +
|
emitTooFewOperandsError(TP, getOperator()->getName(),
|
||||||
"' expects more operands than were provided.");
|
getNumChildren());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Child = getChild(ChildNo++);
|
Child = getChild(ChildNo++);
|
||||||
@ -1787,8 +1802,8 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!InstInfo.Operands.isVariadic && ChildNo != getNumChildren()) {
|
if (!InstInfo.Operands.isVariadic && ChildNo != getNumChildren()) {
|
||||||
TP.error("Instruction '" + getOperator()->getName() +
|
emitTooManyOperandsError(TP, getOperator()->getName(),
|
||||||
"' was provided too many operands!");
|
ChildNo, getNumChildren());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user