Allow ComplexExpressions in InstrInfo.td files to be slightly more... complex! ComplexExpressions can now have attributes which affect how TableGen interprets

the pattern when generating matchin code. 

The first (and currently, only) attribute causes the immediate parent node of the ComplexPattern operand to be passed into the matching code rather than the node at the root of the entire DAG containing the pattern.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46606 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Christopher Lamb
2008-01-31 07:27:46 +00:00
parent 175e81598a
commit 8535624739
4 changed files with 37 additions and 7 deletions

View File

@@ -351,6 +351,18 @@ ComplexPattern::ComplexPattern(Record *R) {
<< "' on ComplexPattern '" << R->getName() << "'!\n";
exit(1);
}
// Parse the attributes.
Attributes = 0;
PropList = R->getValueAsListOfDefs("Attributes");
for (unsigned i = 0, e = PropList.size(); i != e; ++i)
if (PropList[i]->getName() == "CPAttrParentAsRoot") {
Attributes |= 1 << CPAttrParentAsRoot;
} else {
cerr << "Unsupported pattern attribute '" << PropList[i]->getName()
<< "' on ComplexPattern '" << R->getName() << "'!\n";
exit(1);
}
}
//===----------------------------------------------------------------------===//