[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Sep 14 14:59:45 PDT 2005
Changes in directory llvm/utils/TableGen:
DAGISelEmitter.cpp updated: 1.22 -> 1.23
---
Log message:
check that there are no unexpected operands
---
Diffs of the changes: (+11 -3)
DAGISelEmitter.cpp | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.22 llvm/utils/TableGen/DAGISelEmitter.cpp:1.23
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.22 Wed Sep 14 16:13:50 2005
+++ llvm/utils/TableGen/DAGISelEmitter.cpp Wed Sep 14 16:59:34 2005
@@ -803,21 +803,29 @@
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());
More information about the llvm-commits
mailing list