Index: lib/Target/PNaCl/PNaClTargetMachine.cpp |
=================================================================== |
--- lib/Target/PNaCl/PNaClTargetMachine.cpp (revision 0) |
+++ lib/Target/PNaCl/PNaClTargetMachine.cpp (revision 0) |
@@ -0,0 +1,51 @@ |
+//===-- PNaClTargetMachine.cpp - Define TargetMachine for PNaCl -----------===// |
+// |
+// The LLVM Compiler Infrastructure |
+// |
+// This file is distributed under the University of Illinois Open Source |
+// License. See LICENSE.TXT for details. |
+// |
+//===----------------------------------------------------------------------===// |
+// |
+// |
+//===----------------------------------------------------------------------===// |
+ |
+#include "PNaCl.h" |
+#include "PNaClTargetMachine.h" |
+#include "llvm/PassManager.h" |
+#include "llvm/Support/FormattedStream.h" |
+#include "llvm/Support/TargetRegistry.h" |
+using namespace llvm; |
+ |
+extern "C" void LLVMInitializePNaClTarget() { |
+ // HACK: this code is needed to claim using at least one symbol |
+ // from libLLVMPNaClDesc to help to inlude this dependency into |
+ // LibDeps.txt, because it's implicitly implied by llc and Clang. |
+ long long a = (long long)(void*)&ThePNaClTarget; |
+ if (a*a < 1) { |
+ LLVMInitializePNaClTargetMC(); |
+ } |
+ // Register the target. |
+ RegisterTargetMachine<PNaClTargetMachine> X(ThePNaClTarget); |
+} |
+ |
+PNaClTargetMachine::PNaClTargetMachine(const Target &T, StringRef TT, |
+ StringRef CPU, StringRef FS, |
+ Reloc::Model RM, CodeModel::Model CM) |
+ : TargetMachine(T, TT, CPU, FS), |
+ DataLayout("e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-" |
+ "f64:64:64-p:32:32:32") { |
+ AsmInfo = T.createMCAsmInfo(TT); |
+} |
+ |
+//===----------------------------------------------------------------------===// |
+// External Interface declaration |
+//===----------------------------------------------------------------------===// |
+ |
+bool PNaClTargetMachine::addPassesToEmitFile(PassManagerBase &PM, |
+ formatted_raw_ostream &o, |
+ CodeGenFileType FileType, |
+ CodeGenOpt::Level OptLevel, |
+ bool DisableVerify) { |
+ return true; |
+} |