X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2FTableGen%2FDAGISelMatcherOpt.cpp;h=c9ee371e3e2fe9fdc1a6a1482ec136d27798f62e;hb=47f0e3f434e2e43f951c3a826c40906cb15b7285;hp=e3f8b8f8242d196905021021b0c17f8e291a9681;hpb=095734c578c74f6d1b1fcbdc4d4264a059cdb9ee;p=oota-llvm.git diff --git a/utils/TableGen/DAGISelMatcherOpt.cpp b/utils/TableGen/DAGISelMatcherOpt.cpp index e3f8b8f8242..c9ee371e3e2 100644 --- a/utils/TableGen/DAGISelMatcherOpt.cpp +++ b/utils/TableGen/DAGISelMatcherOpt.cpp @@ -11,7 +11,6 @@ // //===----------------------------------------------------------------------===// -#define DEBUG_TYPE "isel-opt" #include "DAGISelMatcher.h" #include "CodeGenDAGPatterns.h" #include "llvm/ADT/DenseSet.h" @@ -20,6 +19,8 @@ #include "llvm/Support/raw_ostream.h" using namespace llvm; +#define DEBUG_TYPE "isel-opt" + /// ContractNodes - Turn multiple matcher node patterns like 'MoveChild+Record' /// into single compound nodes like RecordChild. static void ContractNodes(std::unique_ptr &MatcherPtr, @@ -184,7 +185,7 @@ static void ContractNodes(std::unique_ptr &MatcherPtr, /// Conceptually, we'd like to sink these predicates all the way to the last /// matcher predicate in the series. However, it turns out that some /// ComplexPatterns have side effects on the graph, so we really don't want to -/// run a the complex pattern if the pattern predicate will fail. For this +/// run a complex pattern if the pattern predicate will fail. For this /// reason, we refuse to sink the pattern predicate past a ComplexPattern. /// static void SinkPatternPredicates(std::unique_ptr &MatcherPtr) { @@ -399,7 +400,7 @@ static void FactorNodes(std::unique_ptr &MatcherPtr) { } if (NewOptionsToMatch.empty()) { - MatcherPtr.reset(nullptr); + MatcherPtr.reset(); return; } @@ -453,7 +454,7 @@ static void FactorNodes(std::unique_ptr &MatcherPtr) { SmallVector, 8> Cases; for (unsigned i = 0, e = NewOptionsToMatch.size(); i != e; ++i) { CheckOpcodeMatcher *COM = cast(NewOptionsToMatch[i]); - assert(Opcodes.insert(COM->getOpcode().getEnumName()) && + assert(Opcodes.insert(COM->getOpcode().getEnumName()).second && "Duplicate opcodes not factored?"); Cases.push_back(std::make_pair(&COM->getOpcode(), COM->getNext())); } @@ -510,11 +511,10 @@ static void FactorNodes(std::unique_ptr &MatcherPtr) { Scope->resetChild(i, NewOptionsToMatch[i]); } -Matcher *llvm::OptimizeMatcher(Matcher *TheMatcher, - const CodeGenDAGPatterns &CGP) { - std::unique_ptr MatcherPtr(TheMatcher); +void +llvm::OptimizeMatcher(std::unique_ptr &MatcherPtr, + const CodeGenDAGPatterns &CGP) { ContractNodes(MatcherPtr, CGP); SinkPatternPredicates(MatcherPtr); FactorNodes(MatcherPtr); - return MatcherPtr.release(); }