1285163Sdim// WebAssemblyTargetMachine.h - Define TargetMachine for WebAssembly -*- C++ -*- 2285163Sdim// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6285163Sdim// 7285163Sdim//===----------------------------------------------------------------------===// 8285163Sdim/// 9285163Sdim/// \file 10341825Sdim/// This file declares the WebAssembly-specific subclass of 11285163Sdim/// TargetMachine. 12285163Sdim/// 13285163Sdim//===----------------------------------------------------------------------===// 14285163Sdim 15285163Sdim#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETMACHINE_H 16285163Sdim#define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETMACHINE_H 17285163Sdim 18285163Sdim#include "WebAssemblySubtarget.h" 19285163Sdim#include "llvm/Target/TargetMachine.h" 20285163Sdim 21285163Sdimnamespace llvm { 22285163Sdim 23285163Sdimclass WebAssemblyTargetMachine final : public LLVMTargetMachine { 24285163Sdim std::unique_ptr<TargetLoweringObjectFile> TLOF; 25285163Sdim mutable StringMap<std::unique_ptr<WebAssemblySubtarget>> SubtargetMap; 26285163Sdim 27285163Sdimpublic: 28285163Sdim WebAssemblyTargetMachine(const Target &T, const Triple &TT, StringRef CPU, 29285163Sdim StringRef FS, const TargetOptions &Options, 30327952Sdim Optional<Reloc::Model> RM, 31327952Sdim Optional<CodeModel::Model> CM, CodeGenOpt::Level OL, 32327952Sdim bool JIT); 33285163Sdim 34285163Sdim ~WebAssemblyTargetMachine() override; 35353358Sdim 36353358Sdim const WebAssemblySubtarget *getSubtargetImpl(std::string CPU, 37353358Sdim std::string FS) const; 38285163Sdim const WebAssemblySubtarget * 39285163Sdim getSubtargetImpl(const Function &F) const override; 40285163Sdim 41285163Sdim // Pass Pipeline Configuration 42285163Sdim TargetPassConfig *createPassConfig(PassManagerBase &PM) override; 43285163Sdim 44285163Sdim TargetLoweringObjectFile *getObjFileLowering() const override { 45285163Sdim return TLOF.get(); 46285163Sdim } 47285163Sdim 48327952Sdim TargetTransformInfo getTargetTransformInfo(const Function &F) override; 49309124Sdim 50309124Sdim bool usesPhysRegsForPEI() const override { return false; } 51353358Sdim 52353358Sdim yaml::MachineFunctionInfo *createDefaultFuncInfoYAML() const override; 53353358Sdim yaml::MachineFunctionInfo * 54353358Sdim convertFuncInfoToYAML(const MachineFunction &MF) const override; 55353358Sdim bool parseMachineFunctionInfo(const yaml::MachineFunctionInfo &, 56353358Sdim PerFunctionMIParsingState &PFS, 57353358Sdim SMDiagnostic &Error, 58353358Sdim SMRange &SourceRange) const override; 59285163Sdim}; 60285163Sdim 61285163Sdim} // end namespace llvm 62285163Sdim 63285163Sdim#endif 64