Chris Lattner | 23e70eb | 2010-08-17 16:20:04 +0000 | [diff] [blame] | 1 | //===- ARM.td - Describe the ARM Target Machine ------------*- tablegen -*-===// |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | // Target-independent interfaces which we are implementing |
| 15 | //===----------------------------------------------------------------------===// |
| 16 | |
Evan Cheng | 027fdbe | 2008-11-24 07:34:46 +0000 | [diff] [blame] | 17 | include "llvm/Target/Target.td" |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 18 | |
Jim Grosbach | 2317e40 | 2010-09-30 01:57:53 +0000 | [diff] [blame] | 19 | |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 20 | //===----------------------------------------------------------------------===// |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 21 | // ARM Subtarget features. |
| 22 | // |
| 23 | |
Anton Korobeynikov | 6d7d2aa | 2009-05-23 19:51:43 +0000 | [diff] [blame] | 24 | def FeatureVFP2 : SubtargetFeature<"vfp2", "ARMFPUType", "VFPv2", |
Anton Korobeynikov | d4022c3 | 2009-05-29 23:41:08 +0000 | [diff] [blame] | 25 | "Enable VFP2 instructions">; |
Anton Korobeynikov | 6d7d2aa | 2009-05-23 19:51:43 +0000 | [diff] [blame] | 26 | def FeatureVFP3 : SubtargetFeature<"vfp3", "ARMFPUType", "VFPv3", |
Anton Korobeynikov | d4022c3 | 2009-05-29 23:41:08 +0000 | [diff] [blame] | 27 | "Enable VFP3 instructions">; |
Anton Korobeynikov | 6d7d2aa | 2009-05-23 19:51:43 +0000 | [diff] [blame] | 28 | def FeatureNEON : SubtargetFeature<"neon", "ARMFPUType", "NEON", |
Anton Korobeynikov | d4022c3 | 2009-05-29 23:41:08 +0000 | [diff] [blame] | 29 | "Enable NEON instructions">; |
| 30 | def FeatureThumb2 : SubtargetFeature<"thumb2", "ThumbMode", "Thumb2", |
| 31 | "Enable Thumb2 instructions">; |
Evan Cheng | 7b4d311 | 2010-08-11 07:17:46 +0000 | [diff] [blame] | 32 | def FeatureNoARM : SubtargetFeature<"noarm", "NoARM", "true", |
| 33 | "Does not support ARM mode execution">; |
Anton Korobeynikov | 631379e | 2010-03-14 18:42:38 +0000 | [diff] [blame] | 34 | def FeatureFP16 : SubtargetFeature<"fp16", "HasFP16", "true", |
| 35 | "Enable half-precision floating point">; |
Bob Wilson | 77f42b5 | 2010-10-12 16:22:47 +0000 | [diff] [blame^] | 36 | def FeatureD16 : SubtargetFeature<"d16", "HasD16", "true", |
| 37 | "Restrict VFP3 to 16 double registers">; |
Jim Grosbach | 2940213 | 2010-05-05 23:44:43 +0000 | [diff] [blame] | 38 | def FeatureHWDiv : SubtargetFeature<"hwdiv", "HasHardwareDivide", "true", |
| 39 | "Enable divide instructions">; |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 40 | def FeatureT2XtPk : SubtargetFeature<"t2xtpk", "HasT2ExtractPack", "true", |
Jim Grosbach | 2940213 | 2010-05-05 23:44:43 +0000 | [diff] [blame] | 41 | "Enable Thumb2 extract and pack instructions">; |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 42 | def FeatureDB : SubtargetFeature<"db", "HasDataBarrier", "true", |
| 43 | "Has data barrier (dmb / dsb) instructions">; |
Evan Cheng | 7a41599 | 2010-07-13 19:21:50 +0000 | [diff] [blame] | 44 | def FeatureSlowFPBrcc : SubtargetFeature<"slow-fp-brcc", "SlowFPBrcc", "true", |
| 45 | "FP compare + branch is slow">; |
Jim Grosbach | fcba5e6 | 2010-08-11 15:44:15 +0000 | [diff] [blame] | 46 | def FeatureVFPOnlySP : SubtargetFeature<"fp-only-sp", "FPOnlySP", "true", |
| 47 | "Floating point unit supports single precision only">; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 48 | |
Jim Grosbach | 6b2e8dc | 2010-03-25 23:11:16 +0000 | [diff] [blame] | 49 | // Some processors have multiply-accumulate instructions that don't |
| 50 | // play nicely with other VFP instructions, and it's generally better |
| 51 | // to just not use them. |
| 52 | // FIXME: Currently, this is only flagged for Cortex-A8. It may be true for |
| 53 | // others as well. We should do more benchmarking and confirm one way or |
| 54 | // the other. |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 55 | def FeatureHasSlowVMLx : SubtargetFeature<"vmlx", "SlowVMLx", "true", |
| 56 | "Disable VFP MAC instructions">; |
Jim Grosbach | 7ec7a0e | 2010-03-25 23:47:34 +0000 | [diff] [blame] | 57 | // Some processors benefit from using NEON instructions for scalar |
| 58 | // single-precision FP operations. |
Jim Grosbach | c5ed013 | 2010-08-17 18:39:16 +0000 | [diff] [blame] | 59 | def FeatureNEONForFP : SubtargetFeature<"neonfp", "UseNEONForSinglePrecisionFP", |
| 60 | "true", |
| 61 | "Use NEON for single precision FP">; |
Jim Grosbach | 7ec7a0e | 2010-03-25 23:47:34 +0000 | [diff] [blame] | 62 | |
Evan Cheng | e44be63 | 2010-08-09 18:35:19 +0000 | [diff] [blame] | 63 | // Disable 32-bit to 16-bit narrowing for experimentation. |
| 64 | def FeaturePref32BitThumb : SubtargetFeature<"32bit", "Pref32BitThumb", "true", |
| 65 | "Prefer 32-bit Thumb instrs">; |
Jim Grosbach | 6b2e8dc | 2010-03-25 23:11:16 +0000 | [diff] [blame] | 66 | |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 67 | |
| 68 | // ARM architectures. |
| 69 | def ArchV4T : SubtargetFeature<"v4t", "ARMArchVersion", "V4T", |
| 70 | "ARM v4T">; |
| 71 | def ArchV5T : SubtargetFeature<"v5t", "ARMArchVersion", "V5T", |
| 72 | "ARM v5T">; |
| 73 | def ArchV5TE : SubtargetFeature<"v5te", "ARMArchVersion", "V5TE", |
| 74 | "ARM v5TE, v5TEj, v5TExp">; |
| 75 | def ArchV6 : SubtargetFeature<"v6", "ARMArchVersion", "V6", |
| 76 | "ARM v6">; |
| 77 | def ArchV6M : SubtargetFeature<"v6m", "ARMArchVersion", "V6M", |
| 78 | "ARM v6m", |
Evan Cheng | 7b4d311 | 2010-08-11 07:17:46 +0000 | [diff] [blame] | 79 | [FeatureNoARM, FeatureDB]>; |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 80 | def ArchV6T2 : SubtargetFeature<"v6t2", "ARMArchVersion", "V6T2", |
Evan Cheng | cb5ce6e | 2010-08-11 06:57:53 +0000 | [diff] [blame] | 81 | "ARM v6t2", |
| 82 | [FeatureThumb2]>; |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 83 | def ArchV7A : SubtargetFeature<"v7a", "ARMArchVersion", "V7A", |
| 84 | "ARM v7A", |
Evan Cheng | cb5ce6e | 2010-08-11 06:57:53 +0000 | [diff] [blame] | 85 | [FeatureThumb2, FeatureNEON, FeatureDB]>; |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 86 | def ArchV7M : SubtargetFeature<"v7m", "ARMArchVersion", "V7M", |
| 87 | "ARM v7M", |
Evan Cheng | 7b4d311 | 2010-08-11 07:17:46 +0000 | [diff] [blame] | 88 | [FeatureThumb2, FeatureNoARM, FeatureDB, |
| 89 | FeatureHWDiv]>; |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 90 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 91 | //===----------------------------------------------------------------------===// |
| 92 | // ARM Processors supported. |
| 93 | // |
| 94 | |
Evan Cheng | 8557c2b | 2009-06-19 01:51:50 +0000 | [diff] [blame] | 95 | include "ARMSchedule.td" |
| 96 | |
Evan Cheng | 3ef1c87 | 2010-09-10 01:29:16 +0000 | [diff] [blame] | 97 | // ARM processor families. |
| 98 | def ProcOthers : SubtargetFeature<"others", "ARMProcFamily", "Others", |
| 99 | "One of the other ARM processor families">; |
| 100 | def ProcA8 : SubtargetFeature<"a8", "ARMProcFamily", "CortexA8", |
| 101 | "Cortex-A8 ARM processors", |
| 102 | [FeatureSlowFPBrcc, FeatureNEONForFP]>; |
| 103 | def ProcA9 : SubtargetFeature<"a9", "ARMProcFamily", "CortexA9", |
| 104 | "Cortex-A9 ARM processors">; |
| 105 | |
Evan Cheng | 8557c2b | 2009-06-19 01:51:50 +0000 | [diff] [blame] | 106 | class ProcNoItin<string Name, list<SubtargetFeature> Features> |
| 107 | : Processor<Name, GenericItineraries, Features>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 108 | |
| 109 | // V4 Processors. |
Evan Cheng | 8557c2b | 2009-06-19 01:51:50 +0000 | [diff] [blame] | 110 | def : ProcNoItin<"generic", []>; |
| 111 | def : ProcNoItin<"arm8", []>; |
| 112 | def : ProcNoItin<"arm810", []>; |
| 113 | def : ProcNoItin<"strongarm", []>; |
| 114 | def : ProcNoItin<"strongarm110", []>; |
| 115 | def : ProcNoItin<"strongarm1100", []>; |
| 116 | def : ProcNoItin<"strongarm1110", []>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 117 | |
| 118 | // V4T Processors. |
Evan Cheng | 8557c2b | 2009-06-19 01:51:50 +0000 | [diff] [blame] | 119 | def : ProcNoItin<"arm7tdmi", [ArchV4T]>; |
| 120 | def : ProcNoItin<"arm7tdmi-s", [ArchV4T]>; |
| 121 | def : ProcNoItin<"arm710t", [ArchV4T]>; |
| 122 | def : ProcNoItin<"arm720t", [ArchV4T]>; |
| 123 | def : ProcNoItin<"arm9", [ArchV4T]>; |
| 124 | def : ProcNoItin<"arm9tdmi", [ArchV4T]>; |
| 125 | def : ProcNoItin<"arm920", [ArchV4T]>; |
| 126 | def : ProcNoItin<"arm920t", [ArchV4T]>; |
| 127 | def : ProcNoItin<"arm922t", [ArchV4T]>; |
| 128 | def : ProcNoItin<"arm940t", [ArchV4T]>; |
| 129 | def : ProcNoItin<"ep9312", [ArchV4T]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 130 | |
| 131 | // V5T Processors. |
Evan Cheng | 8557c2b | 2009-06-19 01:51:50 +0000 | [diff] [blame] | 132 | def : ProcNoItin<"arm10tdmi", [ArchV5T]>; |
| 133 | def : ProcNoItin<"arm1020t", [ArchV5T]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 134 | |
| 135 | // V5TE Processors. |
Evan Cheng | 8557c2b | 2009-06-19 01:51:50 +0000 | [diff] [blame] | 136 | def : ProcNoItin<"arm9e", [ArchV5TE]>; |
| 137 | def : ProcNoItin<"arm926ej-s", [ArchV5TE]>; |
| 138 | def : ProcNoItin<"arm946e-s", [ArchV5TE]>; |
| 139 | def : ProcNoItin<"arm966e-s", [ArchV5TE]>; |
| 140 | def : ProcNoItin<"arm968e-s", [ArchV5TE]>; |
| 141 | def : ProcNoItin<"arm10e", [ArchV5TE]>; |
| 142 | def : ProcNoItin<"arm1020e", [ArchV5TE]>; |
| 143 | def : ProcNoItin<"arm1022e", [ArchV5TE]>; |
| 144 | def : ProcNoItin<"xscale", [ArchV5TE]>; |
| 145 | def : ProcNoItin<"iwmmxt", [ArchV5TE]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 146 | |
| 147 | // V6 Processors. |
David Goodwin | ebb5cb9 | 2009-11-18 18:39:57 +0000 | [diff] [blame] | 148 | def : Processor<"arm1136j-s", ARMV6Itineraries, [ArchV6]>; |
Jim Grosbach | 1118b5e | 2010-04-01 00:13:43 +0000 | [diff] [blame] | 149 | def : Processor<"arm1136jf-s", ARMV6Itineraries, [ArchV6, FeatureVFP2, |
| 150 | FeatureHasSlowVMLx]>; |
David Goodwin | ebb5cb9 | 2009-11-18 18:39:57 +0000 | [diff] [blame] | 151 | def : Processor<"arm1176jz-s", ARMV6Itineraries, [ArchV6]>; |
| 152 | def : Processor<"arm1176jzf-s", ARMV6Itineraries, [ArchV6, FeatureVFP2]>; |
| 153 | def : Processor<"mpcorenovfp", ARMV6Itineraries, [ArchV6]>; |
| 154 | def : Processor<"mpcore", ARMV6Itineraries, [ArchV6, FeatureVFP2]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 155 | |
Evan Cheng | c7569ed | 2010-08-11 06:30:38 +0000 | [diff] [blame] | 156 | // V6M Processors. |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 157 | def : Processor<"cortex-m0", ARMV6Itineraries, [ArchV6M]>; |
Evan Cheng | c7569ed | 2010-08-11 06:30:38 +0000 | [diff] [blame] | 158 | |
Anton Korobeynikov | fbbf1ee | 2009-06-08 21:20:36 +0000 | [diff] [blame] | 159 | // V6T2 Processors. |
Evan Cheng | cb5ce6e | 2010-08-11 06:57:53 +0000 | [diff] [blame] | 160 | def : Processor<"arm1156t2-s", ARMV6Itineraries, [ArchV6T2]>; |
| 161 | def : Processor<"arm1156t2f-s", ARMV6Itineraries, [ArchV6T2, FeatureVFP2]>; |
Anton Korobeynikov | d4022c3 | 2009-05-29 23:41:08 +0000 | [diff] [blame] | 162 | |
Anton Korobeynikov | fbbf1ee | 2009-06-08 21:20:36 +0000 | [diff] [blame] | 163 | // V7 Processors. |
Evan Cheng | 6762d91 | 2009-07-21 18:54:14 +0000 | [diff] [blame] | 164 | def : Processor<"cortex-a8", CortexA8Itineraries, |
Evan Cheng | 3ef1c87 | 2010-09-10 01:29:16 +0000 | [diff] [blame] | 165 | [ArchV7A, ProcA8, |
| 166 | FeatureHasSlowVMLx, FeatureT2XtPk]>; |
Anton Korobeynikov | 2eeeff8 | 2010-04-07 18:19:18 +0000 | [diff] [blame] | 167 | def : Processor<"cortex-a9", CortexA9Itineraries, |
Evan Cheng | 3ef1c87 | 2010-09-10 01:29:16 +0000 | [diff] [blame] | 168 | [ArchV7A, ProcA9, FeatureT2XtPk]>; |
Evan Cheng | c7569ed | 2010-08-11 06:30:38 +0000 | [diff] [blame] | 169 | |
| 170 | // V7M Processors. |
Evan Cheng | 8d62e71 | 2010-08-11 07:00:16 +0000 | [diff] [blame] | 171 | def : ProcNoItin<"cortex-m3", [ArchV7M]>; |
Jim Grosbach | fcba5e6 | 2010-08-11 15:44:15 +0000 | [diff] [blame] | 172 | def : ProcNoItin<"cortex-m4", [ArchV7M, FeatureVFP2, FeatureVFPOnlySP]>; |
Anton Korobeynikov | 6d7d2aa | 2009-05-23 19:51:43 +0000 | [diff] [blame] | 173 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 174 | //===----------------------------------------------------------------------===// |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 175 | // Register File Description |
| 176 | //===----------------------------------------------------------------------===// |
| 177 | |
| 178 | include "ARMRegisterInfo.td" |
| 179 | |
Bob Wilson | 1f595bb | 2009-04-17 19:07:39 +0000 | [diff] [blame] | 180 | include "ARMCallingConv.td" |
| 181 | |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 182 | //===----------------------------------------------------------------------===// |
| 183 | // Instruction Descriptions |
| 184 | //===----------------------------------------------------------------------===// |
| 185 | |
| 186 | include "ARMInstrInfo.td" |
| 187 | |
Jakob Stoklund Olesen | fddb766 | 2010-04-05 03:10:20 +0000 | [diff] [blame] | 188 | def ARMInstrInfo : InstrInfo; |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 189 | |
Jim Grosbach | 2317e40 | 2010-09-30 01:57:53 +0000 | [diff] [blame] | 190 | |
| 191 | //===----------------------------------------------------------------------===// |
| 192 | // Assembly printer |
| 193 | //===----------------------------------------------------------------------===// |
| 194 | // ARM Uses the MC printer for asm output, so make sure the TableGen |
| 195 | // AsmWriter bits get associated with the correct class. |
| 196 | def ARMAsmWriter : AsmWriter { |
| 197 | string AsmWriterClassName = "InstPrinter"; |
| 198 | bit isMCAsmWriter = 1; |
| 199 | } |
| 200 | |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 201 | //===----------------------------------------------------------------------===// |
| 202 | // Declare the target which we are implementing |
| 203 | //===----------------------------------------------------------------------===// |
| 204 | |
| 205 | def ARM : Target { |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 206 | // Pull in Instruction Info: |
| 207 | let InstructionSet = ARMInstrInfo; |
Jim Grosbach | 2317e40 | 2010-09-30 01:57:53 +0000 | [diff] [blame] | 208 | |
| 209 | let AssemblyWriters = [ARMAsmWriter]; |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 210 | } |