mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
check that there are no unexpected operands
llvm-svn: 23359
This commit is contained in:
parent
9c196b02fa
commit
f749a0ef7c
@ -803,21 +803,29 @@ void DAGISelEmitter::ParseAndResolveInstructions() {
|
|||||||
InstResults.erase(OpName);
|
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) {
|
for (unsigned i = NumResults, e = CGI.OperandList.size(); i != e; ++i) {
|
||||||
const std::string &OpName = CGI.OperandList[i].Name;
|
const std::string &OpName = CGI.OperandList[i].Name;
|
||||||
if (OpName.empty())
|
if (OpName.empty())
|
||||||
I->error("Operand #" + utostr(i) + " in operands list has no name!");
|
I->error("Operand #" + utostr(i) + " in operands list has no name!");
|
||||||
|
|
||||||
if (!InstInputs.count(OpName))
|
if (!InstInputsCheck.count(OpName))
|
||||||
I->error("Operand $" + OpName +
|
I->error("Operand $" + OpName +
|
||||||
" does not appear in the instruction pattern");
|
" 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())
|
if (CGI.OperandList[i].Ty != InVal->getType())
|
||||||
I->error("Operand $" + OpName +
|
I->error("Operand $" + OpName +
|
||||||
"'s type disagrees between the operand and pattern");
|
"'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;
|
unsigned NumOperands = CGI.OperandList.size()-NumResults;
|
||||||
|
|
||||||
DEBUG(I->dump());
|
DEBUG(I->dump());
|
||||||
|
Loading…
Reference in New Issue
Block a user