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 "CSKYFrameLowering.h" 17 #include "CSKYISelLowering.h" 18 #include "CSKYInstrInfo.h" 19 #include "CSKYRegisterInfo.h" 20 #include "llvm/CodeGen/SelectionDAGTargetInfo.h" 21 #include "llvm/CodeGen/TargetSubtargetInfo.h" 22 #include "llvm/Target/TargetMachine.h" 23 24 #define GET_SUBTARGETINFO_HEADER 25 #include "CSKYGenSubtargetInfo.inc" 26 27 namespace llvm { 28 class StringRef; 29 30 class CSKYSubtarget : public CSKYGenSubtargetInfo { 31 virtual void anchor(); 32 33 CSKYFrameLowering FrameLowering; 34 CSKYInstrInfo InstrInfo; 35 CSKYRegisterInfo RegInfo; 36 CSKYTargetLowering TLInfo; 37 SelectionDAGTargetInfo TSInfo; 38 39 bool UseHardFloat; 40 bool UseHardFloatABI; 41 bool HasFPUv2SingleFloat; 42 bool HasFPUv2DoubleFloat; 43 bool HasFPUv3SingleFloat; 44 bool HasFPUv3DoubleFloat; 45 46 bool HasBTST16; 47 bool HasJAVA; 48 bool HasExtendLrw; 49 bool HasDoloop; 50 bool HasHighRegisters; 51 52 bool HasE1; 53 bool HasE2; 54 bool Has2E3; 55 bool HasMP; 56 bool Has3E3r1; 57 bool Has3r1E3r2; 58 bool Has3r2E3r3; 59 bool Has3E7; 60 bool HasMP1E2; 61 bool Has7E10; 62 bool Has10E60; 63 64 public: 65 CSKYSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU, 66 StringRef FS, const TargetMachine &TM); 67 68 const CSKYFrameLowering *getFrameLowering() const override { 69 return &FrameLowering; 70 } 71 const CSKYInstrInfo *getInstrInfo() const override { return &InstrInfo; } 72 const CSKYRegisterInfo *getRegisterInfo() const override { return &RegInfo; } 73 const CSKYTargetLowering *getTargetLowering() const override { 74 return &TLInfo; 75 } 76 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override { 77 return &TSInfo; 78 } 79 80 /// Initializes using the passed in CPU and feature strings so that we can 81 /// use initializer lists for subtarget initialization. 82 CSKYSubtarget &initializeSubtargetDependencies(const Triple &TT, 83 StringRef CPU, 84 StringRef TuneCPU, 85 StringRef FS); 86 87 // Generated by inc file 88 void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS); 89 90 bool useHardFloatABI() const; 91 bool useHardFloat() const { return UseHardFloat; } 92 bool hasFPUv2SingleFloat() const { return HasFPUv2SingleFloat; } 93 bool hasFPUv2DoubleFloat() const { return HasFPUv2DoubleFloat; } 94 bool hasFPUv2() const { return HasFPUv2SingleFloat || HasFPUv2DoubleFloat; } 95 bool hasFPUv3SingleFloat() const { return HasFPUv3SingleFloat; } 96 bool hasFPUv3DoubleFloat() const { return HasFPUv3DoubleFloat; } 97 bool hasFPUv3() const { return HasFPUv3SingleFloat || HasFPUv3DoubleFloat; } 98 bool hasAnyFloatExt() const { return hasFPUv2() || hasFPUv3(); }; 99 100 bool hasBTST16() const { return HasBTST16; } 101 bool hasJAVA() const { return HasJAVA; } 102 bool hasExtendLrw() const { return HasExtendLrw; } 103 bool hasDoloop() const { return HasDoloop; } 104 bool hasHighRegisters() const { return HasHighRegisters; } 105 106 bool hasE1() const { return HasE1; } 107 bool hasE2() const { return HasE2; } 108 bool has2E3() const { return Has2E3; } 109 bool has3r1E3r2() const { return Has3r1E3r2; } 110 bool has3r2E3r3() const { return Has3r2E3r3; } 111 bool has3E3r1() const { return Has3E3r1; } 112 bool has3E7() const { return Has3E7; } 113 bool hasMP() const { return HasMP; } 114 bool hasMP1E2() const { return HasMP1E2; } 115 bool has7E10() const { return Has7E10; } 116 bool has10E60() const { return Has10E60; } 117 }; 118 } // namespace llvm 119 120 #endif // LLVM_LIB_TARGET_CSKY_CSKYSUBTARGET_H 121