NumResults = TypeProfile->getValueAsInt("NumResults");
NumOperands = TypeProfile->getValueAsInt("NumOperands");
+ // Parse the properties.
+ Properties = 0;
+ ListInit *LI = R->getValueAsListInit("Properties");
+ for (unsigned i = 0, e = LI->getSize(); i != e; ++i) {
+ DefInit *DI = dynamic_cast<DefInit*>(LI->getElement(i));
+ assert(DI && "Properties list must be list of defs!");
+ if (DI->getDef()->getName() == "SDNPCommutative") {
+ Properties |= 1 << SDNPCommutative;
+ } else {
+ std::cerr << "Unknown SD Node property '" << DI->getDef()->getName()
+ << "' on node '" << R->getName() << "'!\n";
+ exit(1);
+ }
+ }
+
+
// Parse the type constraints.
ListInit *Constraints = TypeProfile->getValueAsListInit("Constraints");
for (unsigned i = 0, e = Constraints->getSize(); i != e; ++i) {
Record *Def;
std::string EnumName;
std::string SDClassName;
+ unsigned Properties;
unsigned NumResults;
int NumOperands;
std::vector<SDTypeConstraint> TypeConstraints;
const std::vector<SDTypeConstraint> &getTypeConstraints() const {
return TypeConstraints;
}
+
+ // SelectionDAG node properties.
+ enum SDNP { SDNPCommutative };
+
+ /// hasProperty - Return true if this node has the specified property.
+ ///
+ bool hasProperty(enum SDNP Prop) const { return Properties & (1 << Prop); }
/// ApplyTypeConstraints - Given a node in a pattern, apply the type
/// constraints for this node to the operands of the node. This returns