xref: /aosp_15_r20/external/llvm/lib/Target/Mips/Mips.td (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker//===-- Mips.td - Describe the Mips Target Machine ---------*- tablegen -*-===//
2*9880d681SAndroid Build Coastguard Worker//
3*9880d681SAndroid Build Coastguard Worker//                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker//
5*9880d681SAndroid Build Coastguard Worker// This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker// License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker//
8*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker// This is the top level entry point for the Mips target.
10*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
13*9880d681SAndroid Build Coastguard Worker// Target-independent interfaces
14*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerinclude "llvm/Target/Target.td"
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker// The overall idea of the PredicateControl class is to chop the Predicates list
19*9880d681SAndroid Build Coastguard Worker// into subsets that are usually overridden independently. This allows
20*9880d681SAndroid Build Coastguard Worker// subclasses to partially override the predicates of their superclasses without
21*9880d681SAndroid Build Coastguard Worker// having to re-add all the existing predicates.
22*9880d681SAndroid Build Coastguard Workerclass PredicateControl {
23*9880d681SAndroid Build Coastguard Worker  // Predicates for the encoding scheme in use such as HasStdEnc
24*9880d681SAndroid Build Coastguard Worker  list<Predicate> EncodingPredicates = [];
25*9880d681SAndroid Build Coastguard Worker  // Predicates for the GPR size such as IsGP64bit
26*9880d681SAndroid Build Coastguard Worker  list<Predicate> GPRPredicates = [];
27*9880d681SAndroid Build Coastguard Worker  // Predicates for the PTR size such as IsPTR64bit
28*9880d681SAndroid Build Coastguard Worker  list<Predicate> PTRPredicates = [];
29*9880d681SAndroid Build Coastguard Worker  // Predicates for the FGR size and layout such as IsFP64bit
30*9880d681SAndroid Build Coastguard Worker  list<Predicate> FGRPredicates = [];
31*9880d681SAndroid Build Coastguard Worker  // Predicates for the instruction group membership such as ISA's and ASE's
32*9880d681SAndroid Build Coastguard Worker  list<Predicate> InsnPredicates = [];
33*9880d681SAndroid Build Coastguard Worker  // Predicate for marking the instruction as usable in hard-float mode only.
34*9880d681SAndroid Build Coastguard Worker  list<Predicate> HardFloatPredicate = [];
35*9880d681SAndroid Build Coastguard Worker  // Predicates for anything else
36*9880d681SAndroid Build Coastguard Worker  list<Predicate> AdditionalPredicates = [];
37*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = !listconcat(EncodingPredicates,
38*9880d681SAndroid Build Coastguard Worker                                           GPRPredicates,
39*9880d681SAndroid Build Coastguard Worker                                           PTRPredicates,
40*9880d681SAndroid Build Coastguard Worker                                           FGRPredicates,
41*9880d681SAndroid Build Coastguard Worker                                           InsnPredicates,
42*9880d681SAndroid Build Coastguard Worker                                           HardFloatPredicate,
43*9880d681SAndroid Build Coastguard Worker                                           AdditionalPredicates);
44*9880d681SAndroid Build Coastguard Worker}
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Worker// Like Requires<> but for the AdditionalPredicates list
47*9880d681SAndroid Build Coastguard Workerclass AdditionalRequires<list<Predicate> preds> {
48*9880d681SAndroid Build Coastguard Worker  list<Predicate> AdditionalPredicates = preds;
49*9880d681SAndroid Build Coastguard Worker}
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
52*9880d681SAndroid Build Coastguard Worker// Register File, Calling Conv, Instruction Descriptions
53*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard Workerinclude "MipsRegisterInfo.td"
56*9880d681SAndroid Build Coastguard Workerinclude "MipsSchedule.td"
57*9880d681SAndroid Build Coastguard Workerinclude "MipsInstrInfo.td"
58*9880d681SAndroid Build Coastguard Workerinclude "MipsCallingConv.td"
59*9880d681SAndroid Build Coastguard Worker
60*9880d681SAndroid Build Coastguard Workerdef MipsInstrInfo : InstrInfo;
61*9880d681SAndroid Build Coastguard Worker
62*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
63*9880d681SAndroid Build Coastguard Worker// Mips Subtarget features                                                    //
64*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
65*9880d681SAndroid Build Coastguard Worker
66*9880d681SAndroid Build Coastguard Workerdef FeatureNoABICalls  : SubtargetFeature<"noabicalls", "NoABICalls", "true",
67*9880d681SAndroid Build Coastguard Worker                                "Disable SVR4-style position-independent code">;
68*9880d681SAndroid Build Coastguard Workerdef FeaturePTR64Bit    : SubtargetFeature<"ptr64", "IsPTR64bit", "true",
69*9880d681SAndroid Build Coastguard Worker                                "Pointers are 64-bit wide">;
70*9880d681SAndroid Build Coastguard Workerdef FeatureGP64Bit     : SubtargetFeature<"gp64", "IsGP64bit", "true",
71*9880d681SAndroid Build Coastguard Worker                                "General Purpose Registers are 64-bit wide">;
72*9880d681SAndroid Build Coastguard Workerdef FeatureFP64Bit     : SubtargetFeature<"fp64", "IsFP64bit", "true",
73*9880d681SAndroid Build Coastguard Worker                                "Support 64-bit FP registers">;
74*9880d681SAndroid Build Coastguard Workerdef FeatureFPXX        : SubtargetFeature<"fpxx", "IsFPXX", "true",
75*9880d681SAndroid Build Coastguard Worker                                "Support for FPXX">;
76*9880d681SAndroid Build Coastguard Workerdef FeatureNaN2008     : SubtargetFeature<"nan2008", "IsNaN2008bit", "true",
77*9880d681SAndroid Build Coastguard Worker                                "IEEE 754-2008 NaN encoding">;
78*9880d681SAndroid Build Coastguard Workerdef FeatureSingleFloat : SubtargetFeature<"single-float", "IsSingleFloat",
79*9880d681SAndroid Build Coastguard Worker                                "true", "Only supports single precision float">;
80*9880d681SAndroid Build Coastguard Workerdef FeatureSoftFloat   : SubtargetFeature<"soft-float", "IsSoftFloat", "true",
81*9880d681SAndroid Build Coastguard Worker                                "Does not support floating point instructions">;
82*9880d681SAndroid Build Coastguard Workerdef FeatureNoOddSPReg  : SubtargetFeature<"nooddspreg", "UseOddSPReg", "false",
83*9880d681SAndroid Build Coastguard Worker                              "Disable odd numbered single-precision "
84*9880d681SAndroid Build Coastguard Worker                              "registers">;
85*9880d681SAndroid Build Coastguard Workerdef FeatureVFPU        : SubtargetFeature<"vfpu", "HasVFPU",
86*9880d681SAndroid Build Coastguard Worker                                "true", "Enable vector FPU instructions">;
87*9880d681SAndroid Build Coastguard Workerdef FeatureMips1       : SubtargetFeature<"mips1", "MipsArchVersion", "Mips1",
88*9880d681SAndroid Build Coastguard Worker                                "Mips I ISA Support [highly experimental]">;
89*9880d681SAndroid Build Coastguard Workerdef FeatureMips2       : SubtargetFeature<"mips2", "MipsArchVersion", "Mips2",
90*9880d681SAndroid Build Coastguard Worker                                "Mips II ISA Support [highly experimental]",
91*9880d681SAndroid Build Coastguard Worker                                [FeatureMips1]>;
92*9880d681SAndroid Build Coastguard Workerdef FeatureMips3_32    : SubtargetFeature<"mips3_32", "HasMips3_32", "true",
93*9880d681SAndroid Build Coastguard Worker                                "Subset of MIPS-III that is also in MIPS32 "
94*9880d681SAndroid Build Coastguard Worker                                "[highly experimental]">;
95*9880d681SAndroid Build Coastguard Workerdef FeatureMips3_32r2  : SubtargetFeature<"mips3_32r2", "HasMips3_32r2", "true",
96*9880d681SAndroid Build Coastguard Worker                                "Subset of MIPS-III that is also in MIPS32r2 "
97*9880d681SAndroid Build Coastguard Worker                                "[highly experimental]">;
98*9880d681SAndroid Build Coastguard Workerdef FeatureMips3       : SubtargetFeature<"mips3", "MipsArchVersion", "Mips3",
99*9880d681SAndroid Build Coastguard Worker                                "MIPS III ISA Support [highly experimental]",
100*9880d681SAndroid Build Coastguard Worker                                [FeatureMips2, FeatureMips3_32,
101*9880d681SAndroid Build Coastguard Worker                                 FeatureMips3_32r2, FeatureGP64Bit,
102*9880d681SAndroid Build Coastguard Worker                                 FeatureFP64Bit]>;
103*9880d681SAndroid Build Coastguard Workerdef FeatureMips4_32    : SubtargetFeature<"mips4_32", "HasMips4_32", "true",
104*9880d681SAndroid Build Coastguard Worker                                "Subset of MIPS-IV that is also in MIPS32 "
105*9880d681SAndroid Build Coastguard Worker                                "[highly experimental]">;
106*9880d681SAndroid Build Coastguard Workerdef FeatureMips4_32r2  : SubtargetFeature<"mips4_32r2", "HasMips4_32r2", "true",
107*9880d681SAndroid Build Coastguard Worker                                "Subset of MIPS-IV that is also in MIPS32r2 "
108*9880d681SAndroid Build Coastguard Worker                                "[highly experimental]">;
109*9880d681SAndroid Build Coastguard Workerdef FeatureMips4       : SubtargetFeature<"mips4", "MipsArchVersion",
110*9880d681SAndroid Build Coastguard Worker                                "Mips4", "MIPS IV ISA Support",
111*9880d681SAndroid Build Coastguard Worker                                [FeatureMips3, FeatureMips4_32,
112*9880d681SAndroid Build Coastguard Worker                                 FeatureMips4_32r2]>;
113*9880d681SAndroid Build Coastguard Workerdef FeatureMips5_32r2  : SubtargetFeature<"mips5_32r2", "HasMips5_32r2", "true",
114*9880d681SAndroid Build Coastguard Worker                                "Subset of MIPS-V that is also in MIPS32r2 "
115*9880d681SAndroid Build Coastguard Worker                                "[highly experimental]">;
116*9880d681SAndroid Build Coastguard Workerdef FeatureMips5       : SubtargetFeature<"mips5", "MipsArchVersion", "Mips5",
117*9880d681SAndroid Build Coastguard Worker                                "MIPS V ISA Support [highly experimental]",
118*9880d681SAndroid Build Coastguard Worker                                [FeatureMips4, FeatureMips5_32r2]>;
119*9880d681SAndroid Build Coastguard Workerdef FeatureMips32      : SubtargetFeature<"mips32", "MipsArchVersion", "Mips32",
120*9880d681SAndroid Build Coastguard Worker                                "Mips32 ISA Support",
121*9880d681SAndroid Build Coastguard Worker                                [FeatureMips2, FeatureMips3_32,
122*9880d681SAndroid Build Coastguard Worker                                 FeatureMips4_32]>;
123*9880d681SAndroid Build Coastguard Workerdef FeatureMips32r2    : SubtargetFeature<"mips32r2", "MipsArchVersion",
124*9880d681SAndroid Build Coastguard Worker                                "Mips32r2", "Mips32r2 ISA Support",
125*9880d681SAndroid Build Coastguard Worker                                [FeatureMips3_32r2, FeatureMips4_32r2,
126*9880d681SAndroid Build Coastguard Worker                                 FeatureMips5_32r2, FeatureMips32]>;
127*9880d681SAndroid Build Coastguard Workerdef FeatureMips32r3    : SubtargetFeature<"mips32r3", "MipsArchVersion",
128*9880d681SAndroid Build Coastguard Worker                                "Mips32r3", "Mips32r3 ISA Support",
129*9880d681SAndroid Build Coastguard Worker                                [FeatureMips32r2]>;
130*9880d681SAndroid Build Coastguard Workerdef FeatureMips32r5    : SubtargetFeature<"mips32r5", "MipsArchVersion",
131*9880d681SAndroid Build Coastguard Worker                                "Mips32r5", "Mips32r5 ISA Support",
132*9880d681SAndroid Build Coastguard Worker                                [FeatureMips32r3]>;
133*9880d681SAndroid Build Coastguard Workerdef FeatureMips32r6    : SubtargetFeature<"mips32r6", "MipsArchVersion",
134*9880d681SAndroid Build Coastguard Worker                                "Mips32r6",
135*9880d681SAndroid Build Coastguard Worker                                "Mips32r6 ISA Support [experimental]",
136*9880d681SAndroid Build Coastguard Worker                                [FeatureMips32r5, FeatureFP64Bit,
137*9880d681SAndroid Build Coastguard Worker                                 FeatureNaN2008]>;
138*9880d681SAndroid Build Coastguard Workerdef FeatureMips64      : SubtargetFeature<"mips64", "MipsArchVersion",
139*9880d681SAndroid Build Coastguard Worker                                "Mips64", "Mips64 ISA Support",
140*9880d681SAndroid Build Coastguard Worker                                [FeatureMips5, FeatureMips32]>;
141*9880d681SAndroid Build Coastguard Workerdef FeatureMips64r2    : SubtargetFeature<"mips64r2", "MipsArchVersion",
142*9880d681SAndroid Build Coastguard Worker                                "Mips64r2", "Mips64r2 ISA Support",
143*9880d681SAndroid Build Coastguard Worker                                [FeatureMips64, FeatureMips32r2]>;
144*9880d681SAndroid Build Coastguard Workerdef FeatureMips64r3    : SubtargetFeature<"mips64r3", "MipsArchVersion",
145*9880d681SAndroid Build Coastguard Worker                                "Mips64r3", "Mips64r3 ISA Support",
146*9880d681SAndroid Build Coastguard Worker                                [FeatureMips64r2, FeatureMips32r3]>;
147*9880d681SAndroid Build Coastguard Workerdef FeatureMips64r5    : SubtargetFeature<"mips64r5", "MipsArchVersion",
148*9880d681SAndroid Build Coastguard Worker                                "Mips64r5", "Mips64r5 ISA Support",
149*9880d681SAndroid Build Coastguard Worker                                [FeatureMips64r3, FeatureMips32r5]>;
150*9880d681SAndroid Build Coastguard Workerdef FeatureMips64r6    : SubtargetFeature<"mips64r6", "MipsArchVersion",
151*9880d681SAndroid Build Coastguard Worker                                "Mips64r6",
152*9880d681SAndroid Build Coastguard Worker                                "Mips64r6 ISA Support [experimental]",
153*9880d681SAndroid Build Coastguard Worker                                [FeatureMips32r6, FeatureMips64r5,
154*9880d681SAndroid Build Coastguard Worker                                 FeatureNaN2008]>;
155*9880d681SAndroid Build Coastguard Worker
156*9880d681SAndroid Build Coastguard Workerdef FeatureMips16  : SubtargetFeature<"mips16", "InMips16Mode", "true",
157*9880d681SAndroid Build Coastguard Worker                                      "Mips16 mode">;
158*9880d681SAndroid Build Coastguard Worker
159*9880d681SAndroid Build Coastguard Workerdef FeatureDSP : SubtargetFeature<"dsp", "HasDSP", "true", "Mips DSP ASE">;
160*9880d681SAndroid Build Coastguard Workerdef FeatureDSPR2 : SubtargetFeature<"dspr2", "HasDSPR2", "true",
161*9880d681SAndroid Build Coastguard Worker                                    "Mips DSP-R2 ASE", [FeatureDSP]>;
162*9880d681SAndroid Build Coastguard Workerdef FeatureDSPR3
163*9880d681SAndroid Build Coastguard Worker    : SubtargetFeature<"dspr3", "HasDSPR3", "true", "Mips DSP-R3 ASE",
164*9880d681SAndroid Build Coastguard Worker                       [ FeatureDSP, FeatureDSPR2 ]>;
165*9880d681SAndroid Build Coastguard Worker
166*9880d681SAndroid Build Coastguard Workerdef FeatureMSA : SubtargetFeature<"msa", "HasMSA", "true", "Mips MSA ASE">;
167*9880d681SAndroid Build Coastguard Worker
168*9880d681SAndroid Build Coastguard Workerdef FeatureEVA : SubtargetFeature<"eva", "HasEVA", "true", "Mips EVA ASE">;
169*9880d681SAndroid Build Coastguard Worker
170*9880d681SAndroid Build Coastguard Workerdef FeatureMicroMips  : SubtargetFeature<"micromips", "InMicroMipsMode", "true",
171*9880d681SAndroid Build Coastguard Worker                                         "microMips mode">;
172*9880d681SAndroid Build Coastguard Worker
173*9880d681SAndroid Build Coastguard Workerdef FeatureCnMips     : SubtargetFeature<"cnmips", "HasCnMips",
174*9880d681SAndroid Build Coastguard Worker                                "true", "Octeon cnMIPS Support",
175*9880d681SAndroid Build Coastguard Worker                                [FeatureMips64r2]>;
176*9880d681SAndroid Build Coastguard Worker
177*9880d681SAndroid Build Coastguard Workerdef FeatureUseTCCInDIV : SubtargetFeature<
178*9880d681SAndroid Build Coastguard Worker                               "use-tcc-in-div",
179*9880d681SAndroid Build Coastguard Worker                               "UseTCCInDIV", "false",
180*9880d681SAndroid Build Coastguard Worker                               "Force the assembler to use trapping">;
181*9880d681SAndroid Build Coastguard Worker
182*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
183*9880d681SAndroid Build Coastguard Worker// Mips processors supported.
184*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
185*9880d681SAndroid Build Coastguard Worker
186*9880d681SAndroid Build Coastguard Workerdef ImplP5600 : SubtargetFeature<"p5600", "ProcImpl",
187*9880d681SAndroid Build Coastguard Worker                                 "MipsSubtarget::CPU::P5600",
188*9880d681SAndroid Build Coastguard Worker                                 "The P5600 Processor", [FeatureMips32r5]>;
189*9880d681SAndroid Build Coastguard Worker
190*9880d681SAndroid Build Coastguard Workerclass Proc<string Name, list<SubtargetFeature> Features>
191*9880d681SAndroid Build Coastguard Worker : Processor<Name, MipsGenericItineraries, Features>;
192*9880d681SAndroid Build Coastguard Worker
193*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips1", [FeatureMips1]>;
194*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips2", [FeatureMips2]>;
195*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips32", [FeatureMips32]>;
196*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips32r2", [FeatureMips32r2]>;
197*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips32r3", [FeatureMips32r3]>;
198*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips32r5", [FeatureMips32r5]>;
199*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips32r6", [FeatureMips32r6]>;
200*9880d681SAndroid Build Coastguard Worker
201*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips3", [FeatureMips3]>;
202*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips4", [FeatureMips4]>;
203*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips5", [FeatureMips5]>;
204*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips64", [FeatureMips64]>;
205*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips64r2", [FeatureMips64r2]>;
206*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips64r3", [FeatureMips64r3]>;
207*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips64r5", [FeatureMips64r5]>;
208*9880d681SAndroid Build Coastguard Workerdef : Proc<"mips64r6", [FeatureMips64r6]>;
209*9880d681SAndroid Build Coastguard Workerdef : Proc<"octeon", [FeatureMips64r2, FeatureCnMips]>;
210*9880d681SAndroid Build Coastguard Workerdef : ProcessorModel<"p5600", MipsP5600Model, [ImplP5600]>;
211*9880d681SAndroid Build Coastguard Worker
212*9880d681SAndroid Build Coastguard Workerdef MipsAsmParser : AsmParser {
213*9880d681SAndroid Build Coastguard Worker  let ShouldEmitMatchRegisterName = 0;
214*9880d681SAndroid Build Coastguard Worker}
215*9880d681SAndroid Build Coastguard Worker
216*9880d681SAndroid Build Coastguard Workerdef MipsAsmParserVariant : AsmParserVariant {
217*9880d681SAndroid Build Coastguard Worker  int Variant = 0;
218*9880d681SAndroid Build Coastguard Worker
219*9880d681SAndroid Build Coastguard Worker  // Recognize hard coded registers.
220*9880d681SAndroid Build Coastguard Worker  string RegisterPrefix = "$";
221*9880d681SAndroid Build Coastguard Worker}
222*9880d681SAndroid Build Coastguard Worker
223*9880d681SAndroid Build Coastguard Workerdef Mips : Target {
224*9880d681SAndroid Build Coastguard Worker  let InstructionSet = MipsInstrInfo;
225*9880d681SAndroid Build Coastguard Worker  let AssemblyParsers = [MipsAsmParser];
226*9880d681SAndroid Build Coastguard Worker  let AssemblyParserVariants = [MipsAsmParserVariant];
227*9880d681SAndroid Build Coastguard Worker}
228