1 //===-- CSKYSubtarget.h - Define Subtarget for the CSKY----------*- 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 CSKY specific subclass of TargetSubtargetInfo. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_LIB_TARGET_CSKY_CSKYSUBTARGET_H 14 #define LLVM_LIB_TARGET_CSKY_CSKYSUBTARGET_H 15 16 #include "llvm/CodeGen/SelectionDAGTargetInfo.h" 17 #include "llvm/CodeGen/TargetSubtargetInfo.h" 18 #include "llvm/Target/TargetMachine.h" 19 20 #define GET_SUBTARGETINFO_HEADER 21 #include "CSKYGenSubtargetInfo.inc" 22 23 namespace llvm { 24 class StringRef; 25 26 class CSKYSubtarget : public CSKYGenSubtargetInfo { 27 virtual void anchor(); 28 29 CSKYFrameLowering FrameLowering; 30 CSKYInstrInfo InstrInfo; 31 CSKYRegisterInfo RegInfo; 32 CSKYTargetLowering TLInfo; 33 SelectionDAGTargetInfo TSInfo; 34 35 bool HasE1; 36 bool HasE2; 37 bool Has2E3; 38 bool HasMP; 39 bool Has3E3r1; 40 bool Has3r1E3r2; 41 bool Has3r2E3r3; 42 bool Has3E7; 43 bool HasMP1E2; 44 bool Has7E10; 45 bool Has10E60; 46 47 public: 48 CSKYSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU, 49 StringRef FS, const TargetMachine &TM); 50 51 const CSKYFrameLowering *getFrameLowering() const override { 52 return &FrameLowering; 53 } 54 const CSKYInstrInfo *getInstrInfo() const override { return &InstrInfo; } 55 const CSKYRegisterInfo *getRegisterInfo() const override { return &RegInfo; } 56 const CSKYTargetLowering *getTargetLowering() const override { 57 return &TLInfo; 58 } 59 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override { 60 return &TSInfo; 61 } 62 63 /// Initializes using the passed in CPU and feature strings so that we can 64 /// use initializer lists for subtarget initialization. 65 CSKYSubtarget &initializeSubtargetDependencies(const Triple &TT, 66 StringRef CPU, 67 StringRef TuneCPU, 68 StringRef FS); 69 70 // Generated by inc file 71 void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS); 72 73 bool hasE1() const { return HasE1; } 74 bool hasE2() const { return HasE2; } 75 bool has2E3() const { return Has2E3; } 76 bool has3r1E3r2() const { return Has3r1E3r2; } 77 bool has3r2E3r3() const { return Has3r2E3r3; } 78 bool has3E3r1() const { return Has3E3r1; } 79 bool has3E7() const { return Has3E7; } 80 bool hasMP() const { return HasMP; } 81 bool hasMP1E2() const { return HasMP1E2; } 82 bool has7E10() const { return Has7E10; } 83 bool has10E60() const { return Has10E60; } 84 }; 85 } // namespace llvm 86 87 #endif // LLVM_LIB_TARGET_CSKY_CSKYSUBTARGET_H 88