xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Lanai/LanaiSubtarget.h (revision da477bcdc0c335171bb0ed3813f570026de6df85)
1 //=====-- LanaiSubtarget.h - Define Subtarget for the Lanai -----*- 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 // This file declares the Lanai specific subclass of TargetSubtarget.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_LANAI_LANAISUBTARGET_H
14 #define LLVM_LIB_TARGET_LANAI_LANAISUBTARGET_H
15 
16 #include "LanaiFrameLowering.h"
17 #include "LanaiISelLowering.h"
18 #include "LanaiInstrInfo.h"
19 #include "LanaiSelectionDAGInfo.h"
20 #include "llvm/CodeGen/TargetFrameLowering.h"
21 #include "llvm/CodeGen/TargetSubtargetInfo.h"
22 #include "llvm/IR/DataLayout.h"
23 #include "llvm/Target/TargetMachine.h"
24 
25 #define GET_SUBTARGETINFO_HEADER
26 #include "LanaiGenSubtargetInfo.inc"
27 
28 namespace llvm {
29 
30 class LanaiSubtarget : public LanaiGenSubtargetInfo {
31 public:
32   // This constructor initializes the data members to match that
33   // of the specified triple.
34   LanaiSubtarget(const Triple &TargetTriple, StringRef Cpu,
35                  StringRef FeatureString, const TargetMachine &TM,
36                  const TargetOptions &Options, CodeModel::Model CodeModel,
37                  CodeGenOpt::Level OptLevel);
38 
39   // ParseSubtargetFeatures - Parses features string setting specified
40   // subtarget options.  Definition of function is auto generated by tblgen.
41   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
42 
43   LanaiSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
44 
45   void initSubtargetFeatures(StringRef CPU, StringRef FS);
46 
47   bool enableMachineScheduler() const override { return true; }
48 
49   const LanaiInstrInfo *getInstrInfo() const override { return &InstrInfo; }
50 
51   const TargetFrameLowering *getFrameLowering() const override {
52     return &FrameLowering;
53   }
54 
55   const LanaiRegisterInfo *getRegisterInfo() const override {
56     return &InstrInfo.getRegisterInfo();
57   }
58 
59   const LanaiTargetLowering *getTargetLowering() const override {
60     return &TLInfo;
61   }
62 
63   const LanaiSelectionDAGInfo *getSelectionDAGInfo() const override {
64     return &TSInfo;
65   }
66 
67 private:
68   LanaiFrameLowering FrameLowering;
69   LanaiInstrInfo InstrInfo;
70   LanaiTargetLowering TLInfo;
71   LanaiSelectionDAGInfo TSInfo;
72 };
73 } // namespace llvm
74 
75 #endif // LLVM_LIB_TARGET_LANAI_LANAISUBTARGET_H
76