1 //===-- Mips.td - Describe the Mips Target Machine ---------*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
9 // This is the top level entry point for the Mips target.
10 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
13 // Target-independent interfaces
14 //===----------------------------------------------------------------------===//
16 include "llvm/Target/Target.td"
18 // The overall idea of the PredicateControl class is to chop the Predicates list
19 // into subsets that are usually overridden independently. This allows
20 // subclasses to partially override the predicates of their superclasses without
21 // having to re-add all the existing predicates.
22 class PredicateControl {
23 // Predicates for the encoding scheme in use such as HasStdEnc
24 list<Predicate> EncodingPredicates = [];
25 // Predicates for the GPR size such as IsGP64bit
26 list<Predicate> GPRPredicates = [];
27 // Predicates for the FGR size and layout such as IsFP64bit
28 list<Predicate> FGRPredicates = [];
29 // Predicates for the instruction group membership such as ISA's and ASE's
30 list<Predicate> InsnPredicates = [];
31 // Predicates for anything else
32 list<Predicate> AdditionalPredicates = [];
33 list<Predicate> Predicates = !listconcat(EncodingPredicates,
37 AdditionalPredicates);
40 // Like Requires<> but for the AdditionalPredicates list
41 class AdditionalRequires<list<Predicate> preds> {
42 list<Predicate> AdditionalPredicates = preds;
45 //===----------------------------------------------------------------------===//
46 // Register File, Calling Conv, Instruction Descriptions
47 //===----------------------------------------------------------------------===//
49 include "MipsRegisterInfo.td"
50 include "MipsSchedule.td"
51 include "MipsInstrInfo.td"
52 include "MipsCallingConv.td"
54 def MipsInstrInfo : InstrInfo;
56 //===----------------------------------------------------------------------===//
57 // Mips Subtarget features //
58 //===----------------------------------------------------------------------===//
60 def FeatureGP64Bit : SubtargetFeature<"gp64", "IsGP64bit", "true",
61 "General Purpose Registers are 64-bit wide.">;
62 def FeatureFP64Bit : SubtargetFeature<"fp64", "IsFP64bit", "true",
63 "Support 64-bit FP registers.">;
64 def FeatureNaN2008 : SubtargetFeature<"nan2008", "IsNaN2008bit", "true",
65 "IEEE 754-2008 NaN encoding.">;
66 def FeatureSingleFloat : SubtargetFeature<"single-float", "IsSingleFloat",
67 "true", "Only supports single precision float">;
68 def FeatureO32 : SubtargetFeature<"o32", "MipsABI", "O32",
70 def FeatureN32 : SubtargetFeature<"n32", "MipsABI", "N32",
72 def FeatureN64 : SubtargetFeature<"n64", "MipsABI", "N64",
74 def FeatureEABI : SubtargetFeature<"eabi", "MipsABI", "EABI",
76 def FeatureVFPU : SubtargetFeature<"vfpu", "HasVFPU",
77 "true", "Enable vector FPU instructions.">;
78 def FeatureSEInReg : SubtargetFeature<"seinreg", "HasSEInReg", "true",
79 "Enable 'signext in register' instructions.">;
80 def FeatureCondMov : SubtargetFeature<"condmov", "HasCondMov", "true",
81 "Enable 'conditional move' instructions.">;
82 def FeatureSwap : SubtargetFeature<"swap", "HasSwap", "true",
83 "Enable 'byte/half swap' instructions.">;
84 def FeatureBitCount : SubtargetFeature<"bitcount", "HasBitCount", "true",
85 "Enable 'count leading bits' instructions.">;
86 def FeatureFPIdx : SubtargetFeature<"fpidx", "HasFPIdx", "true",
87 "Enable 'FP indexed load/store' instructions.">;
88 def FeatureMips32 : SubtargetFeature<"mips32", "MipsArchVersion", "Mips32",
90 [FeatureCondMov, FeatureBitCount]>;
91 def FeatureMips32r2 : SubtargetFeature<"mips32r2", "MipsArchVersion",
92 "Mips32r2", "Mips32r2 ISA Support",
93 [FeatureMips32, FeatureSEInReg, FeatureSwap,
95 def FeatureMips4 : SubtargetFeature<"mips4", "MipsArchVersion",
96 "Mips4", "MIPS IV ISA Support",
97 [FeatureGP64Bit, FeatureFP64Bit, FeatureFPIdx,
99 def FeatureMips64 : SubtargetFeature<"mips64", "MipsArchVersion",
100 "Mips64", "Mips64 ISA Support",
101 [FeatureMips4, FeatureMips32, FeatureFPIdx]>;
102 def FeatureMips64r2 : SubtargetFeature<"mips64r2", "MipsArchVersion",
103 "Mips64r2", "Mips64r2 ISA Support",
104 [FeatureMips64, FeatureMips32r2]>;
106 def FeatureMips16 : SubtargetFeature<"mips16", "InMips16Mode", "true",
109 def FeatureDSP : SubtargetFeature<"dsp", "HasDSP", "true", "Mips DSP ASE">;
110 def FeatureDSPR2 : SubtargetFeature<"dspr2", "HasDSPR2", "true",
111 "Mips DSP-R2 ASE", [FeatureDSP]>;
113 def FeatureMSA : SubtargetFeature<"msa", "HasMSA", "true", "Mips MSA ASE">;
115 def FeatureMicroMips : SubtargetFeature<"micromips", "InMicroMipsMode", "true",
118 def FeatureCnMips : SubtargetFeature<"cnmips", "HasCnMips",
119 "true", "Octeon cnMIPS Support",
122 //===----------------------------------------------------------------------===//
123 // Mips processors supported.
124 //===----------------------------------------------------------------------===//
126 class Proc<string Name, list<SubtargetFeature> Features>
127 : Processor<Name, MipsGenericItineraries, Features>;
129 def : Proc<"mips32", [FeatureMips32, FeatureO32]>;
130 def : Proc<"mips32r2", [FeatureMips32r2, FeatureO32]>;
131 def : Proc<"mips4", [FeatureMips4, FeatureN64]>;
132 def : Proc<"mips64", [FeatureMips64, FeatureN64]>;
133 def : Proc<"mips64r2", [FeatureMips64r2, FeatureN64]>;
134 def : Proc<"mips16", [FeatureMips16, FeatureO32]>;
135 def : Proc<"octeon", [FeatureMips64r2, FeatureN64, FeatureCnMips]>;
137 def MipsAsmParser : AsmParser {
138 let ShouldEmitMatchRegisterName = 0;
139 let MnemonicContainsDot = 1;
142 def MipsAsmParserVariant : AsmParserVariant {
145 // Recognize hard coded registers.
146 string RegisterPrefix = "$";
150 let InstructionSet = MipsInstrInfo;
151 let AssemblyParsers = [MipsAsmParser];
152 let AssemblyParserVariants = [MipsAsmParserVariant];