Revert " [LoongArch][ISel] Check the number of sign bits in `PatGprGpr_32` (#107432)"
[llvm-project.git] / llvm / lib / Target / WebAssembly / WebAssemblyTargetMachine.h
blob1ff2e175978c31ac64b42298549bd565ced0f1a9
1 // WebAssemblyTargetMachine.h - Define TargetMachine for WebAssembly -*- C++ -*-
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file declares the WebAssembly-specific subclass of
11 /// TargetMachine.
12 ///
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"
20 #include <optional>
22 namespace llvm {
24 class WebAssemblyTargetMachine final : public LLVMTargetMachine {
25 std::unique_ptr<TargetLoweringObjectFile> TLOF;
26 mutable StringMap<std::unique_ptr<WebAssemblySubtarget>> SubtargetMap;
27 bool UsesMultivalueABI = false;
29 public:
30 WebAssemblyTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
31 StringRef FS, const TargetOptions &Options,
32 std::optional<Reloc::Model> RM,
33 std::optional<CodeModel::Model> CM,
34 CodeGenOptLevel OL, bool JIT);
36 ~WebAssemblyTargetMachine() override;
38 const WebAssemblySubtarget *getSubtargetImpl() const;
39 const WebAssemblySubtarget *getSubtargetImpl(std::string CPU,
40 std::string FS) const;
41 const WebAssemblySubtarget *
42 getSubtargetImpl(const Function &F) const override;
44 // Pass Pipeline Configuration
45 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
47 TargetLoweringObjectFile *getObjFileLowering() const override {
48 return TLOF.get();
51 MachineFunctionInfo *
52 createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F,
53 const TargetSubtargetInfo *STI) const override;
55 TargetTransformInfo getTargetTransformInfo(const Function &F) const override;
57 bool usesPhysRegsForValues() const override { return false; }
59 yaml::MachineFunctionInfo *createDefaultFuncInfoYAML() const override;
60 yaml::MachineFunctionInfo *
61 convertFuncInfoToYAML(const MachineFunction &MF) const override;
62 bool parseMachineFunctionInfo(const yaml::MachineFunctionInfo &,
63 PerFunctionMIParsingState &PFS,
64 SMDiagnostic &Error,
65 SMRange &SourceRange) const override;
67 bool usesMultivalueABI() const { return UsesMultivalueABI; }
70 } // end namespace llvm
72 #endif