Let tblgen only generate fastisel routines, not the class definition. This makes it easier for targets to define its own fastisel class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55679 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86FastISel.cpp b/lib/Target/X86/X86FastISel.cpp
index 34d8418..5b825c2 100644
--- a/lib/Target/X86/X86FastISel.cpp
+++ b/lib/Target/X86/X86FastISel.cpp
@@ -16,17 +16,31 @@
 #include "X86.h"
 #include "X86RegisterInfo.h"
 #include "X86ISelLowering.h"
-#include "X86FastISel.h"
 #include "X86TargetMachine.h"
+#include "llvm/CodeGen/FastISel.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
+
+using namespace llvm;
+
+class X86FastISel : public FastISel {
+  /// Subtarget - Keep a pointer to the X86Subtarget around so that we can
+  /// make the right decision when generating code for different targets.
+  const X86Subtarget *Subtarget;
+    
+ public:
+  explicit X86FastISel(MachineFunction &mf) : FastISel(mf) {}
+
+  virtual bool
+    TargetSelectInstruction(Instruction *I,
+                            DenseMap<const Value *, unsigned> &ValueMap,
+                      DenseMap<const BasicBlock *, MachineBasicBlock *> &MBBMap,
+                            MachineBasicBlock *MBB);
+
 #include "X86GenFastISel.inc"
-
-namespace llvm {
-
-namespace X86 {
+};
 
 bool
-FastISel::TargetSelectInstruction(Instruction *I,
+X86FastISel::TargetSelectInstruction(Instruction *I,
                                   DenseMap<const Value *, unsigned> &ValueMap,
                       DenseMap<const BasicBlock *, MachineBasicBlock *> &MBBMap,
                                   MachineBasicBlock *MBB)  {
@@ -37,6 +51,8 @@
   return false;
 }
 
-}
-
+namespace llvm {
+  llvm::FastISel *X86::createFastISel(MachineFunction &mf) {
+    return new X86FastISel(mf);
+  }
 }
diff --git a/lib/Target/X86/X86FastISel.h b/lib/Target/X86/X86FastISel.h
deleted file mode 100644
index 56dfc4f..0000000
--- a/lib/Target/X86/X86FastISel.h
+++ /dev/null
@@ -1,31 +0,0 @@
-//===-- X86FastISel.h - X86 FastISel header -------------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the interface to the X86-specific support for the FastISel
-// class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef X86FASTISEL_H
-#define X86FASTISEL_H
-
-namespace llvm {
-
-class FastISel;
-class MachineFunction;
-
-namespace X86 {
-
-FastISel *createFastISel(MachineFunction &mf);
-
-} // namespace X86
-
-} // namespace llvm
-
-#endif
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index 791adb1..dceed6f 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/lib/Target/X86/X86ISelLowering.cpp
@@ -17,7 +17,6 @@
 #include "X86ISelLowering.h"
 #include "X86MachineFunctionInfo.h"
 #include "X86TargetMachine.h"
-#include "X86FastISel.h"
 #include "llvm/CallingConv.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
diff --git a/lib/Target/X86/X86ISelLowering.h b/lib/Target/X86/X86ISelLowering.h
index c35cce2..b98532f 100644
--- a/lib/Target/X86/X86ISelLowering.h
+++ b/lib/Target/X86/X86ISelLowering.h
@@ -19,6 +19,7 @@
 #include "X86RegisterInfo.h"
 #include "X86MachineFunctionInfo.h"
 #include "llvm/Target/TargetLowering.h"
+#include "llvm/CodeGen/FastIsel.h"
 #include "llvm/CodeGen/SelectionDAG.h"
 #include "llvm/CodeGen/CallingConvLower.h"
 
@@ -595,6 +596,10 @@
                                                           MachineBasicBlock *BB,
                                                           unsigned cmovOpc);
   };
+
+  namespace X86 {
+    FastISel *createFastISel(MachineFunction &mf);
+  }
 }
 
 #endif    // X86ISELLOWERING_H