Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 1 | // WebAssemblyTargetMachine.h - Define TargetMachine for WebAssembly -*- C++ -*- |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | /// |
| 10 | /// \file |
| 11 | /// \brief This file declares the WebAssembly-specific subclass of |
| 12 | /// TargetMachine. |
| 13 | /// |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETMACHINE_H |
| 17 | #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETMACHINE_H |
| 18 | |
| 19 | #include "WebAssemblySubtarget.h" |
| 20 | #include "llvm/Target/TargetMachine.h" |
| 21 | |
| 22 | namespace llvm { |
| 23 | |
Matthias Braun | bb8507e | 2017-10-12 22:57:28 +0000 | [diff] [blame] | 24 | class WebAssemblyTargetMachine final : public LLVMTargetMachine { |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 25 | std::unique_ptr<TargetLoweringObjectFile> TLOF; |
| 26 | mutable StringMap<std::unique_ptr<WebAssemblySubtarget>> SubtargetMap; |
| 27 | |
| 28 | public: |
| 29 | WebAssemblyTargetMachine(const Target &T, const Triple &TT, StringRef CPU, |
| 30 | StringRef FS, const TargetOptions &Options, |
Daniel Jasper | 314ed20 | 2017-08-03 05:15:53 +0000 | [diff] [blame] | 31 | Optional<Reloc::Model> RM, |
| 32 | Optional<CodeModel::Model> CM, CodeGenOpt::Level OL, |
| 33 | bool JIT); |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 34 | |
| 35 | ~WebAssemblyTargetMachine() override; |
| 36 | const WebAssemblySubtarget * |
| 37 | getSubtargetImpl(const Function &F) const override; |
| 38 | |
| 39 | // Pass Pipeline Configuration |
| 40 | TargetPassConfig *createPassConfig(PassManagerBase &PM) override; |
| 41 | |
| 42 | TargetLoweringObjectFile *getObjFileLowering() const override { |
| 43 | return TLOF.get(); |
| 44 | } |
| 45 | |
Sanjoy Das | 26d11ca | 2017-12-22 18:21:59 +0000 | [diff] [blame] | 46 | TargetTransformInfo getTargetTransformInfo(const Function &F) override; |
Derek Schuff | 1aaf87e | 2016-05-17 08:49:59 +0000 | [diff] [blame] | 47 | |
| 48 | bool usesPhysRegsForPEI() const override { return false; } |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | } // end namespace llvm |
| 52 | |
| 53 | #endif |