1 // WebAssemblyTargetMachine.h - Define TargetMachine for WebAssembly -*- C++ -*-
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 /// This file declares the WebAssembly-specific subclass of
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETMACHINE_H
16 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETMACHINE_H
18 #include "WebAssemblySubtarget.h"
19 #include "llvm/Target/TargetMachine.h"
23 class WebAssemblyTargetMachine final
: public LLVMTargetMachine
{
24 std::unique_ptr
<TargetLoweringObjectFile
> TLOF
;
25 mutable StringMap
<std::unique_ptr
<WebAssemblySubtarget
>> SubtargetMap
;
28 WebAssemblyTargetMachine(const Target
&T
, const Triple
&TT
, StringRef CPU
,
29 StringRef FS
, const TargetOptions
&Options
,
30 Optional
<Reloc::Model
> RM
,
31 Optional
<CodeModel::Model
> CM
, CodeGenOpt::Level OL
,
34 ~WebAssemblyTargetMachine() override
;
36 const WebAssemblySubtarget
*getSubtargetImpl() const;
37 const WebAssemblySubtarget
*getSubtargetImpl(std::string CPU
,
38 std::string FS
) const;
39 const WebAssemblySubtarget
*
40 getSubtargetImpl(const Function
&F
) const override
;
42 // Pass Pipeline Configuration
43 TargetPassConfig
*createPassConfig(PassManagerBase
&PM
) override
;
45 TargetLoweringObjectFile
*getObjFileLowering() const override
{
49 TargetTransformInfo
getTargetTransformInfo(const Function
&F
) const override
;
51 bool usesPhysRegsForValues() const override
{ return false; }
53 yaml::MachineFunctionInfo
*createDefaultFuncInfoYAML() const override
;
54 yaml::MachineFunctionInfo
*
55 convertFuncInfoToYAML(const MachineFunction
&MF
) const override
;
56 bool parseMachineFunctionInfo(const yaml::MachineFunctionInfo
&,
57 PerFunctionMIParsingState
&PFS
,
59 SMRange
&SourceRange
) const override
;
62 } // end namespace llvm