Add the exit instruction to the PTX target.

Patch by Che-Liang Chiou <clchiou@gmail.com>!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114294 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PTX/PTXTargetMachine.cpp b/lib/Target/PTX/PTXTargetMachine.cpp
index 1889df4..1e846e5 100644
--- a/lib/Target/PTX/PTXTargetMachine.cpp
+++ b/lib/Target/PTX/PTXTargetMachine.cpp
@@ -12,20 +12,32 @@
 //===----------------------------------------------------------------------===//
 
 #include "PTX.h"
+#include "PTXMCAsmInfo.h"
 #include "PTXTargetMachine.h"
+#include "llvm/PassManager.h"
 #include "llvm/Target/TargetRegistry.h"
 
 using namespace llvm;
 
-extern "C" void LLVMInitializePTXTarget()
-{
-  // Register the target
+extern "C" void LLVMInitializePTXTarget() {
   RegisterTargetMachine<PTXTargetMachine> X(ThePTXTarget);
+  RegisterAsmInfo<PTXMCAsmInfo> Y(ThePTXTarget);
 }
 
+// DataLayout and FrameInfo are filled with dummy data
 PTXTargetMachine::PTXTargetMachine(const Target &T,
                                    const std::string &TT,
-                                   const std::string &FS) :
-  LLVMTargetMachine(T, TT)
-{
+                                   const std::string &FS)
+  : LLVMTargetMachine(T, TT),
+    DataLayout("e-p:32:32-i64:32:32-f64:32:32-v128:32:128-v64:32:64-n32:64"),
+    FrameInfo(TargetFrameInfo::StackGrowsDown, 2, -2),
+    InstrInfo(*this),
+    TLInfo(*this),
+    Subtarget(TT, FS) {
+}
+
+bool PTXTargetMachine::addInstSelector(PassManagerBase &PM,
+                                       CodeGenOpt::Level OptLevel) {
+  PM.add(createPTXISelDag(*this, OptLevel));
+  return false;
 }