| OLD | NEW |
| 1 //===-- JSTargetMachine.h - TargetMachine for the JS Backend ----*- C++ -*-===// | 1 //===-- JSTargetMachine.h - TargetMachine for the JS Backend ----*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===---------------------------------------------------------------------===// | 8 //===---------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file declares the TargetMachine that is used by the JS/asm.js/ | 10 // This file declares the TargetMachine that is used by the JS/asm.js/ |
| 11 // emscripten backend. | 11 // emscripten backend. |
| 12 // | 12 // |
| 13 //===---------------------------------------------------------------------===// | 13 //===---------------------------------------------------------------------===// |
| 14 | 14 |
| 15 #ifndef JSTARGETMACHINE_H | 15 #ifndef JSTARGETMACHINE_H |
| 16 #define JSTARGETMACHINE_H | 16 #define JSTARGETMACHINE_H |
| 17 | 17 |
| 18 #include "JS.h" | 18 #include "JS.h" |
| 19 #include "llvm/IR/DataLayout.h" | |
| 20 #include "llvm/Target/TargetMachine.h" | 19 #include "llvm/Target/TargetMachine.h" |
| 21 #include "llvm/Target/TargetSubtargetInfo.h" | |
| 22 | 20 |
| 23 namespace llvm { | 21 namespace llvm { |
| 24 | 22 |
| 25 class formatted_raw_ostream; | 23 class formatted_raw_ostream; |
| 26 | 24 |
| 27 class JSSubtarget : public TargetSubtargetInfo { | |
| 28 const DataLayout *DL; | |
| 29 public: | |
| 30 JSSubtarget(const DataLayout *DL_) : DL(DL_) {} | |
| 31 const DataLayout *getDataLayout() const override { return DL; } | |
| 32 }; | |
| 33 | |
| 34 class JSTargetMachine : public TargetMachine { | 25 class JSTargetMachine : public TargetMachine { |
| 35 const DataLayout DL; | |
| 36 JSSubtarget Subtarget; | |
| 37 | |
| 38 public: | 26 public: |
| 39 JSTargetMachine(const Target &T, StringRef Triple, | 27 JSTargetMachine(const Target &T, StringRef Triple, |
| 40 StringRef CPU, StringRef FS, const TargetOptions &Options, | 28 StringRef CPU, StringRef FS, const TargetOptions &Options, |
| 41 Reloc::Model RM, CodeModel::Model CM, | 29 Reloc::Model RM, CodeModel::Model CM, |
| 42 CodeGenOpt::Level OL); | 30 CodeGenOpt::Level OL); |
| 43 | 31 |
| 44 bool addPassesToEmitFile(PassManagerBase &PM, formatted_raw_ostream &Out, | 32 bool addPassesToEmitFile(PassManagerBase &PM, raw_pwrite_stream &Out, |
| 45 CodeGenFileType FileType, bool DisableVerify, | 33 CodeGenFileType FileType, bool DisableVerify, |
| 46 AnalysisID StartAfter, | 34 AnalysisID StartAfter, |
| 47 AnalysisID StopAfter) override; | 35 AnalysisID StopAfter) override; |
| 48 | 36 |
| 49 const DataLayout *getDataLayout() const { return &DL; } | 37 TargetIRAnalysis getTargetIRAnalysis() override; |
| 50 const JSSubtarget *getSubtargetImpl() const override { return &Subtarget; } | |
| 51 | |
| 52 /// \brief Register X86 analysis passes with a pass manager. | |
| 53 void addAnalysisPasses(PassManagerBase &PM) override; | |
| 54 }; | 38 }; |
| 55 | 39 |
| 56 } // End llvm namespace | 40 } // End llvm namespace |
| 57 | 41 |
| 58 #endif | 42 #endif |
| OLD | NEW |