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