1 // WebAssemblyTargetMachine.h - Define TargetMachine for WebAssembly -*- C++ -*-
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief This file declares the WebAssembly-specific subclass of
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETMACHINE_H
17 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETMACHINE_H
19 #include "WebAssemblySubtarget.h"
20 #include "llvm/Target/TargetMachine.h"
24 class WebAssemblyTargetMachine final : public LLVMTargetMachine {
25 std::unique_ptr<TargetLoweringObjectFile> TLOF;
26 mutable StringMap<std::unique_ptr<WebAssemblySubtarget>> SubtargetMap;
29 WebAssemblyTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
30 StringRef FS, const TargetOptions &Options,
31 Optional<Reloc::Model> RM,
32 Optional<CodeModel::Model> CM, CodeGenOpt::Level OL,
35 ~WebAssemblyTargetMachine() override;
36 const WebAssemblySubtarget *
37 getSubtargetImpl(const Function &F) const override;
39 // Pass Pipeline Configuration
40 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
42 TargetLoweringObjectFile *getObjFileLowering() const override {
46 /// \brief Get the TargetIRAnalysis for this target.
47 TargetIRAnalysis getTargetIRAnalysis() override;
49 bool usesPhysRegsForPEI() const override { return false; }
52 } // end namespace llvm