Revert " [LoongArch][ISel] Check the number of sign bits in `PatGprGpr_32` (#107432)"
[llvm-project.git] / llvm / lib / Target / WebAssembly / WebAssemblySubtarget.h
blob540da4b51ccaa9b8fbac16773b87255bc1fb2626
1 //=- WebAssemblySubtarget.h - Define Subtarget for the 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 /// TargetSubtarget.
12 ///
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYSUBTARGET_H
16 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYSUBTARGET_H
18 #include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
19 #include "WebAssemblyFrameLowering.h"
20 #include "WebAssemblyISelLowering.h"
21 #include "WebAssemblyInstrInfo.h"
22 #include "WebAssemblySelectionDAGInfo.h"
23 #include "llvm/CodeGen/TargetSubtargetInfo.h"
24 #include <string>
26 #define GET_SUBTARGETINFO_HEADER
27 #include "WebAssemblyGenSubtargetInfo.inc"
29 namespace llvm {
31 // Defined in WebAssemblyGenSubtargetInfo.inc.
32 extern const SubtargetFeatureKV
33 WebAssemblyFeatureKV[WebAssembly::NumSubtargetFeatures];
35 class WebAssemblySubtarget final : public WebAssemblyGenSubtargetInfo {
36 enum SIMDEnum {
37 NoSIMD,
38 SIMD128,
39 RelaxedSIMD,
40 } SIMDLevel = NoSIMD;
42 bool HasAtomics = false;
43 bool HasBulkMemory = false;
44 bool HasExceptionHandling = false;
45 bool HasExtendedConst = false;
46 bool HasHalfPrecision = false;
47 bool HasMultiMemory = false;
48 bool HasMultivalue = false;
49 bool HasMutableGlobals = false;
50 bool HasNontrappingFPToInt = false;
51 bool HasReferenceTypes = false;
52 bool HasSignExt = false;
53 bool HasTailCall = false;
55 /// What processor and OS we're targeting.
56 Triple TargetTriple;
58 WebAssemblyFrameLowering FrameLowering;
59 WebAssemblyInstrInfo InstrInfo;
60 WebAssemblySelectionDAGInfo TSInfo;
61 WebAssemblyTargetLowering TLInfo;
63 WebAssemblySubtarget &initializeSubtargetDependencies(StringRef CPU,
64 StringRef FS);
66 public:
67 /// This constructor initializes the data members to match that
68 /// of the specified triple.
69 WebAssemblySubtarget(const Triple &TT, const std::string &CPU,
70 const std::string &FS, const TargetMachine &TM);
72 const WebAssemblySelectionDAGInfo *getSelectionDAGInfo() const override {
73 return &TSInfo;
75 const WebAssemblyFrameLowering *getFrameLowering() const override {
76 return &FrameLowering;
78 const WebAssemblyTargetLowering *getTargetLowering() const override {
79 return &TLInfo;
81 const WebAssemblyInstrInfo *getInstrInfo() const override {
82 return &InstrInfo;
84 const WebAssemblyRegisterInfo *getRegisterInfo() const override {
85 return &getInstrInfo()->getRegisterInfo();
87 const Triple &getTargetTriple() const { return TargetTriple; }
88 bool enableAtomicExpand() const override;
89 bool enableIndirectBrExpand() const override { return true; }
90 bool enableMachineScheduler() const override;
91 bool useAA() const override;
93 // Predicates used by WebAssemblyInstrInfo.td.
94 bool hasAddr64() const { return TargetTriple.isArch64Bit(); }
95 bool hasAtomics() const { return HasAtomics; }
96 bool hasBulkMemory() const { return HasBulkMemory; }
97 bool hasExceptionHandling() const { return HasExceptionHandling; }
98 bool hasExtendedConst() const { return HasExtendedConst; }
99 bool hasHalfPrecision() const { return HasHalfPrecision; }
100 bool hasMultiMemory() const { return HasMultiMemory; }
101 bool hasMultivalue() const { return HasMultivalue; }
102 bool hasMutableGlobals() const { return HasMutableGlobals; }
103 bool hasNontrappingFPToInt() const { return HasNontrappingFPToInt; }
104 bool hasReferenceTypes() const { return HasReferenceTypes; }
105 bool hasRelaxedSIMD() const { return SIMDLevel >= RelaxedSIMD; }
106 bool hasSignExt() const { return HasSignExt; }
107 bool hasSIMD128() const { return SIMDLevel >= SIMD128; }
108 bool hasTailCall() const { return HasTailCall; }
110 /// Parses features string setting specified subtarget options. Definition of
111 /// function is auto generated by tblgen.
112 void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);
115 } // end namespace llvm
117 #endif