The new isel passes all tests, time to start making it go fast.
authorChris Lattner <sabre@nondot.org>
Wed, 24 Feb 2010 07:06:50 +0000 (07:06 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 24 Feb 2010 07:06:50 +0000 (07:06 +0000)
Also add an easy macro at the top of DAGISelEmitter.cpp to enable
it.  Lets see if I can avoid accidentally turning it on :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97029 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/CMakeLists.txt
utils/TableGen/DAGISelEmitter.cpp
utils/TableGen/DAGISelMatcher.h
utils/TableGen/DAGISelMatcherOpt.cpp [new file with mode: 0644]

index a2678a29f7057a54c478b47351e6d6388c133d7e..881b50a01faf150373ec614e0a0f29f82fb39195 100644 (file)
@@ -11,6 +11,7 @@ add_executable(tblgen
   DAGISelEmitter.cpp
   DAGISelMatcherEmitter.cpp
   DAGISelMatcherGen.cpp
+  DAGISelMatcherOpt.cpp
   DAGISelMatcher.cpp
   DisassemblerEmitter.cpp
   EDEmitter.cpp
index b9ef3da5cac4030d06dab4c079af1e1127357d9c..2d2ab3e707ef1cb94bc5e2020366c51900a28bcc 100644 (file)
@@ -24,6 +24,9 @@
 #include <iostream>
 using namespace llvm;
 
+//#define ENABLE_NEW_ISEL
+
+
 static cl::opt<bool>
 GenDebug("gen-debug", cl::desc("Generate debug code"), cl::init(false));
 
@@ -1791,6 +1794,9 @@ void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) {
   
   OS << "// The main instruction selector code.\n"
      << "SDNode *SelectCode(SDNode *N) {\n"
+#ifdef ENABLE_NEW_ISEL
+     << "  return SelectCode2(N);\n"
+#endif
      << "  MVT::SimpleValueType NVT = N->getValueType(0).getSimpleVT().SimpleTy;\n"
      << "  switch (N->getOpcode()) {\n"
      << "  default:\n"
@@ -1946,7 +1952,7 @@ void DAGISelEmitter::run(raw_ostream &OS) {
   // definitions.  Emit the resultant instruction selector.
   EmitInstructionSelector(OS);  
   
-#if 0
+#ifdef ENABLE_NEW_ISEL
   MatcherNode *Matcher = 0;
 
   // Add all the patterns to a temporary list so we can sort them.
@@ -1977,7 +1983,7 @@ void DAGISelEmitter::run(raw_ostream &OS) {
       Matcher = new PushMatcherNode(N, Matcher);
   }
 
-  // OptimizeMatcher(Matcher);
+  OptimizeMatcher(Matcher);
   //Matcher->dump();
   EmitMatcherTable(Matcher, OS);
   delete Matcher;
index 469a2807ff9d67e6eb774fb2a604751521ec43c6..4dcbc8f55fc20ec828e41a6cd7d6cf156964cc56 100644 (file)
@@ -26,7 +26,7 @@ namespace llvm {
 
 MatcherNode *ConvertPatternToMatcher(const PatternToMatch &Pattern,
                                      const CodeGenDAGPatterns &CGP);
-
+void OptimizeMatcher(const MatcherNode *Matcher);
 void EmitMatcherTable(const MatcherNode *Matcher, raw_ostream &OS);
 
   
diff --git a/utils/TableGen/DAGISelMatcherOpt.cpp b/utils/TableGen/DAGISelMatcherOpt.cpp
new file mode 100644 (file)
index 0000000..7859f36
--- /dev/null
@@ -0,0 +1,19 @@
+//===- DAGISelMatcherOpt.cpp - Optimize a DAG Matcher ---------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the DAG Matcher optimizer.
+//
+//===----------------------------------------------------------------------===//
+
+#include "DAGISelMatcher.h"
+using namespace llvm;
+
+void llvm::OptimizeMatcher(const MatcherNode *Matcher) {
+  // Nothing yet.
+}