diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-12-20 19:36:28 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-12-20 19:36:28 +0000 |
commit | 303327d58bc1d115cfa81d632dfa443b20bec366 (patch) | |
tree | e6f1f484d723ccca6ac8ec689b3c941b0573016a /llvm/utils/TableGen/CodeGenDAGPatterns.cpp | |
parent | a40ce7bc3616d54f85d53dbb4c19b73d46068291 (diff) | |
download | bcm5719-llvm-303327d58bc1d115cfa81d632dfa443b20bec366.tar.gz bcm5719-llvm-303327d58bc1d115cfa81d632dfa443b20bec366.zip |
TableGen: Allow setting SDNodeProperties on intrinsics
Allows preserving MachineMemOperands on intrinsics
through selection. For reasons I don't understand, this
is a static property of the pattern and the selector
deliberately goes out of its way to drop if not present.
Intrinsics already inherit from SDPatternOperator allowing
them to be used directly in instruction patterns. SDPatternOperator
has a list of SDNodeProperty, but you currently can't set them on
the intrinsic. Without SDNPMemOperand, when the node is selected
any memory operands are always dropped. Allowing setting this
on the intrinsics avoids needing to introduce another equivalent
target node just to have SDNPMemOperand set.
llvm-svn: 321212
Diffstat (limited to 'llvm/utils/TableGen/CodeGenDAGPatterns.cpp')
-rw-r--r-- | llvm/utils/TableGen/CodeGenDAGPatterns.cpp | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp index 51473f06da7..d23b45aab79 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp @@ -1591,37 +1591,7 @@ SDNodeInfo::SDNodeInfo(Record *R, const CodeGenHwModes &CGH) : Def(R) { NumOperands = TypeProfile->getValueAsInt("NumOperands"); // Parse the properties. - Properties = 0; - for (Record *Property : R->getValueAsListOfDefs("Properties")) { - if (Property->getName() == "SDNPCommutative") { - Properties |= 1 << SDNPCommutative; - } else if (Property->getName() == "SDNPAssociative") { - Properties |= 1 << SDNPAssociative; - } else if (Property->getName() == "SDNPHasChain") { - Properties |= 1 << SDNPHasChain; - } else if (Property->getName() == "SDNPOutGlue") { - Properties |= 1 << SDNPOutGlue; - } else if (Property->getName() == "SDNPInGlue") { - Properties |= 1 << SDNPInGlue; - } else if (Property->getName() == "SDNPOptInGlue") { - Properties |= 1 << SDNPOptInGlue; - } else if (Property->getName() == "SDNPMayStore") { - Properties |= 1 << SDNPMayStore; - } else if (Property->getName() == "SDNPMayLoad") { - Properties |= 1 << SDNPMayLoad; - } else if (Property->getName() == "SDNPSideEffect") { - Properties |= 1 << SDNPSideEffect; - } else if (Property->getName() == "SDNPMemOperand") { - Properties |= 1 << SDNPMemOperand; - } else if (Property->getName() == "SDNPVariadic") { - Properties |= 1 << SDNPVariadic; - } else { - PrintFatalError("Unknown SD Node property '" + - Property->getName() + "' on node '" + - R->getName() + "'!"); - } - } - + Properties = parseSDPatternOperatorProperties(R); // Parse the type constraints. std::vector<Record*> ConstraintList = @@ -2100,11 +2070,20 @@ bool TreePatternNode::NodeHasProperty(SDNP Property, if (isLeaf()) { if (const ComplexPattern *CP = getComplexPatternInfo(CGP)) return CP->hasProperty(Property); + return false; } - Record *Operator = getOperator(); - if (!Operator->isSubClassOf("SDNode")) return false; + if (Property != SDNPHasChain) { + // The chain proprety is already present on the different intrinsic node + // types (intrinsic_w_chain, intrinsic_void), and is not explicitly listed + // on the intrinsic. Anything else is specific to the individual intrinsic. + if (const CodeGenIntrinsic *Int = getIntrinsicInfo(CGP)) + return Int->hasProperty(Property); + } + + if (!Operator->isSubClassOf("SDPatternOperator")) + return false; return CGP.getSDNodeInfo(Operator).hasProperty(Property); } |