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//===----------------------------------------------------------------------===// 14 15// Atomic Support 16def FeatureExtendLrw : SubtargetFeature<"elrw", "HasExtendLrw", "true", 17 "Use the extend LRW instruction">; 18def HasExtendLrw : Predicate<"Subtarget->hasExtendLrw()">, 19 AssemblerPredicate<(all_of FeatureExtendLrw), 20 "Use the extend LRW instruction">; 21 22def FeatureDoloop : SubtargetFeature<"doloop", "HasDoloop", "true", 23 "Enable doloop instructions">; 24def HasDoloop : Predicate<"Subtarget->hasDoloop()">, 25 AssemblerPredicate<(all_of FeatureDoloop), 26 "Enable doloop instructions">; 27 28def HasE1 29 : SubtargetFeature<"e1", "HasE1", "true", "Support CSKY e1 instructions", 30 [FeatureExtendLrw]>; 31def iHasE1 : Predicate<"Subtarget->hasE1()">, 32 AssemblerPredicate<(all_of HasE1), 33 "Support CSKY e1 instructions">; 34 35def HasE2 36 : SubtargetFeature<"e2", "HasE2", "true", "Support CSKY e2 instructions", 37 [HasE1]>; 38def iHasE2 : Predicate<"Subtarget->hasE2()">, 39 AssemblerPredicate<(all_of HasE2), 40 "Support CSKY e2 instructions">; 41 42def Has2E3 : SubtargetFeature<"2e3", "Has2E3", "true", 43 "Support CSKY 2e3 instructions", [HasE2]>; 44def iHas2E3 : Predicate<"Subtarget->has2E3()">, 45 AssemblerPredicate<(all_of Has2E3), 46 "Support CSKY 2e3 instructions">; 47 48def Has3E3r1 : SubtargetFeature<"3e3r1", "Has3E3r1", "true", 49 "Support CSKY 3e3r1 instructions">; 50def iHas3E3r1 : Predicate<"Subtarget->has3E3r1()">, 51 AssemblerPredicate<(all_of Has3E3r1), 52 "Support CSKY 3e3r1 instructions">; 53 54def Has3r2E3r3 55 : SubtargetFeature<"3e3r3", "Has3r2E3r3", "true", 56 "Support CSKY 3e3r3 instructions", [FeatureDoloop]>; 57def iHas3r2E3r3 : Predicate<"Subtarget->has3r2E3r3()">, 58 AssemblerPredicate<(all_of Has3r2E3r3), 59 "Support CSKY 3e3r3 instructions">; 60 61def Has3E7 : SubtargetFeature<"3e7", "Has3E7", "true", 62 "Support CSKY 3e7 instructions", [Has2E3]>; 63def iHas3E7 : Predicate<"Subtarget->has3E7()">, 64 AssemblerPredicate<(all_of Has3E7), 65 "Support CSKY 3e7 instructions">; 66 67def HasMP1E2 : SubtargetFeature<"mp1e2", "HasMP1E2", "true", 68 "Support CSKY mp1e2 instructions", [Has3E7]>; 69def iHasMP1E2 : Predicate<"Subtarget->hasMP1E2()">, 70 AssemblerPredicate<(all_of HasMP1E2), 71 "Support CSKY mp1e2 instructions">; 72 73def Has7E10 : SubtargetFeature<"7e10", "Has7E10", "true", 74 "Support CSKY 7e10 instructions", [Has3E7]>; 75def iHas7E10 : Predicate<"Subtarget->has7E10()">, 76 AssemblerPredicate<(all_of Has7E10), 77 "Support CSKY 7e10 instructions">; 78 79def Has10E60 : SubtargetFeature<"10e60", "Has10E60", "true", 80 "Support CSKY 10e60 instructions", [Has7E10]>; 81def iHas10E60 : Predicate<"Subtarget->has10E60()">, 82 AssemblerPredicate<(all_of Has10E60), 83 "Support CSKY 10e60 instructions">; 84 85//===----------------------------------------------------------------------===// 86// Registers, calling conventions, instruction descriptions. 87//===----------------------------------------------------------------------===// 88 89include "CSKYRegisterInfo.td" 90include "CSKYInstrInfo.td" 91 92//===----------------------------------------------------------------------===// 93// CSKY processors supported. 94//===----------------------------------------------------------------------===// 95 96def : ProcessorModel<"generic", NoSchedModel, []>; 97 98//===----------------------------------------------------------------------===// 99// Define the CSKY target. 100//===----------------------------------------------------------------------===// 101 102def CSKYInstrInfo : InstrInfo; 103 104 105def CSKYAsmParser : AsmParser { 106 let ShouldEmitMatchRegisterAltName = 1; 107 let AllowDuplicateRegisterNames = 1; 108} 109 110def CSKYAsmWriter : AsmWriter { 111 int PassSubtarget = 1; 112} 113 114def CSKY : Target { 115 let InstructionSet = CSKYInstrInfo; 116 let AssemblyParsers = [CSKYAsmParser]; 117 let AssemblyWriters = [CSKYAsmWriter]; 118 let AllowRegisterRenaming = 1; 119} 120