blob: 745d31dcd0f0512b42f682b4945ee0be15b8065e [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">;
30def FeatureThumb2 : SubtargetFeature<"thumb2", "ThumbMode", "Thumb2",
31 "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
Evan Chengdfed19f2010-11-03 06:34:55 +000078// Multiprocessing extension.
79def FeatureMP : SubtargetFeature<"mp", "HasMPExtension", "true",
80 "Supports Multiprocessing extension">;
Evan Chengd6b46322010-08-11 06:51:54 +000081
82// ARM architectures.
83def ArchV4T : SubtargetFeature<"v4t", "ARMArchVersion", "V4T",
84 "ARM v4T">;
85def ArchV5T : SubtargetFeature<"v5t", "ARMArchVersion", "V5T",
86 "ARM v5T">;
87def ArchV5TE : SubtargetFeature<"v5te", "ARMArchVersion", "V5TE",
88 "ARM v5TE, v5TEj, v5TExp">;
89def ArchV6 : SubtargetFeature<"v6", "ARMArchVersion", "V6",
90 "ARM v6">;
91def ArchV6M : SubtargetFeature<"v6m", "ARMArchVersion", "V6M",
92 "ARM v6m",
Evan Cheng7b4d3112010-08-11 07:17:46 +000093 [FeatureNoARM, FeatureDB]>;
Evan Chengd6b46322010-08-11 06:51:54 +000094def ArchV6T2 : SubtargetFeature<"v6t2", "ARMArchVersion", "V6T2",
Evan Chengcb5ce6e2010-08-11 06:57:53 +000095 "ARM v6t2",
96 [FeatureThumb2]>;
Evan Chengd6b46322010-08-11 06:51:54 +000097def ArchV7A : SubtargetFeature<"v7a", "ARMArchVersion", "V7A",
98 "ARM v7A",
Evan Chengcb5ce6e2010-08-11 06:57:53 +000099 [FeatureThumb2, FeatureNEON, FeatureDB]>;
Evan Chengd6b46322010-08-11 06:51:54 +0000100def ArchV7M : SubtargetFeature<"v7m", "ARMArchVersion", "V7M",
101 "ARM v7M",
Evan Cheng7b4d3112010-08-11 07:17:46 +0000102 [FeatureThumb2, FeatureNoARM, FeatureDB,
103 FeatureHWDiv]>;
Evan Chengd6b46322010-08-11 06:51:54 +0000104
Evan Chenga8e29892007-01-19 07:51:42 +0000105//===----------------------------------------------------------------------===//
106// ARM Processors supported.
107//
108
Evan Cheng8557c2b2009-06-19 01:51:50 +0000109include "ARMSchedule.td"
110
Evan Cheng3ef1c872010-09-10 01:29:16 +0000111// ARM processor families.
112def ProcOthers : SubtargetFeature<"others", "ARMProcFamily", "Others",
113 "One of the other ARM processor families">;
114def ProcA8 : SubtargetFeature<"a8", "ARMProcFamily", "CortexA8",
115 "Cortex-A8 ARM processors",
Evan Cheng167be802010-12-05 23:03:45 +0000116 [FeatureSlowFPBrcc, FeatureNEONForFP,
Evan Cheng463d3582011-03-31 19:38:48 +0000117 FeatureHasSlowFPVMLx, FeatureVMLxForwarding,
118 FeatureT2XtPk]>;
Evan Cheng3ef1c872010-09-10 01:29:16 +0000119def ProcA9 : SubtargetFeature<"a9", "ARMProcFamily", "CortexA9",
Evan Cheng167be802010-12-05 23:03:45 +0000120 "Cortex-A9 ARM processors",
Evan Cheng463d3582011-03-31 19:38:48 +0000121 [FeatureHasSlowFPVMLx, FeatureVMLxForwarding,
Bob Wilson5dde8932011-04-19 18:11:49 +0000122 FeatureT2XtPk, FeatureFP16,
123 FeatureAvoidPartialCPSR]>;
Evan Cheng3ef1c872010-09-10 01:29:16 +0000124
Evan Cheng8557c2b2009-06-19 01:51:50 +0000125class ProcNoItin<string Name, list<SubtargetFeature> Features>
126 : Processor<Name, GenericItineraries, Features>;
Evan Chenga8e29892007-01-19 07:51:42 +0000127
128// V4 Processors.
Evan Cheng8557c2b2009-06-19 01:51:50 +0000129def : ProcNoItin<"generic", []>;
130def : ProcNoItin<"arm8", []>;
131def : ProcNoItin<"arm810", []>;
132def : ProcNoItin<"strongarm", []>;
133def : ProcNoItin<"strongarm110", []>;
134def : ProcNoItin<"strongarm1100", []>;
135def : ProcNoItin<"strongarm1110", []>;
Evan Chenga8e29892007-01-19 07:51:42 +0000136
137// V4T Processors.
Evan Cheng8557c2b2009-06-19 01:51:50 +0000138def : ProcNoItin<"arm7tdmi", [ArchV4T]>;
139def : ProcNoItin<"arm7tdmi-s", [ArchV4T]>;
140def : ProcNoItin<"arm710t", [ArchV4T]>;
141def : ProcNoItin<"arm720t", [ArchV4T]>;
142def : ProcNoItin<"arm9", [ArchV4T]>;
143def : ProcNoItin<"arm9tdmi", [ArchV4T]>;
144def : ProcNoItin<"arm920", [ArchV4T]>;
145def : ProcNoItin<"arm920t", [ArchV4T]>;
146def : ProcNoItin<"arm922t", [ArchV4T]>;
147def : ProcNoItin<"arm940t", [ArchV4T]>;
148def : ProcNoItin<"ep9312", [ArchV4T]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000149
150// V5T Processors.
Evan Cheng8557c2b2009-06-19 01:51:50 +0000151def : ProcNoItin<"arm10tdmi", [ArchV5T]>;
152def : ProcNoItin<"arm1020t", [ArchV5T]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000153
154// V5TE Processors.
Evan Cheng8557c2b2009-06-19 01:51:50 +0000155def : ProcNoItin<"arm9e", [ArchV5TE]>;
156def : ProcNoItin<"arm926ej-s", [ArchV5TE]>;
157def : ProcNoItin<"arm946e-s", [ArchV5TE]>;
158def : ProcNoItin<"arm966e-s", [ArchV5TE]>;
159def : ProcNoItin<"arm968e-s", [ArchV5TE]>;
160def : ProcNoItin<"arm10e", [ArchV5TE]>;
161def : ProcNoItin<"arm1020e", [ArchV5TE]>;
162def : ProcNoItin<"arm1022e", [ArchV5TE]>;
163def : ProcNoItin<"xscale", [ArchV5TE]>;
164def : ProcNoItin<"iwmmxt", [ArchV5TE]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000165
166// V6 Processors.
David Goodwinebb5cb92009-11-18 18:39:57 +0000167def : Processor<"arm1136j-s", ARMV6Itineraries, [ArchV6]>;
Jim Grosbach1118b5e2010-04-01 00:13:43 +0000168def : Processor<"arm1136jf-s", ARMV6Itineraries, [ArchV6, FeatureVFP2,
Evan Cheng48575f62010-12-05 22:04:16 +0000169 FeatureHasSlowFPVMLx]>;
David Goodwinebb5cb92009-11-18 18:39:57 +0000170def : Processor<"arm1176jz-s", ARMV6Itineraries, [ArchV6]>;
Evan Cheng48575f62010-12-05 22:04:16 +0000171def : Processor<"arm1176jzf-s", ARMV6Itineraries, [ArchV6, FeatureVFP2,
172 FeatureHasSlowFPVMLx]>;
David Goodwinebb5cb92009-11-18 18:39:57 +0000173def : Processor<"mpcorenovfp", ARMV6Itineraries, [ArchV6]>;
Evan Cheng48575f62010-12-05 22:04:16 +0000174def : Processor<"mpcore", ARMV6Itineraries, [ArchV6, FeatureVFP2,
175 FeatureHasSlowFPVMLx]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000176
Evan Chengc7569ed2010-08-11 06:30:38 +0000177// V6M Processors.
Evan Chengd6b46322010-08-11 06:51:54 +0000178def : Processor<"cortex-m0", ARMV6Itineraries, [ArchV6M]>;
Evan Chengc7569ed2010-08-11 06:30:38 +0000179
Anton Korobeynikovfbbf1ee2009-06-08 21:20:36 +0000180// V6T2 Processors.
Evan Chengcb5ce6e2010-08-11 06:57:53 +0000181def : Processor<"arm1156t2-s", ARMV6Itineraries, [ArchV6T2]>;
Evan Cheng48575f62010-12-05 22:04:16 +0000182def : Processor<"arm1156t2f-s", ARMV6Itineraries, [ArchV6T2, FeatureVFP2,
183 FeatureHasSlowFPVMLx]>;
Anton Korobeynikovd4022c32009-05-29 23:41:08 +0000184
Anton Korobeynikovfbbf1ee2009-06-08 21:20:36 +0000185// V7 Processors.
Evan Cheng6762d912009-07-21 18:54:14 +0000186def : Processor<"cortex-a8", CortexA8Itineraries,
Evan Cheng167be802010-12-05 23:03:45 +0000187 [ArchV7A, ProcA8]>;
Anton Korobeynikov2eeeff82010-04-07 18:19:18 +0000188def : Processor<"cortex-a9", CortexA9Itineraries,
Evan Cheng167be802010-12-05 23:03:45 +0000189 [ArchV7A, ProcA9]>;
Bob Wilsoncd704962011-04-19 18:11:52 +0000190def : Processor<"cortex-a9-mp", CortexA9Itineraries,
191 [ArchV7A, ProcA9, FeatureMP]>;
Evan Chengc7569ed2010-08-11 06:30:38 +0000192
193// V7M Processors.
Evan Cheng8d62e712010-08-11 07:00:16 +0000194def : ProcNoItin<"cortex-m3", [ArchV7M]>;
Jim Grosbachfcba5e62010-08-11 15:44:15 +0000195def : ProcNoItin<"cortex-m4", [ArchV7M, FeatureVFP2, FeatureVFPOnlySP]>;
Anton Korobeynikov6d7d2aa2009-05-23 19:51:43 +0000196
Evan Chenga8e29892007-01-19 07:51:42 +0000197//===----------------------------------------------------------------------===//
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000198// Register File Description
199//===----------------------------------------------------------------------===//
200
201include "ARMRegisterInfo.td"
202
Bob Wilson1f595bb2009-04-17 19:07:39 +0000203include "ARMCallingConv.td"
204
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000205//===----------------------------------------------------------------------===//
206// Instruction Descriptions
207//===----------------------------------------------------------------------===//
208
209include "ARMInstrInfo.td"
210
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000211def ARMInstrInfo : InstrInfo;
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000212
Jim Grosbach2317e402010-09-30 01:57:53 +0000213
214//===----------------------------------------------------------------------===//
215// Assembly printer
216//===----------------------------------------------------------------------===//
217// ARM Uses the MC printer for asm output, so make sure the TableGen
218// AsmWriter bits get associated with the correct class.
219def ARMAsmWriter : AsmWriter {
220 string AsmWriterClassName = "InstPrinter";
221 bit isMCAsmWriter = 1;
222}
223
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000224//===----------------------------------------------------------------------===//
225// Declare the target which we are implementing
226//===----------------------------------------------------------------------===//
227
228def ARM : Target {
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000229 // Pull in Instruction Info:
230 let InstructionSet = ARMInstrInfo;
Jim Grosbach2317e402010-09-30 01:57:53 +0000231
232 let AssemblyWriters = [ARMAsmWriter];
Rafael Espindola7bc59bc2006-05-14 22:18:28 +0000233}