LLVM  4.0.0
WebAssemblySubtarget.h
Go to the documentation of this file.
1 //=- WebAssemblySubtarget.h - Define Subtarget for the WebAssembly -*- C++ -*-//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// \brief This file declares the WebAssembly-specific subclass of
12 /// TargetSubtarget.
13 ///
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYSUBTARGET_H
17 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYSUBTARGET_H
18 
21 #include "WebAssemblyInstrInfo.h"
24 #include <string>
25 
26 #define GET_SUBTARGETINFO_HEADER
27 #include "WebAssemblyGenSubtargetInfo.inc"
28 
29 namespace llvm {
30 
32  bool HasSIMD128;
33 
34  /// String name of used CPU.
35  std::string CPUString;
36 
37  /// What processor and OS we're targeting.
38  Triple TargetTriple;
39 
40  WebAssemblyFrameLowering FrameLowering;
41  WebAssemblyInstrInfo InstrInfo;
44 
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);
48 
49 public:
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);
54 
56  return &TSInfo;
57  }
58  const WebAssemblyFrameLowering *getFrameLowering() const override {
59  return &FrameLowering;
60  }
61  const WebAssemblyTargetLowering *getTargetLowering() const override {
62  return &TLInfo;
63  }
64  const WebAssemblyInstrInfo *getInstrInfo() const override {
65  return &InstrInfo;
66  }
67  const WebAssemblyRegisterInfo *getRegisterInfo() const override {
68  return &getInstrInfo()->getRegisterInfo();
69  }
70  const Triple &getTargetTriple() const { return TargetTriple; }
71  bool enableMachineScheduler() const override;
72  bool useAA() const override;
73 
74  // Predicates used by WebAssemblyInstrInfo.td.
75  bool hasAddr64() const { return TargetTriple.isArch64Bit(); }
76  bool hasSIMD128() const { return HasSIMD128; }
77 
78  /// Parses features string setting specified subtarget options. Definition of
79  /// function is auto generated by tblgen.
81 };
82 
83 } // end namespace llvm
84 
85 #endif
This file defines the interfaces that WebAssembly uses to lower LLVM code into a selection DAG...
const Triple & getTargetTriple() const
bool enableMachineScheduler() const override
const WebAssemblyFrameLowering * getFrameLowering() const override
bool isArch64Bit() const
Test whether the architecture is 64-bit.
Definition: Triple.cpp:1202
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
Parses features string setting specified subtarget options.
const WebAssemblySelectionDAGInfo * getSelectionDAGInfo() const override
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
const WebAssemblyTargetLowering * getTargetLowering() const override
const WebAssemblyRegisterInfo & getRegisterInfo() const
This file contains the WebAssembly implementation of the TargetInstrInfo class.
This file defines the WebAssembly subclass for SelectionDAGTargetInfo.
const WebAssemblyRegisterInfo * getRegisterInfo() const override
This class implements WebAssembly-specific bits of TargetFrameLowering class.
WebAssemblySubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)
This constructor initializes the data members to match that of the specified triple.
Primary interface to the complete machine description for the target machine.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
const WebAssemblyInstrInfo * getInstrInfo() const override