summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-09-14 21:59:34 +0000
committerChris Lattner <sabre@nondot.org>2005-09-14 21:59:34 +0000
commit030f876cf2b3eb17cba8c5f4b7fc569e7eb391d8 (patch)
treeec43261e0b2abc4471ad404afb60f5636c339bae /llvm
parent3ced3f8b82822571657b00d5e2701dccbe2015cf (diff)
downloadbcm5719-llvm-030f876cf2b3eb17cba8c5f4b7fc569e7eb391d8.tar.gz
bcm5719-llvm-030f876cf2b3eb17cba8c5f4b7fc569e7eb391d8.zip
check that there are no unexpected operands
llvm-svn: 23359
Diffstat (limited to 'llvm')
-rw-r--r--llvm/utils/TableGen/DAGISelEmitter.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/utils/TableGen/DAGISelEmitter.cpp b/llvm/utils/TableGen/DAGISelEmitter.cpp
index 085f7d2dae5..d83faceaee8 100644
--- a/llvm/utils/TableGen/DAGISelEmitter.cpp
+++ b/llvm/utils/TableGen/DAGISelEmitter.cpp
@@ -803,21 +803,29 @@ void DAGISelEmitter::ParseAndResolveInstructions() {
InstResults.erase(OpName);
}
- // Loop over the inputs next.
+ // Loop over the inputs next. Make a copy of InstInputs so we can destroy
+ // the copy while we're checking the inputs.
+ std::map<std::string, TreePatternNode*> InstInputsCheck(InstInputs);
+
for (unsigned i = NumResults, e = CGI.OperandList.size(); i != e; ++i) {
const std::string &OpName = CGI.OperandList[i].Name;
if (OpName.empty())
I->error("Operand #" + utostr(i) + " in operands list has no name!");
- if (!InstInputs.count(OpName))
+ if (!InstInputsCheck.count(OpName))
I->error("Operand $" + OpName +
" does not appear in the instruction pattern");
- TreePatternNode *InVal = InstInputs[OpName];
+ TreePatternNode *InVal = InstInputsCheck[OpName];
+ InstInputsCheck.erase(OpName);
if (CGI.OperandList[i].Ty != InVal->getType())
I->error("Operand $" + OpName +
"'s type disagrees between the operand and pattern");
}
+ if (!InstInputsCheck.empty())
+ I->error("Input operand $" + InstInputsCheck.begin()->first +
+ " occurs in pattern but not in operands list!");
+
unsigned NumOperands = CGI.OperandList.size()-NumResults;
DEBUG(I->dump());
OpenPOWER on IntegriCloud