| 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/TargetSubtargetInfo.h" |
| 21 | #include "llvm/IR/DataLayout.h" |
| 22 | #include "llvm/Target/TargetMachine.h" |
| 23 | |
| 24 | #define OPTIONS_STRUCT_DECL |
| 25 | #include "LanaiOptions.inc" |
| 26 | |
| 27 | #define |
| 28 | #include "LanaiGenSubtargetInfo.inc" |
| 29 | |
| 30 | namespace llvm { |
| 31 | class LanaiTargetMachine; |
| 32 | |
| 33 | class LanaiSubtarget : public LanaiGenSubtargetInfo { |
| 34 | public: |
| 35 | // This constructor initializes the data members to match that |
| 36 | // of the specified triple. |
| 37 | LanaiSubtarget(const Triple &TargetTriple, StringRef Cpu, |
| 38 | StringRef FeatureString, const LanaiTargetMachine &TM, |
| 39 | const TargetOptions &Options, CodeModel::Model CodeModel, |
| 40 | CodeGenOptLevel OptLevel); |
| 41 | |
| 42 | const LanaiOptions &getCLOpts() const { return CLOpts; } |
| 43 | |
| 44 | // ParseSubtargetFeatures - Parses features string setting specified |
| 45 | // subtarget options. Definition of function is auto generated by tblgen. |
| 46 | void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS); |
| 47 | |
| 48 | LanaiSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS); |
| 49 | |
| 50 | void initSubtargetFeatures(StringRef CPU, StringRef FS); |
| 51 | |
| 52 | bool enableMachineScheduler() const override { return true; } |
| 53 | |
| 54 | const LanaiInstrInfo *getInstrInfo() const override { return &InstrInfo; } |
| 55 | |
| 56 | const TargetFrameLowering *getFrameLowering() const override { |
| 57 | return &FrameLowering; |
| 58 | } |
| 59 | |
| 60 | const LanaiRegisterInfo *getRegisterInfo() const override { |
| 61 | return &InstrInfo.getRegisterInfo(); |
| 62 | } |
| 63 | |
| 64 | const LanaiTargetLowering *getTargetLowering() const override { |
| 65 | return &TLInfo; |
| 66 | } |
| 67 | |
| 68 | const LanaiSelectionDAGInfo *getSelectionDAGInfo() const override { |
| 69 | return &TSInfo; |
| 70 | } |
| 71 | |
| 72 | private: |
| 73 | const LanaiOptions &CLOpts; |
| 74 | LanaiInstrInfo InstrInfo; |
| 75 | LanaiFrameLowering FrameLowering; |
| 76 | LanaiTargetLowering TLInfo; |
| 77 | LanaiSelectionDAGInfo TSInfo; |
| 78 | }; |
| 79 | } // namespace llvm |
| 80 | |
| 81 | #endif // LLVM_LIB_TARGET_LANAI_LANAISUBTARGET_H |
| 82 | |