add support for an associative marker

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23502 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-09-28 20:58:06 +00:00
parent e97603f1bd
commit 7cf2fe6c48
2 changed files with 7 additions and 5 deletions

View File

@ -145,6 +145,8 @@ SDNodeInfo::SDNodeInfo(Record *R) : Def(R) {
assert(DI && "Properties list must be list of defs!"); assert(DI && "Properties list must be list of defs!");
if (DI->getDef()->getName() == "SDNPCommutative") { if (DI->getDef()->getName() == "SDNPCommutative") {
Properties |= 1 << SDNPCommutative; Properties |= 1 << SDNPCommutative;
} else if (DI->getDef()->getName() == "SDNPAssociative") {
Properties |= 1 << SDNPAssociative;
} else { } else {
std::cerr << "Unknown SD Node property '" << DI->getDef()->getName() std::cerr << "Unknown SD Node property '" << DI->getDef()->getName()
<< "' on node '" << R->getName() << "'!\n"; << "' on node '" << R->getName() << "'!\n";
@ -377,7 +379,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP) {
/// used as a santity check for .td files (to prevent people from writing stuff /// used as a santity check for .td files (to prevent people from writing stuff
/// that can never possibly work), and to prevent the pattern permuter from /// that can never possibly work), and to prevent the pattern permuter from
/// generating stuff that is useless. /// generating stuff that is useless.
bool TreePatternNode::canPatternMatch(std::string &Reason, DAGISelEmitter &ISE) { bool TreePatternNode::canPatternMatch(std::string &Reason, DAGISelEmitter &ISE){
if (isLeaf()) return true; if (isLeaf()) return true;
for (unsigned i = 0, e = getNumChildren(); i != e; ++i) for (unsigned i = 0, e = getNumChildren(); i != e; ++i)
@ -1052,9 +1054,9 @@ void DAGISelEmitter::ParsePatterns() {
// GenerateVariants - Generate variants. For example, commutative patterns can // GenerateVariants - Generate variants. For example, commutative patterns can
// match multiple ways. Add them to PatternsToMatch as well. // match multiple ways. Add them to PatternsToMatch as well.
void DAGISelEmitter::GenerateVariants() { void DAGISelEmitter::GenerateVariants() {
} }
/// getPatternSize - Return the 'size' of this pattern. We want to match large /// getPatternSize - Return the 'size' of this pattern. We want to match large
/// patterns before small ones. This is used to determine the size of a /// patterns before small ones. This is used to determine the size of a
/// pattern. /// pattern.

View File

@ -87,7 +87,7 @@ namespace llvm {
} }
// SelectionDAG node properties. // SelectionDAG node properties.
enum SDNP { SDNPCommutative }; enum SDNP { SDNPCommutative, SDNPAssociative };
/// hasProperty - Return true if this node has the specified property. /// hasProperty - Return true if this node has the specified property.
/// ///
@ -205,8 +205,8 @@ namespace llvm {
return false; return false;
} }
/// canPatternMatch - Return false if it is impossible for this pattern to /// canPatternMatch - If it is impossible for this pattern to match on this
/// match on this target. /// target, fill in Reason and return false. Otherwise, return true.
bool canPatternMatch(std::string &Reason, DAGISelEmitter &ISE); bool canPatternMatch(std::string &Reason, DAGISelEmitter &ISE);
}; };