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