1 //===-- Sparc.td - Describe the Sparc Target Machine -------*- tablegen -*-===//
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
7 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
13 // Target-independent interfaces which we are implementing
14 //===----------------------------------------------------------------------===//
16 include "llvm/Target/Target.td"
17 include "llvm/TableGen/SearchableTable.td"
19 //===----------------------------------------------------------------------===//
20 // SPARC Subtarget features.
24 : SubtargetFeature<"soft-mul-div", "UseSoftMulDiv", "true",
25 "Use software emulation for integer multiply and divide">;
28 : SubtargetFeature<"no-fsmuld", "HasNoFSMULD", "true",
29 "Disable the fsmuld instruction.">;
31 : SubtargetFeature<"no-fmuls", "HasNoFMULS", "true",
32 "Disable the fmuls instruction.">;
35 : SubtargetFeature<"v9", "IsV9", "true",
36 "Enable SPARC-V9 instructions">;
38 : SubtargetFeature<"v8plus", "IsV8Plus", "true",
39 "Enable V8+ mode, allowing use of 64-bit V9 instructions in 32-bit code">;
40 def FeatureV8Deprecated
41 : SubtargetFeature<"deprecated-v8", "UseV8DeprecatedInsts", "true",
42 "Enable deprecated V8 instructions in V9 mode">;
44 : SubtargetFeature<"vis", "IsVIS", "true",
45 "Enable UltraSPARC Visual Instruction Set extensions">;
47 : SubtargetFeature<"vis2", "IsVIS2", "true",
48 "Enable Visual Instruction Set extensions II">;
50 : SubtargetFeature<"vis3", "IsVIS3", "true",
51 "Enable Visual Instruction Set extensions III">;
53 : SubtargetFeature<"leon", "IsLeon", "true",
54 "Enable LEON extensions">;
56 : SubtargetFeature<"leonpwrpsr", "HasPWRPSR", "true",
57 "Enable the PWRPSR instruction">;
60 : SubtargetFeature<"hard-quad-float", "HasHardQuad", "true",
61 "Enable quad-word floating point instructions">;
63 def UsePopc : SubtargetFeature<"popc", "UsePopc", "true",
64 "Use the popc (population count) instruction">;
66 def FeatureSoftFloat : SubtargetFeature<"soft-float", "UseSoftFloat", "true",
67 "Use software emulation for floating point">;
69 //===----------------------------------------------------------------------===//
70 // SPARC Subtarget tuning features.
73 def TuneSlowRDPC : SubtargetFeature<"slow-rdpc", "HasSlowRDPC", "true",
74 "rd %pc, %XX is slow", [FeatureV9]>;
76 //==== Features added predmoninantly for LEON subtarget support
77 include "LeonFeatures.td"
79 //==== Register allocation tweaks needed by some low-level software
80 foreach i = 1 ... 7 in
81 def FeatureReserveG#i : SubtargetFeature<"reserve-g"#i, "ReserveRegister["#i#" + SP::G0]", "true",
82 "Reserve G"#i#", making it unavailable as a GPR">;
83 foreach i = 0 ... 5 in
84 def FeatureReserveO#i : SubtargetFeature<"reserve-o"#i, "ReserveRegister["#i#" + SP::O0]", "true",
85 "Reserve O"#i#", making it unavailable as a GPR">;
86 foreach i = 0 ... 7 in
87 def FeatureReserveL#i : SubtargetFeature<"reserve-l"#i, "ReserveRegister["#i#" + SP::L0]", "true",
88 "Reserve L"#i#", making it unavailable as a GPR">;
89 foreach i = 0 ... 5 in
90 def FeatureReserveI#i : SubtargetFeature<"reserve-i"#i, "ReserveRegister["#i#" + SP::I0]", "true",
91 "Reserve I"#i#", making it unavailable as a GPR">;
93 //===----------------------------------------------------------------------===//
94 // Register File, Calling Conv, Instruction Descriptions
95 //===----------------------------------------------------------------------===//
97 include "SparcASITags.td"
98 include "SparcPrefetchTags.td"
99 include "SparcRegisterInfo.td"
100 include "SparcCallingConv.td"
101 include "SparcSchedule.td"
102 include "SparcInstrInfo.td"
104 def SparcInstrInfo : InstrInfo;
106 def SparcAsmParser : AsmParser {
107 let ShouldEmitMatchRegisterAltName = true;
108 let AllowDuplicateRegisterNames = true;
111 def SparcAsmParserVariant : AsmParserVariant {
112 let RegisterPrefix = "%";
115 //===----------------------------------------------------------------------===//
116 // SPARC processors supported.
117 //===----------------------------------------------------------------------===//
119 class Proc<string Name, list<SubtargetFeature> Features,
120 list<SubtargetFeature> TuneFeatures = []>
121 : Processor<Name, NoItineraries, Features, TuneFeatures>;
123 def : Proc<"generic", []>;
124 def : Proc<"v7", [FeatureSoftMulDiv, FeatureNoFSMULD]>;
125 def : Proc<"v8", []>;
126 def : Proc<"supersparc", []>;
127 def : Proc<"sparclite", []>;
128 def : Proc<"f934", []>;
129 def : Proc<"hypersparc", []>;
130 def : Proc<"sparclite86x", []>;
131 def : Proc<"sparclet", []>;
132 def : Proc<"tsc701", []>;
133 def : Proc<"myriad2", [FeatureLeon, LeonCASA]>;
134 def : Proc<"myriad2.1", [FeatureLeon, LeonCASA]>;
135 def : Proc<"myriad2.2", [FeatureLeon, LeonCASA]>;
136 def : Proc<"myriad2.3", [FeatureLeon, LeonCASA]>;
137 def : Proc<"ma2100", [FeatureLeon, LeonCASA]>;
138 def : Proc<"ma2150", [FeatureLeon, LeonCASA]>;
139 def : Proc<"ma2155", [FeatureLeon, LeonCASA]>;
140 def : Proc<"ma2450", [FeatureLeon, LeonCASA]>;
141 def : Proc<"ma2455", [FeatureLeon, LeonCASA]>;
142 def : Proc<"ma2x5x", [FeatureLeon, LeonCASA]>;
143 def : Proc<"ma2080", [FeatureLeon, LeonCASA]>;
144 def : Proc<"ma2085", [FeatureLeon, LeonCASA]>;
145 def : Proc<"ma2480", [FeatureLeon, LeonCASA]>;
146 def : Proc<"ma2485", [FeatureLeon, LeonCASA]>;
147 def : Proc<"ma2x8x", [FeatureLeon, LeonCASA]>;
148 def : Proc<"v9", [FeatureV9]>;
149 def : Proc<"ultrasparc", [FeatureV9, FeatureV8Deprecated, FeatureVIS],
151 def : Proc<"ultrasparc3", [FeatureV9, FeatureV8Deprecated, FeatureVIS,
154 def : Proc<"niagara", [FeatureV9, FeatureV8Deprecated, FeatureVIS,
156 def : Proc<"niagara2", [FeatureV9, FeatureV8Deprecated, UsePopc,
157 FeatureVIS, FeatureVIS2]>;
158 def : Proc<"niagara3", [FeatureV9, FeatureV8Deprecated, UsePopc,
159 FeatureVIS, FeatureVIS2]>;
160 def : Proc<"niagara4", [FeatureV9, FeatureV8Deprecated, UsePopc,
161 FeatureVIS, FeatureVIS2, FeatureVIS3]>;
164 def : Processor<"leon2", LEON2Itineraries,
167 // LEON 2 FT (AT697E)
168 // TO DO: Place-holder: Processor specific features will be added *very* soon here.
169 def : Processor<"at697e", LEON2Itineraries,
170 [FeatureLeon, InsertNOPLoad]>;
172 // LEON 2 FT (AT697F)
173 // TO DO: Place-holder: Processor specific features will be added *very* soon here.
174 def : Processor<"at697f", LEON2Itineraries,
175 [FeatureLeon, InsertNOPLoad]>;
179 def : Processor<"leon3", LEON3Itineraries,
180 [FeatureLeon, UMACSMACSupport]>;
182 // LEON 3 FT (UT699). Provides features for the UT699 processor
183 // - covers all the erratum fixes for LEON3, but does not support the CASA instruction.
184 def : Processor<"ut699", LEON3Itineraries,
185 [FeatureLeon, InsertNOPLoad, FeatureNoFSMULD, FeatureNoFMULS, FixAllFDIVSQRT]>;
187 // LEON3 FT (GR712RC). Provides features for the GR712RC processor.
188 // - covers all the erratum fixed for LEON3 and support for the CASA instruction.
189 def : Processor<"gr712rc", LEON3Itineraries,
190 [FeatureLeon, LeonCASA]>;
193 def : Processor<"leon4", LEON4Itineraries,
194 [FeatureLeon, UMACSMACSupport, LeonCASA]>;
197 // TO DO: Place-holder: Processor specific features will be added *very* soon here.
198 def : Processor<"gr740", LEON4Itineraries,
199 [FeatureLeon, UMACSMACSupport, LeonCASA, LeonCycleCounter,
202 //===----------------------------------------------------------------------===//
203 // Declare the target which we are implementing
204 //===----------------------------------------------------------------------===//
206 def SparcAsmWriter : AsmWriter {
207 string AsmWriterClassName = "InstPrinter";
208 int PassSubtarget = 1;
213 // Pull in Instruction Info:
214 let InstructionSet = SparcInstrInfo;
215 let AssemblyParsers = [SparcAsmParser];
216 let AssemblyParserVariants = [SparcAsmParserVariant];
217 let AssemblyWriters = [SparcAsmWriter];
218 let AllowRegisterRenaming = 1;