blob: 91cab00b2b651a2fc398e2fadb432b157a077e0d [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +00001//===-- Sparc.td - Describe the Sparc Target Machine -------*- tablegen -*-===//
2//
Chris Lattner158e1f52006-02-05 05:50:24 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Jia Liub22310f2012-02-18 12:03:15 +00007//
Chris Lattner158e1f52006-02-05 05:50:24 +00008//===----------------------------------------------------------------------===//
9//
10//
11//===----------------------------------------------------------------------===//
12
13//===----------------------------------------------------------------------===//
14// Target-independent interfaces which we are implementing
15//===----------------------------------------------------------------------===//
16
Evan Cheng977e7be2008-11-24 07:34:46 +000017include "llvm/Target/Target.td"
Chris Lattner158e1f52006-02-05 05:50:24 +000018
19//===----------------------------------------------------------------------===//
20// SPARC Subtarget features.
21//
Venkatraman Govindarajua54533ed2013-06-04 18:33:25 +000022
James Y Knightdda87ca2017-07-18 19:08:38 +000023def FeatureSoftMulDiv
24 : SubtargetFeature<"soft-mul-div", "UseSoftMulDiv", "true",
25 "Use software emulation for integer multiply and divide">;
26
Chris Lattner158e1f52006-02-05 05:50:24 +000027def FeatureV9
James Y Knight2cc9da92016-08-12 14:48:09 +000028 : SubtargetFeature<"v9", "IsV9", "true",
29 "Enable SPARC-V9 instructions">;
Chris Lattner158e1f52006-02-05 05:50:24 +000030def FeatureV8Deprecated
James Y Knight2cc9da92016-08-12 14:48:09 +000031 : SubtargetFeature<"deprecated-v8", "V8DeprecatedInsts", "true",
32 "Enable deprecated V8 instructions in V9 mode">;
Chris Lattner158e1f52006-02-05 05:50:24 +000033def FeatureVIS
James Y Knight2cc9da92016-08-12 14:48:09 +000034 : SubtargetFeature<"vis", "IsVIS", "true",
35 "Enable UltraSPARC Visual Instruction Set extensions">;
Venkatraman Govindarajuf9a202a2014-03-02 19:31:21 +000036def FeatureVIS2
James Y Knight2cc9da92016-08-12 14:48:09 +000037 : SubtargetFeature<"vis2", "IsVIS2", "true",
38 "Enable Visual Instruction Set extensions II">;
Venkatraman Govindarajuf9a202a2014-03-02 19:31:21 +000039def FeatureVIS3
James Y Knight2cc9da92016-08-12 14:48:09 +000040 : SubtargetFeature<"vis3", "IsVIS3", "true",
41 "Enable Visual Instruction Set extensions III">;
Chris Dewhurst60197022016-04-22 08:17:17 +000042def FeatureLeon
James Y Knight2cc9da92016-08-12 14:48:09 +000043 : SubtargetFeature<"leon", "IsLeon", "true",
44 "Enable LEON extensions">;
Chris Lattner158e1f52006-02-05 05:50:24 +000045
Venkatraman Govindaraju35e0c382013-08-25 18:30:06 +000046def FeatureHardQuad
James Y Knight2cc9da92016-08-12 14:48:09 +000047 : SubtargetFeature<"hard-quad-float", "HasHardQuad", "true",
48 "Enable quad-word floating point instructions">;
Venkatraman Govindaraju35e0c382013-08-25 18:30:06 +000049
Jakob Stoklund Olesenead3b3d2014-01-26 06:09:59 +000050def UsePopc : SubtargetFeature<"popc", "UsePopc", "true",
51 "Use the popc (population count) instruction">;
52
James Y Knight2cc9da92016-08-12 14:48:09 +000053def FeatureSoftFloat : SubtargetFeature<"soft-float", "UseSoftFloat", "true",
54 "Use software emulation for floating point">;
Chris Dewhurst68388a02016-05-18 09:14:13 +000055
James Y Knight2cc9da92016-08-12 14:48:09 +000056//==== Features added predmoninantly for LEON subtarget support
Chris Dewhurste3b86452016-05-09 11:55:15 +000057include "LeonFeatures.td"
58
Chris Lattner158e1f52006-02-05 05:50:24 +000059//===----------------------------------------------------------------------===//
Chris Lattner49b269d2008-03-17 05:41:48 +000060// Register File, Calling Conv, Instruction Descriptions
Chris Lattner158e1f52006-02-05 05:50:24 +000061//===----------------------------------------------------------------------===//
62
63include "SparcRegisterInfo.td"
Chris Lattner49b269d2008-03-17 05:41:48 +000064include "SparcCallingConv.td"
Chris Dewhurst60197022016-04-22 08:17:17 +000065include "SparcSchedule.td"
Chris Lattner158e1f52006-02-05 05:50:24 +000066include "SparcInstrInfo.td"
67
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +000068def SparcInstrInfo : InstrInfo;
Chris Lattner158e1f52006-02-05 05:50:24 +000069
James Y Knight2cc9da92016-08-12 14:48:09 +000070def SparcAsmParser : AsmParser {
71 bit ShouldEmitMatchRegisterName = 0;
72}
Venkatraman Govindarajuc2dee7d2014-01-04 11:30:13 +000073
Chris Lattner158e1f52006-02-05 05:50:24 +000074//===----------------------------------------------------------------------===//
75// SPARC processors supported.
76//===----------------------------------------------------------------------===//
77
78class Proc<string Name, list<SubtargetFeature> Features>
James Y Knight2cc9da92016-08-12 14:48:09 +000079 : Processor<Name, NoItineraries, Features>;
Chris Lattner158e1f52006-02-05 05:50:24 +000080
James Y Knight2cc9da92016-08-12 14:48:09 +000081def : Proc<"generic", []>;
James Y Knightdda87ca2017-07-18 19:08:38 +000082def : Proc<"v7", [FeatureSoftMulDiv]>;
James Y Knight2cc9da92016-08-12 14:48:09 +000083def : Proc<"v8", []>;
84def : Proc<"supersparc", []>;
85def : Proc<"sparclite", []>;
86def : Proc<"f934", []>;
87def : Proc<"hypersparc", []>;
88def : Proc<"sparclite86x", []>;
89def : Proc<"sparclet", []>;
90def : Proc<"tsc701", []>;
Douglas Katzman8ea02f42016-09-13 17:51:41 +000091def : Proc<"myriad2", [FeatureLeon, LeonCASA]>;
92def : Proc<"myriad2.1", [FeatureLeon, LeonCASA]>;
93def : Proc<"myriad2.2", [FeatureLeon, LeonCASA]>;
94def : Proc<"ma2100", [FeatureLeon, LeonCASA]>;
95def : Proc<"ma2150", [FeatureLeon, LeonCASA]>;
96def : Proc<"ma2450", [FeatureLeon, LeonCASA]>;
James Y Knight2cc9da92016-08-12 14:48:09 +000097def : Proc<"v9", [FeatureV9]>;
98def : Proc<"ultrasparc", [FeatureV9, FeatureV8Deprecated, FeatureVIS]>;
99def : Proc<"ultrasparc3", [FeatureV9, FeatureV8Deprecated, FeatureVIS,
100 FeatureVIS2]>;
101def : Proc<"niagara", [FeatureV9, FeatureV8Deprecated, FeatureVIS,
102 FeatureVIS2]>;
103def : Proc<"niagara2", [FeatureV9, FeatureV8Deprecated, UsePopc,
104 FeatureVIS, FeatureVIS2]>;
105def : Proc<"niagara3", [FeatureV9, FeatureV8Deprecated, UsePopc,
106 FeatureVIS, FeatureVIS2]>;
107def : Proc<"niagara4", [FeatureV9, FeatureV8Deprecated, UsePopc,
108 FeatureVIS, FeatureVIS2, FeatureVIS3]>;
Chris Lattner158e1f52006-02-05 05:50:24 +0000109
Chris Dewhurst60197022016-04-22 08:17:17 +0000110// LEON 2 FT generic
James Y Knight2cc9da92016-08-12 14:48:09 +0000111def : Processor<"leon2", LEON2Itineraries,
112 [FeatureLeon]>;
Chris Dewhurst60197022016-04-22 08:17:17 +0000113
114// LEON 2 FT (AT697E)
James Y Knight2cc9da92016-08-12 14:48:09 +0000115// TO DO: Place-holder: Processor specific features will be added *very* soon here.
116def : Processor<"at697e", LEON2Itineraries,
Chris Dewhurst85013122016-10-10 08:53:06 +0000117 [FeatureLeon, ReplaceSDIV, InsertNOPLoad]>;
Chris Dewhurst60197022016-04-22 08:17:17 +0000118
119// LEON 2 FT (AT697F)
James Y Knight2cc9da92016-08-12 14:48:09 +0000120// TO DO: Place-holder: Processor specific features will be added *very* soon here.
Chris Dewhurst60197022016-04-22 08:17:17 +0000121def : Processor<"at697f", LEON2Itineraries,
James Y Knight2cc9da92016-08-12 14:48:09 +0000122 [FeatureLeon, InsertNOPLoad]>;
123
Chris Dewhurst60197022016-04-22 08:17:17 +0000124
125// LEON 3 FT generic
James Y Knight2cc9da92016-08-12 14:48:09 +0000126def : Processor<"leon3", LEON3Itineraries,
127 [FeatureLeon, UMACSMACSupport]>;
Chris Dewhurst60197022016-04-22 08:17:17 +0000128
Chris Dewhurst7d8412f2016-05-16 11:02:00 +0000129// LEON 3 FT (UT699). Provides features for the UT699 processor
James Y Knight2cc9da92016-08-12 14:48:09 +0000130// - covers all the erratum fixes for LEON3, but does not support the CASA instruction.
131def : Processor<"ut699", LEON3Itineraries,
132 [FeatureLeon, InsertNOPLoad, FixFSMULD, ReplaceFMULS, FixAllFDIVSQRT]>;
Chris Dewhurst60197022016-04-22 08:17:17 +0000133
Chris Dewhurst7d8412f2016-05-16 11:02:00 +0000134// LEON3 FT (GR712RC). Provides features for the GR712RC processor.
James Y Knight2cc9da92016-08-12 14:48:09 +0000135// - covers all the erratum fixed for LEON3 and support for the CASA instruction.
Chris Dewhurst60197022016-04-22 08:17:17 +0000136def : Processor<"gr712rc", LEON3Itineraries,
James Y Knight2cc9da92016-08-12 14:48:09 +0000137 [FeatureLeon, LeonCASA]>;
Chris Dewhurst60197022016-04-22 08:17:17 +0000138
139// LEON 4 FT generic
140def : Processor<"leon4", LEON4Itineraries,
James Y Knight2cc9da92016-08-12 14:48:09 +0000141 [FeatureLeon, UMACSMACSupport, LeonCASA]>;
Chris Dewhurst60197022016-04-22 08:17:17 +0000142
James Y Knight2cc9da92016-08-12 14:48:09 +0000143// LEON 4 FT (GR740)
144// TO DO: Place-holder: Processor specific features will be added *very* soon here.
145def : Processor<"gr740", LEON4Itineraries,
146 [FeatureLeon, UMACSMACSupport, LeonCASA]>;
Chris Lattner158e1f52006-02-05 05:50:24 +0000147
148//===----------------------------------------------------------------------===//
149// Declare the target which we are implementing
150//===----------------------------------------------------------------------===//
151
Akira Hatanaka725657b2015-03-28 04:03:51 +0000152def SparcAsmWriter : AsmWriter {
James Y Knight2cc9da92016-08-12 14:48:09 +0000153 string AsmWriterClassName = "InstPrinter";
Akira Hatanaka725657b2015-03-28 04:03:51 +0000154 int PassSubtarget = 1;
155 int Variant = 0;
156}
157
Chris Lattner158e1f52006-02-05 05:50:24 +0000158def Sparc : Target {
Chris Lattner158e1f52006-02-05 05:50:24 +0000159 // Pull in Instruction Info:
160 let InstructionSet = SparcInstrInfo;
James Y Knight2cc9da92016-08-12 14:48:09 +0000161 let AssemblyParsers = [SparcAsmParser];
162 let AssemblyWriters = [SparcAsmWriter];
Chris Lattner158e1f52006-02-05 05:50:24 +0000163}