1 //===- ARM.td - Describe the ARM 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 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
14 // Target-independent interfaces which we are implementing
15 //===----------------------------------------------------------------------===//
17 include "llvm/Target/Target.td"
20 //===----------------------------------------------------------------------===//
21 // ARM Subtarget features.
24 def FeatureVFP2 : SubtargetFeature<"vfp2", "HasVFPv2", "true",
25 "Enable VFP2 instructions">;
26 def FeatureVFP3 : SubtargetFeature<"vfp3", "HasVFPv3", "true",
27 "Enable VFP3 instructions",
29 def FeatureNEON : SubtargetFeature<"neon", "HasNEON", "true",
30 "Enable NEON instructions",
32 def FeatureThumb2 : SubtargetFeature<"thumb2", "HasThumb2", "true",
33 "Enable Thumb2 instructions">;
34 def FeatureNoARM : SubtargetFeature<"noarm", "NoARM", "true",
35 "Does not support ARM mode execution">;
36 def FeatureFP16 : SubtargetFeature<"fp16", "HasFP16", "true",
37 "Enable half-precision floating point">;
38 def FeatureD16 : SubtargetFeature<"d16", "HasD16", "true",
39 "Restrict VFP3 to 16 double registers">;
40 def FeatureHWDiv : SubtargetFeature<"hwdiv", "HasHardwareDivide", "true",
41 "Enable divide instructions">;
42 def FeatureT2XtPk : SubtargetFeature<"t2xtpk", "HasT2ExtractPack", "true",
43 "Enable Thumb2 extract and pack instructions">;
44 def FeatureDB : SubtargetFeature<"db", "HasDataBarrier", "true",
45 "Has data barrier (dmb / dsb) instructions">;
46 def FeatureSlowFPBrcc : SubtargetFeature<"slow-fp-brcc", "SlowFPBrcc", "true",
47 "FP compare + branch is slow">;
48 def FeatureVFPOnlySP : SubtargetFeature<"fp-only-sp", "FPOnlySP", "true",
49 "Floating point unit supports single precision only">;
51 // Some processors have FP multiply-accumulate instructions that don't
52 // play nicely with other VFP / NEON instructions, and it's generally better
53 // to just not use them.
54 def FeatureHasSlowFPVMLx : SubtargetFeature<"slowfpvmlx", "SlowFPVMLx", "true",
55 "Disable VFP / NEON MAC instructions">;
57 // Cortex-A8 / A9 Advanced SIMD has multiplier accumulator forwarding.
58 def FeatureVMLxForwarding : SubtargetFeature<"vmlx-forwarding",
59 "HasVMLxForwarding", "true",
60 "Has multiplier accumulator forwarding">;
62 // Some processors benefit from using NEON instructions for scalar
63 // single-precision FP operations.
64 def FeatureNEONForFP : SubtargetFeature<"neonfp", "UseNEONForSinglePrecisionFP",
66 "Use NEON for single precision FP">;
68 // Disable 32-bit to 16-bit narrowing for experimentation.
69 def FeaturePref32BitThumb : SubtargetFeature<"32bit", "Pref32BitThumb", "true",
70 "Prefer 32-bit Thumb instrs">;
72 /// Some instructions update CPSR partially, which can add false dependency for
73 /// out-of-order implementation, e.g. Cortex-A9, unless each individual bit is
74 /// mapped to a separate physical register. Avoid partial CPSR update for these
76 def FeatureAvoidPartialCPSR : SubtargetFeature<"avoid-partial-cpsr",
77 "AvoidCPSRPartialUpdate", "true",
78 "Avoid CPSR partial update for OOO execution">;
80 /// Some M architectures don't have the DSP extension (v7E-M vs. v7M)
81 def FeatureDSPThumb2 : SubtargetFeature<"t2dsp", "Thumb2DSP", "true",
82 "Supports v7 DSP instructions in Thumb2.">;
84 // Multiprocessing extension.
85 def FeatureMP : SubtargetFeature<"mp", "HasMPExtension", "true",
86 "Supports Multiprocessing extension">;
89 def HasV4TOps : SubtargetFeature<"v4t", "HasV4TOps", "true",
91 def HasV5TOps : SubtargetFeature<"v5t", "HasV5TOps", "true",
94 def HasV5TEOps : SubtargetFeature<"v5te", "HasV5TEOps", "true",
95 "ARM v5TE, v5TEj, v5TExp",
97 def HasV6Ops : SubtargetFeature<"v6", "HasV6Ops", "true",
100 def HasV6T2Ops : SubtargetFeature<"v6t2", "HasV6T2Ops", "true",
102 [HasV6Ops, FeatureThumb2, FeatureDSPThumb2]>;
103 def HasV7Ops : SubtargetFeature<"v7", "HasV7Ops", "true",
107 //===----------------------------------------------------------------------===//
108 // ARM Processors supported.
111 include "ARMSchedule.td"
113 // ARM processor families.
114 def ProcOthers : SubtargetFeature<"others", "ARMProcFamily", "Others",
115 "One of the other ARM processor families">;
116 def ProcA8 : SubtargetFeature<"a8", "ARMProcFamily", "CortexA8",
117 "Cortex-A8 ARM processors",
118 [FeatureSlowFPBrcc, FeatureNEONForFP,
119 FeatureHasSlowFPVMLx, FeatureVMLxForwarding,
121 def ProcA9 : SubtargetFeature<"a9", "ARMProcFamily", "CortexA9",
122 "Cortex-A9 ARM processors",
123 [FeatureVMLxForwarding,
124 FeatureT2XtPk, FeatureFP16,
125 FeatureAvoidPartialCPSR]>;
127 class ProcNoItin<string Name, list<SubtargetFeature> Features>
128 : Processor<Name, GenericItineraries, Features>;
131 def : ProcNoItin<"generic", []>;
132 def : ProcNoItin<"arm8", []>;
133 def : ProcNoItin<"arm810", []>;
134 def : ProcNoItin<"strongarm", []>;
135 def : ProcNoItin<"strongarm110", []>;
136 def : ProcNoItin<"strongarm1100", []>;
137 def : ProcNoItin<"strongarm1110", []>;
140 def : ProcNoItin<"arm7tdmi", [HasV4TOps]>;
141 def : ProcNoItin<"arm7tdmi-s", [HasV4TOps]>;
142 def : ProcNoItin<"arm710t", [HasV4TOps]>;
143 def : ProcNoItin<"arm720t", [HasV4TOps]>;
144 def : ProcNoItin<"arm9", [HasV4TOps]>;
145 def : ProcNoItin<"arm9tdmi", [HasV4TOps]>;
146 def : ProcNoItin<"arm920", [HasV4TOps]>;
147 def : ProcNoItin<"arm920t", [HasV4TOps]>;
148 def : ProcNoItin<"arm922t", [HasV4TOps]>;
149 def : ProcNoItin<"arm940t", [HasV4TOps]>;
150 def : ProcNoItin<"ep9312", [HasV4TOps]>;
153 def : ProcNoItin<"arm10tdmi", [HasV5TOps]>;
154 def : ProcNoItin<"arm1020t", [HasV5TOps]>;
157 def : ProcNoItin<"arm9e", [HasV5TEOps]>;
158 def : ProcNoItin<"arm926ej-s", [HasV5TEOps]>;
159 def : ProcNoItin<"arm946e-s", [HasV5TEOps]>;
160 def : ProcNoItin<"arm966e-s", [HasV5TEOps]>;
161 def : ProcNoItin<"arm968e-s", [HasV5TEOps]>;
162 def : ProcNoItin<"arm10e", [HasV5TEOps]>;
163 def : ProcNoItin<"arm1020e", [HasV5TEOps]>;
164 def : ProcNoItin<"arm1022e", [HasV5TEOps]>;
165 def : ProcNoItin<"xscale", [HasV5TEOps]>;
166 def : ProcNoItin<"iwmmxt", [HasV5TEOps]>;
169 def : Processor<"arm1136j-s", ARMV6Itineraries, [HasV6Ops]>;
170 def : Processor<"arm1136jf-s", ARMV6Itineraries, [HasV6Ops, FeatureVFP2,
171 FeatureHasSlowFPVMLx]>;
172 def : Processor<"arm1176jz-s", ARMV6Itineraries, [HasV6Ops]>;
173 def : Processor<"arm1176jzf-s", ARMV6Itineraries, [HasV6Ops, FeatureVFP2,
174 FeatureHasSlowFPVMLx]>;
175 def : Processor<"mpcorenovfp", ARMV6Itineraries, [HasV6Ops]>;
176 def : Processor<"mpcore", ARMV6Itineraries, [HasV6Ops, FeatureVFP2,
177 FeatureHasSlowFPVMLx]>;
180 def : Processor<"cortex-m0", ARMV6Itineraries, [HasV6Ops, FeatureNoARM,
184 def : Processor<"arm1156t2-s", ARMV6Itineraries, [HasV6T2Ops]>;
185 def : Processor<"arm1156t2f-s", ARMV6Itineraries, [HasV6T2Ops, FeatureVFP2,
186 FeatureHasSlowFPVMLx]>;
189 def : Processor<"cortex-a8", CortexA8Itineraries,
190 [ProcA8, HasV7Ops, FeatureNEON, FeatureDB,
192 def : Processor<"cortex-a9", CortexA9Itineraries,
193 [ProcA9, HasV7Ops, FeatureNEON, FeatureDB,
195 def : Processor<"cortex-a9-mp", CortexA9Itineraries,
196 [ProcA9, HasV7Ops, FeatureNEON, FeatureDB,
197 FeatureDSPThumb2, FeatureMP]>;
200 def : ProcNoItin<"cortex-m3", [HasV7Ops,
201 FeatureThumb2, FeatureNoARM, FeatureDB,
205 def : ProcNoItin<"cortex-m4", [HasV7Ops,
206 FeatureThumb2, FeatureNoARM, FeatureDB,
207 FeatureHWDiv, FeatureDSPThumb2,
208 FeatureT2XtPk, FeatureVFP2,
211 //===----------------------------------------------------------------------===//
212 // Register File Description
213 //===----------------------------------------------------------------------===//
215 include "ARMRegisterInfo.td"
217 include "ARMCallingConv.td"
219 //===----------------------------------------------------------------------===//
220 // Instruction Descriptions
221 //===----------------------------------------------------------------------===//
223 include "ARMInstrInfo.td"
225 def ARMInstrInfo : InstrInfo;
228 //===----------------------------------------------------------------------===//
230 //===----------------------------------------------------------------------===//
231 // ARM Uses the MC printer for asm output, so make sure the TableGen
232 // AsmWriter bits get associated with the correct class.
233 def ARMAsmWriter : AsmWriter {
234 string AsmWriterClassName = "InstPrinter";
235 bit isMCAsmWriter = 1;
238 //===----------------------------------------------------------------------===//
239 // Declare the target which we are implementing
240 //===----------------------------------------------------------------------===//
243 // Pull in Instruction Info:
244 let InstructionSet = ARMInstrInfo;
246 let AssemblyWriters = [ARMAsmWriter];