blob: 6d3a42fa4000ac10dd2de2ac53648c8cf87ca770 [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
Anton Korobeynikov6d7d2aa2009-05-23 19:51:43 +000024def FeatureVFP2 : SubtargetFeature<"vfp2", "ARMFPUType", "VFPv2",
Anton Korobeynikovd4022c32009-05-29 23:41:08 +000025 "Enable VFP2 instructions">;
Anton Korobeynikov6d7d2aa2009-05-23 19:51:43 +000026def FeatureVFP3 : SubtargetFeature<"vfp3", "ARMFPUType", "VFPv3",
Anton Korobeynikovd4022c32009-05-29 23:41:08 +000027 "Enable VFP3 instructions">;
Anton Korobeynikov6d7d2aa2009-05-23 19:51:43 +000028def FeatureNEON : SubtargetFeature<"neon", "ARMFPUType", "NEON",
Anton Korobeynikovd4022c32009-05-29 23:41:08 +000029 "Enable NEON instructions">;
Evan Cheng94ca42f2011-07-07 00:08:19 +000030def FeatureThumb2 : SubtargetFeature<"thumb2", "HasThumb2", "true",
Anton Korobeynikovd4022c32009-05-29 23:41:08 +000031 "Enable Thumb2 instructions">;
Evan Cheng7b4d3112010-08-11 07:17:46 +000032def FeatureNoARM : SubtargetFeature<"noarm", "NoARM", "true",
33 "Does not support ARM mode execution">;
Anton Korobeynikov631379e2010-03-14 18:42:38 +000034def FeatureFP16 : SubtargetFeature<"fp16", "HasFP16", "true",
35 "Enable half-precision floating point">;
Bob Wilson77f42b52010-10-12 16:22:47 +000036def FeatureD16 : SubtargetFeature<"d16", "HasD16", "true",
37 "Restrict VFP3 to 16 double registers">;
Jim Grosbach29402132010-05-05 23:44:43 +000038def FeatureHWDiv : SubtargetFeature<"hwdiv", "HasHardwareDivide", "true",
39 "Enable divide instructions">;
Evan Chengd6b46322010-08-11 06:51:54 +000040def FeatureT2XtPk : SubtargetFeature<"t2xtpk", "HasT2ExtractPack", "true",
Jim Grosbach29402132010-05-05 23:44:43 +000041 "Enable Thumb2 extract and pack instructions">;
Evan Chengd6b46322010-08-11 06:51:54 +000042def FeatureDB : SubtargetFeature<"db", "HasDataBarrier", "true",
43 "Has data barrier (dmb / dsb) instructions">;
Evan Cheng7a415992010-07-13 19:21:50 +000044def FeatureSlowFPBrcc : SubtargetFeature<"slow-fp-brcc", "SlowFPBrcc", "true",
45 "FP compare + branch is slow">;
Jim Grosbachfcba5e62010-08-11 15:44:15 +000046def FeatureVFPOnlySP : SubtargetFeature<"fp-only-sp", "FPOnlySP", "true",
47 "Floating point unit supports single precision only">;
Evan Chenga8e29892007-01-19 07:51:42 +000048
Evan Cheng48575f62010-12-05 22:04:16 +000049// Some processors have FP multiply-accumulate instructions that don't
50// play nicely with other VFP / NEON instructions, and it's generally better
Jim Grosbach6b2e8dc2010-03-25 23:11:16 +000051// to just not use them.
Evan Cheng48575f62010-12-05 22:04:16 +000052def FeatureHasSlowFPVMLx : SubtargetFeature<"slowfpvmlx", "SlowFPVMLx", "true",
53 "Disable VFP / NEON MAC instructions">;
Evan Cheng463d3582011-03-31 19:38:48 +000054
55// Cortex-A8 / A9 Advanced SIMD has multiplier accumulator forwarding.
56def FeatureVMLxForwarding : SubtargetFeature<"vmlx-forwarding",
57 "HasVMLxForwarding", "true",
58 "Has multiplier accumulator forwarding">;
59
Jim Grosbach7ec7a0e2010-03-25 23:47:34 +000060// Some processors benefit from using NEON instructions for scalar
61// single-precision FP operations.
Jim Grosbachc5ed0132010-08-17 18:39:16 +000062def FeatureNEONForFP : SubtargetFeature<"neonfp", "UseNEONForSinglePrecisionFP",
63 "true",
64 "Use NEON for single precision FP">;
Jim Grosbach7ec7a0e2010-03-25 23:47:34 +000065
Evan Chenge44be632010-08-09 18:35:19 +000066// Disable 32-bit to 16-bit narrowing for experimentation.
67def FeaturePref32BitThumb : SubtargetFeature<"32bit", "Pref32BitThumb", "true",
68 "Prefer 32-bit Thumb instrs">;
Jim Grosbach6b2e8dc2010-03-25 23:11:16 +000069
Bob Wilson5dde8932011-04-19 18:11:49 +000070/// Some instructions update CPSR partially, which can add false dependency for
71/// out-of-order implementation, e.g. Cortex-A9, unless each individual bit is
72/// mapped to a separate physical register. Avoid partial CPSR update for these
73/// processors.
74def FeatureAvoidPartialCPSR : SubtargetFeature<"avoid-partial-cpsr",
75 "AvoidCPSRPartialUpdate", "true",
76 "Avoid CPSR partial update for OOO execution">;
77
Jim Grosbacha7603982011-07-01 21:12:19 +000078/// Some M architectures don't have the DSP extension (v7E-M vs. v7M)
79def FeatureDSPThumb2 : SubtargetFeature<"t2dsp", "Thumb2DSP", "true",
80 "Supports v7 DSP instructions in Thumb2.">;
81
Evan Chengdfed19f2010-11-03 06:34:55 +000082// Multiprocessing extension.
83def FeatureMP : SubtargetFeature<"mp", "HasMPExtension", "true",
84 "Supports Multiprocessing extension">;
Evan Chengd6b46322010-08-11 06:51:54 +000085
86// ARM architectures.
87def ArchV4T : SubtargetFeature<"v4t", "ARMArchVersion", "V4T",
88 "ARM v4T">;
89def ArchV5T : SubtargetFeature<"v5t", "ARMArchVersion", "V5T",
90 "ARM v5T">;
91def ArchV5TE : SubtargetFeature<"v5te", "ARMArchVersion", "V5TE",
92 "ARM v5TE, v5TEj, v5TExp">;
93def ArchV6 : SubtargetFeature<"v6", "ARMArchVersion", "V6",
94 "ARM v6">;
95def ArchV6M : SubtargetFeature<"v6m", "ARMArchVersion", "V6M",
96 "ARM v6m",
Evan Cheng7b4d3112010-08-11 07:17:46 +000097 [FeatureNoARM, FeatureDB]>;
Evan Chengd6b46322010-08-11 06:51:54 +000098def ArchV6T2 : SubtargetFeature<"v6t2", "ARMArchVersion", "V6T2",
Evan Chengcb5ce6e2010-08-11 06:57:53 +000099 "ARM v6t2",
Jim Grosbacha7603982011-07-01 21:12:19 +0000100 [FeatureThumb2, FeatureDSPThumb2]>;
Evan Chengd6b46322010-08-11 06:51:54 +0000101def ArchV7A : SubtargetFeature<"v7a", "ARMArchVersion", "V7A",
102 "ARM v7A",
Jim Grosbacha7603982011-07-01 21:12:19 +0000103 [FeatureThumb2, FeatureNEON, FeatureDB,
104 FeatureDSPThumb2]>;
Evan Chengd6b46322010-08-11 06:51:54 +0000105def ArchV7M : SubtargetFeature<"v7m", "ARMArchVersion", "V7M",
106 "ARM v7M",
Evan Cheng7b4d3112010-08-11 07:17:46 +0000107 [FeatureThumb2, FeatureNoARM, FeatureDB,
108 FeatureHWDiv]>;
Jim Grosbacha7603982011-07-01 21:12:19 +0000109def ArchV7EM : SubtargetFeature<"v7em", "ARMArchVersion", "V7EM",
110 "ARM v7E-M",
111 [FeatureThumb2, FeatureNoARM, FeatureDB,
112 FeatureHWDiv, FeatureDSPThumb2,
113 FeatureT2XtPk]>;
Evan Chengd6b46322010-08-11 06:51:54 +0000114
Evan Chenga8e29892007-01-19 07:51:42 +0000115//===----------------------------------------------------------------------===//
116// ARM Processors supported.
117//
118
Evan Cheng8557c2b2009-06-19 01:51:50 +0000119include "ARMSchedule.td"
120
Evan Cheng3ef1c872010-09-10 01:29:16 +0000121// ARM processor families.
122def ProcOthers : SubtargetFeature<"others", "ARMProcFamily", "Others",
123 "One of the other ARM processor families">;
124def ProcA8 : SubtargetFeature<"a8", "ARMProcFamily", "CortexA8",
125 "Cortex-A8 ARM processors",
Evan Cheng167be802010-12-05 23:03:45 +0000126 [FeatureSlowFPBrcc, FeatureNEONForFP,
Evan Cheng463d3582011-03-31 19:38:48 +0000127 FeatureHasSlowFPVMLx, FeatureVMLxForwarding,
128 FeatureT2XtPk]>;
Evan Cheng3ef1c872010-09-10 01:29:16 +0000129def ProcA9 : SubtargetFeature<"a9", "ARMProcFamily", "CortexA9",
Evan Cheng167be802010-12-05 23:03:45 +0000130 "Cortex-A9 ARM processors",
Bob Wilson84c5eed2011-04-19 18:11:57 +0000131 [FeatureVMLxForwarding,
Bob Wilson5dde8932011-04-19 18:11:49 +0000132 FeatureT2XtPk, FeatureFP16,
133 FeatureAvoidPartialCPSR]>;
Evan Cheng3ef1c872010-09-10 01:29:16 +0000134
Evan Cheng8557c2b2009-06-19 01:51:50 +0000135class ProcNoItin<string Name, list<SubtargetFeature> Features>
136 : Processor<Name, GenericItineraries, Features>;
Evan Chenga8e29892007-01-19 07:51:42 +0000137
138// V4 Processors.
Evan Cheng8557c2b2009-06-19 01:51:50 +0000139def : ProcNoItin<"generic", []>;
140def : ProcNoItin<"arm8", []>;
141def : ProcNoItin<"arm810", []>;
142def : ProcNoItin<"strongarm", []>;
143def : ProcNoItin<"strongarm110", []>;
144def : ProcNoItin<"strongarm1100", []>;
145def : ProcNoItin<"strongarm1110", []>;
Evan Chenga8e29892007-01-19 07:51:42 +0000146
147// V4T Processors.
Evan Cheng8557c2b2009-06-19 01:51:50 +0000148def : ProcNoItin<"arm7tdmi", [ArchV4T]>;
149def : ProcNoItin<"arm7tdmi-s", [ArchV4T]>;
150def : ProcNoItin<"arm710t", [ArchV4T]>;
151def : ProcNoItin<"arm720t", [ArchV4T]>;
152def : ProcNoItin<"arm9", [ArchV4T]>;
153def : ProcNoItin<"arm9tdmi", [ArchV4T]>;
154def : ProcNoItin<"arm920", [ArchV4T]>;
155def : ProcNoItin<"arm920t", [ArchV4T]>;
156def : ProcNoItin<"arm922t", [ArchV4T]>;
157def : ProcNoItin<"arm940t", [ArchV4T]>;
158def : ProcNoItin<"ep9312", [ArchV4T]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000159
160// V5T Processors.
Evan Cheng8557c2b2009-06-19 01:51:50 +0000161def : ProcNoItin<"arm10tdmi", [ArchV5T]>;
162def : ProcNoItin<"arm1020t", [ArchV5T]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000163
164// V5TE Processors.
Evan Cheng8557c2b2009-06-19 01:51:50 +0000165def : ProcNoItin<"arm9e", [ArchV5TE]>;
166def : ProcNoItin<"arm926ej-s", [ArchV5TE]>;
167def : ProcNoItin<"arm946e-s", [ArchV5TE]>;
168def : ProcNoItin<"arm966e-s", [ArchV5TE]>;
169def : ProcNoItin<"arm968e-s", [ArchV5TE]>;
170def : ProcNoItin<"arm10e", [ArchV5TE]>;
171def : ProcNoItin<"arm1020e", [ArchV5TE]>;
172def : ProcNoItin<"arm1022e", [ArchV5TE]>;
173def : ProcNoItin<"xscale", [ArchV5TE]>;
174def : ProcNoItin<"iwmmxt", [ArchV5TE]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000175
176// V6 Processors.
David Goodwinebb5cb92009-11-18 18:39:57 +0000177def : Processor<"arm1136j-s", ARMV6Itineraries, [ArchV6]>;
Jim Grosbach1118b5e2010-04-01 00:13:43 +0000178def : Processor<"arm1136jf-s", ARMV6Itineraries, [ArchV6, FeatureVFP2,
Evan Cheng48575f62010-12-05 22:04:16 +0000179 FeatureHasSlowFPVMLx]>;
David Goodwinebb5cb92009-11-18 18:39:57 +0000180def : Processor<"arm1176jz-s", ARMV6Itineraries, [ArchV6]>;
Evan Cheng48575f62010-12-05 22:04:16 +0000181def : Processor<"arm1176jzf-s", ARMV6Itineraries, [ArchV6, FeatureVFP2,
182 FeatureHasSlowFPVMLx]>;
David Goodwinebb5cb92009-11-18 18:39:57 +0000183def : Processor<"mpcorenovfp", ARMV6Itineraries, [ArchV6]>;
Evan Cheng48575f62010-12-05 22:04:16 +0000184def : Processor<"mpcore", ARMV6Itineraries, [ArchV6, FeatureVFP2,
185 FeatureHasSlowFPVMLx]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000186
Evan Chengc7569ed2010-08-11 06:30:38 +0000187// V6M Processors.
Evan Chengd6b46322010-08-11 06:51:54 +0000188def : Processor<"cortex-m0", ARMV6Itineraries, [ArchV6M]>;
Evan Chengc7569ed2010-08-11 06:30:38 +0000189
Anton Korobeynikovfbbf1ee2009-06-08 21:20:36 +0000190// V6T2 Processors.
Evan Chengcb5ce6e2010-08-11 06:57:53 +0000191def : Processor<"arm1156t2-s", ARMV6Itineraries, [ArchV6T2]>;
Evan Cheng48575f62010-12-05 22:04:16 +0000192def : Processor<"arm1156t2f-s", ARMV6Itineraries, [ArchV6T2, FeatureVFP2,
193 FeatureHasSlowFPVMLx]>;
Anton Korobeynikovd4022c32009-05-29 23:41:08 +0000194
Anton Korobeynikovfbbf1ee2009-06-08 21:20:36 +0000195// V7 Processors.
Evan Cheng6762d912009-07-21 18:54:14 +0000196def : Processor<"cortex-a8", CortexA8Itineraries,
Evan Cheng167be802010-12-05 23:03:45 +0000197 [ArchV7A, ProcA8]>;
Anton Korobeynikov2eeeff82010-04-07 18:19:18 +0000198def : Processor<"cortex-a9", CortexA9Itineraries,
Evan Cheng167be802010-12-05 23:03:45 +0000199 [ArchV7A, ProcA9]>;
Bob Wilsoncd704962011-04-19 18:11:52 +0000200def : Processor<"cortex-a9-mp", CortexA9Itineraries,
201 [ArchV7A, ProcA9, FeatureMP]>;
Evan Chengc7569ed2010-08-11 06:30:38 +0000202
203// V7M Processors.
Evan Cheng8d62e712010-08-11 07:00:16 +0000204def : ProcNoItin<"cortex-m3", [ArchV7M]>;
Jim Grosbacha7603982011-07-01 21:12:19 +0000205def : ProcNoItin<"cortex-m4", [ArchV7EM, FeatureVFP2, FeatureVFPOnlySP]>;
Anton Korobeynikov6d7d2aa2009-05-23 19:51:43 +0000206
Evan Chenga8e29892007-01-19 07:51:42 +0000207//===----------------------------------------------------------------------===//
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000208// Register File Description
209//===----------------------------------------------------------------------===//
210
211include "ARMRegisterInfo.td"
212
Bob Wilson1f595bb2009-04-17 19:07:39 +0000213include "ARMCallingConv.td"
214
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000215//===----------------------------------------------------------------------===//
216// Instruction Descriptions
217//===----------------------------------------------------------------------===//
218
219include "ARMInstrInfo.td"
220
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000221def ARMInstrInfo : InstrInfo;
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000222
Jim Grosbach2317e402010-09-30 01:57:53 +0000223
224//===----------------------------------------------------------------------===//
225// Assembly printer
226//===----------------------------------------------------------------------===//
227// ARM Uses the MC printer for asm output, so make sure the TableGen
228// AsmWriter bits get associated with the correct class.
229def ARMAsmWriter : AsmWriter {
230 string AsmWriterClassName = "InstPrinter";
231 bit isMCAsmWriter = 1;
232}
233
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000234//===----------------------------------------------------------------------===//
235// Declare the target which we are implementing
236//===----------------------------------------------------------------------===//
237
238def ARM : Target {
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000239 // Pull in Instruction Info:
240 let InstructionSet = ARMInstrInfo;
Jim Grosbach2317e402010-09-30 01:57:53 +0000241
242 let AssemblyWriters = [ARMAsmWriter];
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000243}