LLVM 19.0.0git
WebAssemblySubtarget.h
Go to the documentation of this file.
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//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYSUBTARGET_H
16#define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYSUBTARGET_H
17
24#include <string>
25
26#define GET_SUBTARGETINFO_HEADER
27#include "WebAssemblyGenSubtargetInfo.inc"
28
29namespace llvm {
30
31// Defined in WebAssemblyGenSubtargetInfo.inc.
32extern const SubtargetFeatureKV
33 WebAssemblyFeatureKV[WebAssembly::NumSubtargetFeatures];
34
36 enum SIMDEnum {
37 NoSIMD,
38 SIMD128,
39 RelaxedSIMD,
40 } SIMDLevel = NoSIMD;
41
42 bool HasAtomics = false;
43 bool HasNontrappingFPToInt = false;
44 bool HasSignExt = false;
45 bool HasExceptionHandling = false;
46 bool HasBulkMemory = false;
47 bool HasMultivalue = false;
48 bool HasMutableGlobals = false;
49 bool HasTailCall = false;
50 bool HasReferenceTypes = false;
51 bool HasExtendedConst = false;
52 bool HasMultiMemory = false;
53 bool HasHalfPrecision = false;
54
55 /// What processor and OS we're targeting.
56 Triple TargetTriple;
57
58 WebAssemblyFrameLowering FrameLowering;
59 WebAssemblyInstrInfo InstrInfo;
62
63 WebAssemblySubtarget &initializeSubtargetDependencies(StringRef CPU,
64 StringRef FS);
65
66public:
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);
71
73 return &TSInfo;
74 }
76 return &FrameLowering;
77 }
79 return &TLInfo;
80 }
81 const WebAssemblyInstrInfo *getInstrInfo() const override {
82 return &InstrInfo;
83 }
84 const WebAssemblyRegisterInfo *getRegisterInfo() const override {
85 return &getInstrInfo()->getRegisterInfo();
86 }
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;
92
93 // Predicates used by WebAssemblyInstrInfo.td.
94 bool hasAddr64() const { return TargetTriple.isArch64Bit(); }
95 bool hasSIMD128() const { return SIMDLevel >= SIMD128; }
96 bool hasRelaxedSIMD() const { return SIMDLevel >= RelaxedSIMD; }
97 bool hasHalfPrecision() const { return HasHalfPrecision; }
98 bool hasAtomics() const { return HasAtomics; }
99 bool hasNontrappingFPToInt() const { return HasNontrappingFPToInt; }
100 bool hasSignExt() const { return HasSignExt; }
101 bool hasExceptionHandling() const { return HasExceptionHandling; }
102 bool hasBulkMemory() const { return HasBulkMemory; }
103 bool hasMultivalue() const { return HasMultivalue; }
104 bool hasMutableGlobals() const { return HasMutableGlobals; }
105 bool hasTailCall() const { return HasTailCall; }
106 bool hasReferenceTypes() const { return HasReferenceTypes; }
107 bool hasMultiMemory() const { return HasMultiMemory; }
108
109 /// Parses features string setting specified subtarget options. Definition of
110 /// function is auto generated by tblgen.
112};
113
114} // end namespace llvm
115
116#endif
const char LLVMTargetMachineRef TM
This class implements WebAssembly-specific bits of TargetFrameLowering class.
This file defines the interfaces that WebAssembly uses to lower LLVM code into a selection DAG.
This file contains the WebAssembly implementation of the TargetInstrInfo class.
This file provides WebAssembly-specific target descriptions.
This file defines the WebAssembly subclass for SelectionDAGTargetInfo.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:76
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
bool isArch64Bit() const
Test whether the architecture is 64-bit.
Definition: Triple.cpp:1556
const WebAssemblyRegisterInfo & getRegisterInfo() const
bool enableAtomicExpand() const override
const WebAssemblySelectionDAGInfo * getSelectionDAGInfo() const override
const Triple & getTargetTriple() const
bool enableIndirectBrExpand() const override
const WebAssemblyTargetLowering * getTargetLowering() const override
const WebAssemblyInstrInfo * getInstrInfo() const override
const WebAssemblyRegisterInfo * getRegisterInfo() const override
bool enableMachineScheduler() const override
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
Parses features string setting specified subtarget options.
const WebAssemblyFrameLowering * getFrameLowering() const override
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
const SubtargetFeatureKV WebAssemblyFeatureKV[WebAssembly::NumSubtargetFeatures]