summaryrefslogtreecommitdiff
path: root/utils/TableGen/CodeGenDAGPatterns.h
diff options
context:
space:
mode:
authorScott Michel <scottm@aero.org>2008-03-05 17:49:05 +0000
committerScott Michel <scottm@aero.org>2008-03-05 17:49:05 +0000
commit327d0651f8c3b1480d8fc1f4d96e07a1452eaa8c (patch)
treec18217463b152fa5afa93ffe0df2ade7ac684580 /utils/TableGen/CodeGenDAGPatterns.h
parent4d93b2f16d66841f3338ffe2c1318fe6eeeef181 (diff)
downloadllvm-327d0651f8c3b1480d8fc1f4d96e07a1452eaa8c.tar.gz
llvm-327d0651f8c3b1480d8fc1f4d96e07a1452eaa8c.tar.bz2
llvm-327d0651f8c3b1480d8fc1f4d96e07a1452eaa8c.tar.xz
This patch fixes a problem encountered by the CellSPU backend where variants
were being pruned in patterns where a variable was used more than once, e.g.: (or (and R32C:$rA, R32C:$rC), (and R32C:$rB, (not R32C:$rC))) In this example, $rC is used more than once and is actually significant to instruction selection pattern matching when commuted variants are produced. This patch scans the pattern's clauses and collects the variables, creating a set of variables that are used more than once. TreePatternNode::isIsomorphicTo() also understands that multiply-used variables are significant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47950 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenDAGPatterns.h')
-rw-r--r--utils/TableGen/CodeGenDAGPatterns.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/utils/TableGen/CodeGenDAGPatterns.h b/utils/TableGen/CodeGenDAGPatterns.h
index 44c154a353..6000e551ec 100644
--- a/utils/TableGen/CodeGenDAGPatterns.h
+++ b/utils/TableGen/CodeGenDAGPatterns.h
@@ -15,6 +15,8 @@
#ifndef CODEGEN_DAGPATTERNS_H
#define CODEGEN_DAGPATTERNS_H
+#include <set>
+
#include "TableGenBackend.h"
#include "CodeGenTarget.h"
#include "CodeGenIntrinsics.h"
@@ -48,6 +50,9 @@ namespace MVT {
bool isExtFloatingPointInVTs(const std::vector<unsigned char> &EVTs);
}
+/// Set type used to track multiply used variables in patterns
+typedef std::set<std::string> MultipleUseVarSet;
+
/// SDTypeConstraint - This is a discriminated union of constraints,
/// corresponding to the SDTypeConstraint tablegen class in Target.td.
struct SDTypeConstraint {
@@ -231,7 +236,8 @@ public: // Higher level manipulation routines.
/// the specified node. For this comparison, all of the state of the node
/// is considered, except for the assigned name. Nodes with differing names
/// that are otherwise identical are considered isomorphic.
- bool isIsomorphicTo(const TreePatternNode *N) const;
+ bool isIsomorphicTo(const TreePatternNode *N,
+ const MultipleUseVarSet &DepVars) const;
/// SubstituteFormalArguments - Replace the formal arguments in this tree
/// with actual values specified by ArgMap.