1//===-- CSKY.td - Describe the CSKY Target Machine ---------*- tablegen -*-===// 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 9include "llvm/Target/Target.td" 10 11//===----------------------------------------------------------------------===// 12// CSKY subtarget features and instruction predicates. 13//===----------------------------------------------------------------------===// 14def ModeHardFloat : 15 SubtargetFeature<"hard-float", "UseHardFloat", 16 "true", "Use hard floating point features">; 17def ModeHardFloatABI : 18 SubtargetFeature<"hard-float-abi", "UseHardFloatABI", 19 "true", "Use hard floating point ABI to pass args">; 20 21def FeatureFPUV2_SF 22 : SubtargetFeature<"fpuv2_sf", "HasFPUv2SingleFloat", "true", 23 "Enable FPUv2 single float instructions">; 24def HasFPUv2_SF : Predicate<"Subtarget->hasFPUv2SingleFloat()">, 25 AssemblerPredicate<(all_of FeatureFPUV2_SF), 26 "Enable FPUv2 single float instructions">; 27 28def FeatureFPUV2_DF 29 : SubtargetFeature<"fpuv2_df", "HasFPUv2DoubleFloat", "true", 30 "Enable FPUv2 double float instructions">; 31def HasFPUv2_DF : Predicate<"Subtarget->hasFPUv2DoubleFloat()">, 32 AssemblerPredicate<(all_of FeatureFPUV2_DF), 33 "Enable FPUv2 double float instructions">; 34 35def FeatureFPUV3_SF 36 : SubtargetFeature<"fpuv3_sf", "HasFPUv3SingleFloat", "true", 37 "Enable FPUv3 single float instructions">; 38def HasFPUv3_SF : Predicate<"Subtarget->hasFPUv3SingleFloat()">, 39 AssemblerPredicate<(all_of FeatureFPUV3_SF), 40 "Enable FPUv3 single float instructions">; 41 42def FeatureFPUV3_DF 43 : SubtargetFeature<"fpuv3_df", "HasFPUv3DoubleFloat", "true", 44 "Enable FPUv3 double float instructions">; 45def HasFPUv3_DF : Predicate<"Subtarget->hasFPUv3DoubleFloat()">, 46 AssemblerPredicate<(all_of FeatureFPUV3_DF), 47 "Enable FPUv3 double float instructions">; 48 49def FeatureBTST16 : SubtargetFeature<"btst16", "HasBTST16", "true", 50 "Use the 16-bit btsti instruction">; 51def HasBTST16 : Predicate<"Subtarget->hasBTST16()">, 52 AssemblerPredicate<(all_of FeatureBTST16), 53 "Use the 16-bit btsti instruction">; 54 55// Atomic Support 56def FeatureExtendLrw : SubtargetFeature<"elrw", "HasExtendLrw", "true", 57 "Use the extend LRW instruction">; 58def HasExtendLrw : Predicate<"Subtarget->hasExtendLrw()">, 59 AssemblerPredicate<(all_of FeatureExtendLrw), 60 "Use the extend LRW instruction">; 61 62def FeatureJAVA 63 : SubtargetFeature<"java", "HasJAVA", "true", "Enable java instructions">; 64def HasJAVA : Predicate<"Subtarget->hasJAVA()">, 65 AssemblerPredicate<(all_of FeatureJAVA), 66 "Enable java instructions">; 67 68def FeatureDoloop : SubtargetFeature<"doloop", "HasDoloop", "true", 69 "Enable doloop instructions">; 70def HasDoloop : Predicate<"Subtarget->hasDoloop()">, 71 AssemblerPredicate<(all_of FeatureDoloop), 72 "Enable doloop instructions">; 73 74def HasE1 75 : SubtargetFeature<"e1", "HasE1", "true", "Support CSKY e1 instructions", 76 [FeatureExtendLrw]>; 77def iHasE1 : Predicate<"Subtarget->hasE1()">, 78 AssemblerPredicate<(all_of HasE1), 79 "Support CSKY e1 instructions">; 80 81def HasE2 82 : SubtargetFeature<"e2", "HasE2", "true", "Support CSKY e2 instructions", 83 [HasE1]>; 84def iHasE2 : Predicate<"Subtarget->hasE2()">, 85 AssemblerPredicate<(all_of HasE2), 86 "Support CSKY e2 instructions">; 87 88def Has2E3 : SubtargetFeature<"2e3", "Has2E3", "true", 89 "Support CSKY 2e3 instructions", [HasE2]>; 90def iHas2E3 : Predicate<"Subtarget->has2E3()">, 91 AssemblerPredicate<(all_of Has2E3), 92 "Support CSKY 2e3 instructions">; 93 94def Has3E3r1 : SubtargetFeature<"3e3r1", "Has3E3r1", "true", 95 "Support CSKY 3e3r1 instructions">; 96def iHas3E3r1 : Predicate<"Subtarget->has3E3r1()">, 97 AssemblerPredicate<(all_of Has3E3r1), 98 "Support CSKY 3e3r1 instructions">; 99 100def Has3r2E3r3 101 : SubtargetFeature<"3e3r3", "Has3r2E3r3", "true", 102 "Support CSKY 3e3r3 instructions", [FeatureDoloop]>; 103def iHas3r2E3r3 : Predicate<"Subtarget->has3r2E3r3()">, 104 AssemblerPredicate<(all_of Has3r2E3r3), 105 "Support CSKY 3e3r3 instructions">; 106 107def Has3E7 : SubtargetFeature<"3e7", "Has3E7", "true", 108 "Support CSKY 3e7 instructions", [Has2E3]>; 109def iHas3E7 : Predicate<"Subtarget->has3E7()">, 110 AssemblerPredicate<(all_of Has3E7), 111 "Support CSKY 3e7 instructions">; 112 113def HasMP1E2 : SubtargetFeature<"mp1e2", "HasMP1E2", "true", 114 "Support CSKY mp1e2 instructions", [Has3E7]>; 115def iHasMP1E2 : Predicate<"Subtarget->hasMP1E2()">, 116 AssemblerPredicate<(all_of HasMP1E2), 117 "Support CSKY mp1e2 instructions">; 118 119def Has7E10 : SubtargetFeature<"7e10", "Has7E10", "true", 120 "Support CSKY 7e10 instructions", [Has3E7]>; 121def iHas7E10 : Predicate<"Subtarget->has7E10()">, 122 AssemblerPredicate<(all_of Has7E10), 123 "Support CSKY 7e10 instructions">; 124 125def Has10E60 : SubtargetFeature<"10e60", "Has10E60", "true", 126 "Support CSKY 10e60 instructions", [Has7E10]>; 127def iHas10E60 : Predicate<"Subtarget->has10E60()">, 128 AssemblerPredicate<(all_of Has10E60), 129 "Support CSKY 10e60 instructions">; 130 131//===----------------------------------------------------------------------===// 132// Registers, calling conventions, instruction descriptions. 133//===----------------------------------------------------------------------===// 134 135include "CSKYRegisterInfo.td" 136include "CSKYCallingConv.td" 137include "CSKYInstrInfo.td" 138 139//===----------------------------------------------------------------------===// 140// CSKY processors supported. 141//===----------------------------------------------------------------------===// 142 143def : ProcessorModel<"generic", NoSchedModel, []>; 144 145//===----------------------------------------------------------------------===// 146// Define the CSKY target. 147//===----------------------------------------------------------------------===// 148 149def CSKYInstrInfo : InstrInfo; 150 151 152def CSKYAsmParser : AsmParser { 153 let ShouldEmitMatchRegisterAltName = 1; 154 let AllowDuplicateRegisterNames = 1; 155} 156 157def CSKYAsmWriter : AsmWriter { 158 int PassSubtarget = 1; 159} 160 161def CSKY : Target { 162 let InstructionSet = CSKYInstrInfo; 163 let AssemblyParsers = [CSKYAsmParser]; 164 let AssemblyWriters = [CSKYAsmWriter]; 165 let AllowRegisterRenaming = 1; 166} 167