blob: 4e170f5524a0b6e9f8af38eb2620f3e5db2d5a47 [file] [log] [blame]
Chris Lattner23e70eb2010-08-17 16:20:04 +00001//===- ARM.td - Describe the ARM Target Machine ------------*- tablegen -*-===//
Rafael Espindola7bc59bc2006-05-14 22:18:28 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
Rafael Espindola7bc59bc2006-05-14 22:18:28 +00006// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10//
11//===----------------------------------------------------------------------===//
12
13//===----------------------------------------------------------------------===//
14// Target-independent interfaces which we are implementing
15//===----------------------------------------------------------------------===//
16
Evan Cheng027fdbe2008-11-24 07:34:46 +000017include "llvm/Target/Target.td"
Rafael Espindola7bc59bc2006-05-14 22:18:28 +000018
Jim Grosbach2317e402010-09-30 01:57:53 +000019
Rafael Espindola7bc59bc2006-05-14 22:18:28 +000020//===----------------------------------------------------------------------===//
Evan Chenga8e29892007-01-19 07:51:42 +000021// ARM Subtarget features.
22//
23
Evan Cheng39dfb0f2011-07-07 03:55:05 +000024def FeatureVFP2 : SubtargetFeature<"vfp2", "HasVFPv2", "true",
Anton Korobeynikovd4022c32009-05-29 23:41:08 +000025 "Enable VFP2 instructions">;
Evan Cheng39dfb0f2011-07-07 03:55:05 +000026def FeatureVFP3 : SubtargetFeature<"vfp3", "HasVFPv3", "true",
27 "Enable VFP3 instructions",
28 [FeatureVFP2]>;
29def FeatureNEON : SubtargetFeature<"neon", "HasNEON", "true",
30 "Enable NEON instructions",
31 [FeatureVFP3]>;
Evan Cheng94ca42f2011-07-07 00:08:19 +000032def FeatureThumb2 : SubtargetFeature<"thumb2", "HasThumb2", "true",
Anton Korobeynikovd4022c32009-05-29 23:41:08 +000033 "Enable Thumb2 instructions">;
Evan Cheng7b4d3112010-08-11 07:17:46 +000034def FeatureNoARM : SubtargetFeature<"noarm", "NoARM", "true",
35 "Does not support ARM mode execution">;
Anton Korobeynikov631379e2010-03-14 18:42:38 +000036def FeatureFP16 : SubtargetFeature<"fp16", "HasFP16", "true",
37 "Enable half-precision floating point">;
Bob Wilson77f42b52010-10-12 16:22:47 +000038def FeatureD16 : SubtargetFeature<"d16", "HasD16", "true",
39 "Restrict VFP3 to 16 double registers">;
Jim Grosbach29402132010-05-05 23:44:43 +000040def FeatureHWDiv : SubtargetFeature<"hwdiv", "HasHardwareDivide", "true",
41 "Enable divide instructions">;
Evan Chengd6b46322010-08-11 06:51:54 +000042def FeatureT2XtPk : SubtargetFeature<"t2xtpk", "HasT2ExtractPack", "true",
Jim Grosbach29402132010-05-05 23:44:43 +000043 "Enable Thumb2 extract and pack instructions">;
Evan Chengd6b46322010-08-11 06:51:54 +000044def FeatureDB : SubtargetFeature<"db", "HasDataBarrier", "true",
45 "Has data barrier (dmb / dsb) instructions">;
Evan Cheng7a415992010-07-13 19:21:50 +000046def FeatureSlowFPBrcc : SubtargetFeature<"slow-fp-brcc", "SlowFPBrcc", "true",
47 "FP compare + branch is slow">;
Jim Grosbachfcba5e62010-08-11 15:44:15 +000048def FeatureVFPOnlySP : SubtargetFeature<"fp-only-sp", "FPOnlySP", "true",
49 "Floating point unit supports single precision only">;
Evan Chenga8e29892007-01-19 07:51:42 +000050
Evan Cheng48575f62010-12-05 22:04:16 +000051// Some processors have FP multiply-accumulate instructions that don't
52// play nicely with other VFP / NEON instructions, and it's generally better
Jim Grosbach6b2e8dc2010-03-25 23:11:16 +000053// to just not use them.
Evan Cheng48575f62010-12-05 22:04:16 +000054def FeatureHasSlowFPVMLx : SubtargetFeature<"slowfpvmlx", "SlowFPVMLx", "true",
55 "Disable VFP / NEON MAC instructions">;
Evan Cheng463d3582011-03-31 19:38:48 +000056
57// Cortex-A8 / A9 Advanced SIMD has multiplier accumulator forwarding.
58def FeatureVMLxForwarding : SubtargetFeature<"vmlx-forwarding",
59 "HasVMLxForwarding", "true",
60 "Has multiplier accumulator forwarding">;
61
Jim Grosbach7ec7a0e2010-03-25 23:47:34 +000062// Some processors benefit from using NEON instructions for scalar
63// single-precision FP operations.
Jim Grosbachc5ed0132010-08-17 18:39:16 +000064def FeatureNEONForFP : SubtargetFeature<"neonfp", "UseNEONForSinglePrecisionFP",
65 "true",
66 "Use NEON for single precision FP">;
Jim Grosbach7ec7a0e2010-03-25 23:47:34 +000067
Evan Chenge44be632010-08-09 18:35:19 +000068// Disable 32-bit to 16-bit narrowing for experimentation.
69def FeaturePref32BitThumb : SubtargetFeature<"32bit", "Pref32BitThumb", "true",
70 "Prefer 32-bit Thumb instrs">;
Jim Grosbach6b2e8dc2010-03-25 23:11:16 +000071
Bob Wilson5dde8932011-04-19 18:11:49 +000072/// 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
75/// processors.
76def FeatureAvoidPartialCPSR : SubtargetFeature<"avoid-partial-cpsr",
77 "AvoidCPSRPartialUpdate", "true",
78 "Avoid CPSR partial update for OOO execution">;
79
Jim Grosbacha7603982011-07-01 21:12:19 +000080/// Some M architectures don't have the DSP extension (v7E-M vs. v7M)
81def FeatureDSPThumb2 : SubtargetFeature<"t2dsp", "Thumb2DSP", "true",
82 "Supports v7 DSP instructions in Thumb2.">;
83
Evan Chengdfed19f2010-11-03 06:34:55 +000084// Multiprocessing extension.
85def FeatureMP : SubtargetFeature<"mp", "HasMPExtension", "true",
86 "Supports Multiprocessing extension">;
Evan Chengd6b46322010-08-11 06:51:54 +000087
88// ARM architectures.
Evan Cheng39dfb0f2011-07-07 03:55:05 +000089def HasV4TOps : SubtargetFeature<"v4t", "HasV4TOps", "true",
Evan Chengd6b46322010-08-11 06:51:54 +000090 "ARM v4T">;
Evan Cheng39dfb0f2011-07-07 03:55:05 +000091def HasV5TOps : SubtargetFeature<"v5t", "HasV5TOps", "true",
92 "ARM v5T",
93 [HasV4TOps]>;
94def HasV5TEOps : SubtargetFeature<"v5te", "HasV5TEOps", "true",
95 "ARM v5TE, v5TEj, v5TExp",
96 [HasV5TOps]>;
97def HasV6Ops : SubtargetFeature<"v6", "HasV6Ops", "true",
98 "ARM v6",
99 [HasV5TEOps]>;
100def HasV6T2Ops : SubtargetFeature<"v6t2", "HasV6T2Ops", "true",
Evan Chengcb5ce6e2010-08-11 06:57:53 +0000101 "ARM v6t2",
Evan Cheng39dfb0f2011-07-07 03:55:05 +0000102 [HasV6Ops, FeatureThumb2, FeatureDSPThumb2]>;
103def HasV7Ops : SubtargetFeature<"v7", "HasV7Ops", "true",
104 "ARM v7",
105 [HasV6T2Ops]>;
Evan Chengd6b46322010-08-11 06:51:54 +0000106
Evan Chenga8e29892007-01-19 07:51:42 +0000107//===----------------------------------------------------------------------===//
108// ARM Processors supported.
109//
110
Evan Cheng8557c2b2009-06-19 01:51:50 +0000111include "ARMSchedule.td"
112
Evan Cheng3ef1c872010-09-10 01:29:16 +0000113// ARM processor families.
114def ProcOthers : SubtargetFeature<"others", "ARMProcFamily", "Others",
115 "One of the other ARM processor families">;
116def ProcA8 : SubtargetFeature<"a8", "ARMProcFamily", "CortexA8",
117 "Cortex-A8 ARM processors",
Evan Cheng167be802010-12-05 23:03:45 +0000118 [FeatureSlowFPBrcc, FeatureNEONForFP,
Evan Cheng463d3582011-03-31 19:38:48 +0000119 FeatureHasSlowFPVMLx, FeatureVMLxForwarding,
120 FeatureT2XtPk]>;
Evan Cheng3ef1c872010-09-10 01:29:16 +0000121def ProcA9 : SubtargetFeature<"a9", "ARMProcFamily", "CortexA9",
Evan Cheng167be802010-12-05 23:03:45 +0000122 "Cortex-A9 ARM processors",
Bob Wilson84c5eed2011-04-19 18:11:57 +0000123 [FeatureVMLxForwarding,
Bob Wilson5dde8932011-04-19 18:11:49 +0000124 FeatureT2XtPk, FeatureFP16,
125 FeatureAvoidPartialCPSR]>;
Evan Cheng3ef1c872010-09-10 01:29:16 +0000126
Evan Cheng8557c2b2009-06-19 01:51:50 +0000127class ProcNoItin<string Name, list<SubtargetFeature> Features>
128 : Processor<Name, GenericItineraries, Features>;
Evan Chenga8e29892007-01-19 07:51:42 +0000129
130// V4 Processors.
Evan Cheng8557c2b2009-06-19 01:51:50 +0000131def : ProcNoItin<"generic", []>;
132def : ProcNoItin<"arm8", []>;
133def : ProcNoItin<"arm810", []>;
134def : ProcNoItin<"strongarm", []>;
135def : ProcNoItin<"strongarm110", []>;
136def : ProcNoItin<"strongarm1100", []>;
137def : ProcNoItin<"strongarm1110", []>;
Evan Chenga8e29892007-01-19 07:51:42 +0000138
139// V4T Processors.
Evan Cheng39dfb0f2011-07-07 03:55:05 +0000140def : ProcNoItin<"arm7tdmi", [HasV4TOps]>;
141def : ProcNoItin<"arm7tdmi-s", [HasV4TOps]>;
142def : ProcNoItin<"arm710t", [HasV4TOps]>;
143def : ProcNoItin<"arm720t", [HasV4TOps]>;
144def : ProcNoItin<"arm9", [HasV4TOps]>;
145def : ProcNoItin<"arm9tdmi", [HasV4TOps]>;
146def : ProcNoItin<"arm920", [HasV4TOps]>;
147def : ProcNoItin<"arm920t", [HasV4TOps]>;
148def : ProcNoItin<"arm922t", [HasV4TOps]>;
149def : ProcNoItin<"arm940t", [HasV4TOps]>;
150def : ProcNoItin<"ep9312", [HasV4TOps]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000151
152// V5T Processors.
Evan Cheng39dfb0f2011-07-07 03:55:05 +0000153def : ProcNoItin<"arm10tdmi", [HasV5TOps]>;
154def : ProcNoItin<"arm1020t", [HasV5TOps]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000155
156// V5TE Processors.
Evan Cheng39dfb0f2011-07-07 03:55:05 +0000157def : ProcNoItin<"arm9e", [HasV5TEOps]>;
158def : ProcNoItin<"arm926ej-s", [HasV5TEOps]>;
159def : ProcNoItin<"arm946e-s", [HasV5TEOps]>;
160def : ProcNoItin<"arm966e-s", [HasV5TEOps]>;
161def : ProcNoItin<"arm968e-s", [HasV5TEOps]>;
162def : ProcNoItin<"arm10e", [HasV5TEOps]>;
163def : ProcNoItin<"arm1020e", [HasV5TEOps]>;
164def : ProcNoItin<"arm1022e", [HasV5TEOps]>;
165def : ProcNoItin<"xscale", [HasV5TEOps]>;
166def : ProcNoItin<"iwmmxt", [HasV5TEOps]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000167
168// V6 Processors.
Evan Cheng39dfb0f2011-07-07 03:55:05 +0000169def : Processor<"arm1136j-s", ARMV6Itineraries, [HasV6Ops]>;
170def : Processor<"arm1136jf-s", ARMV6Itineraries, [HasV6Ops, FeatureVFP2,
Evan Cheng48575f62010-12-05 22:04:16 +0000171 FeatureHasSlowFPVMLx]>;
Evan Cheng39dfb0f2011-07-07 03:55:05 +0000172def : Processor<"arm1176jz-s", ARMV6Itineraries, [HasV6Ops]>;
173def : Processor<"arm1176jzf-s", ARMV6Itineraries, [HasV6Ops, FeatureVFP2,
Evan Cheng48575f62010-12-05 22:04:16 +0000174 FeatureHasSlowFPVMLx]>;
Evan Cheng39dfb0f2011-07-07 03:55:05 +0000175def : Processor<"mpcorenovfp", ARMV6Itineraries, [HasV6Ops]>;
176def : Processor<"mpcore", ARMV6Itineraries, [HasV6Ops, FeatureVFP2,
Evan Cheng48575f62010-12-05 22:04:16 +0000177 FeatureHasSlowFPVMLx]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000178
Evan Chengc7569ed2010-08-11 06:30:38 +0000179// V6M Processors.
Evan Cheng39dfb0f2011-07-07 03:55:05 +0000180def : Processor<"cortex-m0", ARMV6Itineraries, [HasV6Ops, FeatureNoARM,
181 FeatureDB]>;
Evan Chengc7569ed2010-08-11 06:30:38 +0000182
Anton Korobeynikovfbbf1ee2009-06-08 21:20:36 +0000183// V6T2 Processors.
Evan Cheng39dfb0f2011-07-07 03:55:05 +0000184def : Processor<"arm1156t2-s", ARMV6Itineraries, [HasV6T2Ops]>;
185def : Processor<"arm1156t2f-s", ARMV6Itineraries, [HasV6T2Ops, FeatureVFP2,
Evan Cheng48575f62010-12-05 22:04:16 +0000186 FeatureHasSlowFPVMLx]>;
Anton Korobeynikovd4022c32009-05-29 23:41:08 +0000187
Evan Cheng39dfb0f2011-07-07 03:55:05 +0000188// V7a Processors.
Evan Cheng6762d912009-07-21 18:54:14 +0000189def : Processor<"cortex-a8", CortexA8Itineraries,
Evan Cheng39dfb0f2011-07-07 03:55:05 +0000190 [ProcA8, HasV7Ops, FeatureNEON, FeatureDB,
191 FeatureDSPThumb2]>;
Anton Korobeynikov2eeeff82010-04-07 18:19:18 +0000192def : Processor<"cortex-a9", CortexA9Itineraries,
Evan Cheng39dfb0f2011-07-07 03:55:05 +0000193 [ProcA9, HasV7Ops, FeatureNEON, FeatureDB,
194 FeatureDSPThumb2]>;
Bob Wilsoncd704962011-04-19 18:11:52 +0000195def : Processor<"cortex-a9-mp", CortexA9Itineraries,
Evan Cheng39dfb0f2011-07-07 03:55:05 +0000196 [ProcA9, HasV7Ops, FeatureNEON, FeatureDB,
197 FeatureDSPThumb2, FeatureMP]>;
Evan Chengc7569ed2010-08-11 06:30:38 +0000198
199// V7M Processors.
Evan Cheng39dfb0f2011-07-07 03:55:05 +0000200def : ProcNoItin<"cortex-m3", [HasV7Ops,
201 FeatureThumb2, FeatureNoARM, FeatureDB,
202 FeatureHWDiv]>;
203
204// V7EM Processors.
205def : ProcNoItin<"cortex-m4", [HasV7Ops,
206 FeatureThumb2, FeatureNoARM, FeatureDB,
207 FeatureHWDiv, FeatureDSPThumb2,
208 FeatureT2XtPk, FeatureVFP2,
209 FeatureVFPOnlySP]>;
Anton Korobeynikov6d7d2aa2009-05-23 19:51:43 +0000210
Evan Chenga8e29892007-01-19 07:51:42 +0000211//===----------------------------------------------------------------------===//
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000212// Register File Description
213//===----------------------------------------------------------------------===//
214
215include "ARMRegisterInfo.td"
216
Bob Wilson1f595bb2009-04-17 19:07:39 +0000217include "ARMCallingConv.td"
218
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000219//===----------------------------------------------------------------------===//
220// Instruction Descriptions
221//===----------------------------------------------------------------------===//
222
223include "ARMInstrInfo.td"
224
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000225def ARMInstrInfo : InstrInfo;
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000226
Jim Grosbach2317e402010-09-30 01:57:53 +0000227
228//===----------------------------------------------------------------------===//
229// Assembly printer
230//===----------------------------------------------------------------------===//
231// ARM Uses the MC printer for asm output, so make sure the TableGen
232// AsmWriter bits get associated with the correct class.
233def ARMAsmWriter : AsmWriter {
234 string AsmWriterClassName = "InstPrinter";
235 bit isMCAsmWriter = 1;
236}
237
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000238//===----------------------------------------------------------------------===//
239// Declare the target which we are implementing
240//===----------------------------------------------------------------------===//
241
242def ARM : Target {
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000243 // Pull in Instruction Info:
244 let InstructionSet = ARMInstrInfo;
Jim Grosbach2317e402010-09-30 01:57:53 +0000245
246 let AssemblyWriters = [ARMAsmWriter];
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000247}