1 //=- WebAssemblySubtarget.h - Define Subtarget for the WebAssembly -*- C++ -*-//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief This file declares the WebAssembly-specific subclass of
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYSUBTARGET_H
17 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYSUBTARGET_H
19 #include "WebAssemblyFrameLowering.h"
20 #include "WebAssemblyISelLowering.h"
21 #include "WebAssemblyInstrInfo.h"
22 #include "WebAssemblySelectionDAGInfo.h"
23 #include "llvm/Target/TargetSubtargetInfo.h"
26 #define GET_SUBTARGETINFO_HEADER
27 #include "WebAssemblyGenSubtargetInfo.inc"
31 class WebAssemblySubtarget final : public WebAssemblyGenSubtargetInfo {
34 /// String name of used CPU.
35 std::string CPUString;
37 /// What processor and OS we're targeting.
40 WebAssemblyFrameLowering FrameLowering;
41 WebAssemblyInstrInfo InstrInfo;
42 WebAssemblySelectionDAGInfo TSInfo;
43 WebAssemblyTargetLowering TLInfo;
45 /// Initializes using CPUString and the passed in feature string so that we
46 /// can use initializer lists for subtarget initialization.
47 WebAssemblySubtarget &initializeSubtargetDependencies(StringRef FS);
50 /// This constructor initializes the data members to match that
51 /// of the specified triple.
52 WebAssemblySubtarget(const Triple &TT, const std::string &CPU,
53 const std::string &FS, const TargetMachine &TM);
55 const WebAssemblySelectionDAGInfo *getSelectionDAGInfo() const override {
58 const WebAssemblyFrameLowering *getFrameLowering() const override {
59 return &FrameLowering;
61 const WebAssemblyTargetLowering *getTargetLowering() const override {
64 const WebAssemblyInstrInfo *getInstrInfo() const override {
67 const WebAssemblyRegisterInfo *getRegisterInfo() const override {
68 return &getInstrInfo()->getRegisterInfo();
70 const Triple &getTargetTriple() const { return TargetTriple; }
71 bool enableMachineScheduler() const override;
72 bool useAA() const override { return true; }
74 // Predicates used by WebAssemblyInstrInfo.td.
75 bool hasAddr64() const { return TargetTriple.isArch64Bit(); }
76 bool hasSIMD128() const { return HasSIMD128; }
78 /// Parses features string setting specified subtarget options. Definition of
79 /// function is auto generated by tblgen.
80 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
83 } // end namespace llvm