Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 1 | //===- ARM.td - Describe the ARM Target Machine -----------------*- C++ -*-===// |
| 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 | |
| 19 | //===----------------------------------------------------------------------===// |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 20 | // ARM Subtarget features. |
| 21 | // |
| 22 | |
Anton Korobeynikov | 6d7d2aa | 2009-05-23 19:51:43 +0000 | [diff] [blame] | 23 | def FeatureVFP2 : SubtargetFeature<"vfp2", "ARMFPUType", "VFPv2", |
Anton Korobeynikov | d4022c3 | 2009-05-29 23:41:08 +0000 | [diff] [blame] | 24 | "Enable VFP2 instructions">; |
Anton Korobeynikov | 6d7d2aa | 2009-05-23 19:51:43 +0000 | [diff] [blame] | 25 | def FeatureVFP3 : SubtargetFeature<"vfp3", "ARMFPUType", "VFPv3", |
Anton Korobeynikov | d4022c3 | 2009-05-29 23:41:08 +0000 | [diff] [blame] | 26 | "Enable VFP3 instructions">; |
Anton Korobeynikov | 6d7d2aa | 2009-05-23 19:51:43 +0000 | [diff] [blame] | 27 | def FeatureNEON : SubtargetFeature<"neon", "ARMFPUType", "NEON", |
Anton Korobeynikov | d4022c3 | 2009-05-29 23:41:08 +0000 | [diff] [blame] | 28 | "Enable NEON instructions">; |
| 29 | def FeatureThumb2 : SubtargetFeature<"thumb2", "ThumbMode", "Thumb2", |
| 30 | "Enable Thumb2 instructions">; |
Anton Korobeynikov | 631379e | 2010-03-14 18:42:38 +0000 | [diff] [blame] | 31 | def FeatureFP16 : SubtargetFeature<"fp16", "HasFP16", "true", |
| 32 | "Enable half-precision floating point">; |
Jim Grosbach | 2940213 | 2010-05-05 23:44:43 +0000 | [diff] [blame] | 33 | def FeatureHWDiv : SubtargetFeature<"hwdiv", "HasHardwareDivide", "true", |
| 34 | "Enable divide instructions">; |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 35 | def FeatureT2XtPk : SubtargetFeature<"t2xtpk", "HasT2ExtractPack", "true", |
Jim Grosbach | 2940213 | 2010-05-05 23:44:43 +0000 | [diff] [blame] | 36 | "Enable Thumb2 extract and pack instructions">; |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 37 | def FeatureDB : SubtargetFeature<"db", "HasDataBarrier", "true", |
| 38 | "Has data barrier (dmb / dsb) instructions">; |
Evan Cheng | 7a41599 | 2010-07-13 19:21:50 +0000 | [diff] [blame] | 39 | def FeatureSlowFPBrcc : SubtargetFeature<"slow-fp-brcc", "SlowFPBrcc", "true", |
| 40 | "FP compare + branch is slow">; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 41 | |
Jim Grosbach | 6b2e8dc | 2010-03-25 23:11:16 +0000 | [diff] [blame] | 42 | // Some processors have multiply-accumulate instructions that don't |
| 43 | // play nicely with other VFP instructions, and it's generally better |
| 44 | // to just not use them. |
| 45 | // FIXME: Currently, this is only flagged for Cortex-A8. It may be true for |
| 46 | // others as well. We should do more benchmarking and confirm one way or |
| 47 | // the other. |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 48 | def FeatureHasSlowVMLx : SubtargetFeature<"vmlx", "SlowVMLx", "true", |
| 49 | "Disable VFP MAC instructions">; |
Jim Grosbach | 7ec7a0e | 2010-03-25 23:47:34 +0000 | [diff] [blame] | 50 | // Some processors benefit from using NEON instructions for scalar |
| 51 | // single-precision FP operations. |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 52 | def FeatureNEONForFP : SubtargetFeature<"neonfp", "UseNEONForSinglePrecisionFP", |
| 53 | "true", |
| 54 | "Use NEON for single precision FP">; |
Jim Grosbach | 7ec7a0e | 2010-03-25 23:47:34 +0000 | [diff] [blame] | 55 | |
Evan Cheng | e44be63 | 2010-08-09 18:35:19 +0000 | [diff] [blame] | 56 | // Disable 32-bit to 16-bit narrowing for experimentation. |
| 57 | def FeaturePref32BitThumb : SubtargetFeature<"32bit", "Pref32BitThumb", "true", |
| 58 | "Prefer 32-bit Thumb instrs">; |
Jim Grosbach | 6b2e8dc | 2010-03-25 23:11:16 +0000 | [diff] [blame] | 59 | |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 60 | |
| 61 | // ARM architectures. |
| 62 | def ArchV4T : SubtargetFeature<"v4t", "ARMArchVersion", "V4T", |
| 63 | "ARM v4T">; |
| 64 | def ArchV5T : SubtargetFeature<"v5t", "ARMArchVersion", "V5T", |
| 65 | "ARM v5T">; |
| 66 | def ArchV5TE : SubtargetFeature<"v5te", "ARMArchVersion", "V5TE", |
| 67 | "ARM v5TE, v5TEj, v5TExp">; |
| 68 | def ArchV6 : SubtargetFeature<"v6", "ARMArchVersion", "V6", |
| 69 | "ARM v6">; |
| 70 | def ArchV6M : SubtargetFeature<"v6m", "ARMArchVersion", "V6M", |
| 71 | "ARM v6m", |
| 72 | [FeatureDB]>; |
| 73 | def ArchV6T2 : SubtargetFeature<"v6t2", "ARMArchVersion", "V6T2", |
Evan Cheng | cb5ce6e | 2010-08-11 06:57:53 +0000 | [diff] [blame] | 74 | "ARM v6t2", |
| 75 | [FeatureThumb2]>; |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 76 | def ArchV7A : SubtargetFeature<"v7a", "ARMArchVersion", "V7A", |
| 77 | "ARM v7A", |
Evan Cheng | cb5ce6e | 2010-08-11 06:57:53 +0000 | [diff] [blame] | 78 | [FeatureThumb2, FeatureNEON, FeatureDB]>; |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 79 | def ArchV7M : SubtargetFeature<"v7m", "ARMArchVersion", "V7M", |
| 80 | "ARM v7M", |
Evan Cheng | 8d62e71 | 2010-08-11 07:00:16 +0000 | [diff] [blame^] | 81 | [FeatureThumb2, FeatureDB, FeatureHWDiv]>; |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 82 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 83 | //===----------------------------------------------------------------------===// |
| 84 | // ARM Processors supported. |
| 85 | // |
| 86 | |
Evan Cheng | 8557c2b | 2009-06-19 01:51:50 +0000 | [diff] [blame] | 87 | include "ARMSchedule.td" |
| 88 | |
| 89 | class ProcNoItin<string Name, list<SubtargetFeature> Features> |
| 90 | : Processor<Name, GenericItineraries, Features>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 91 | |
| 92 | // V4 Processors. |
Evan Cheng | 8557c2b | 2009-06-19 01:51:50 +0000 | [diff] [blame] | 93 | def : ProcNoItin<"generic", []>; |
| 94 | def : ProcNoItin<"arm8", []>; |
| 95 | def : ProcNoItin<"arm810", []>; |
| 96 | def : ProcNoItin<"strongarm", []>; |
| 97 | def : ProcNoItin<"strongarm110", []>; |
| 98 | def : ProcNoItin<"strongarm1100", []>; |
| 99 | def : ProcNoItin<"strongarm1110", []>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 100 | |
| 101 | // V4T Processors. |
Evan Cheng | 8557c2b | 2009-06-19 01:51:50 +0000 | [diff] [blame] | 102 | def : ProcNoItin<"arm7tdmi", [ArchV4T]>; |
| 103 | def : ProcNoItin<"arm7tdmi-s", [ArchV4T]>; |
| 104 | def : ProcNoItin<"arm710t", [ArchV4T]>; |
| 105 | def : ProcNoItin<"arm720t", [ArchV4T]>; |
| 106 | def : ProcNoItin<"arm9", [ArchV4T]>; |
| 107 | def : ProcNoItin<"arm9tdmi", [ArchV4T]>; |
| 108 | def : ProcNoItin<"arm920", [ArchV4T]>; |
| 109 | def : ProcNoItin<"arm920t", [ArchV4T]>; |
| 110 | def : ProcNoItin<"arm922t", [ArchV4T]>; |
| 111 | def : ProcNoItin<"arm940t", [ArchV4T]>; |
| 112 | def : ProcNoItin<"ep9312", [ArchV4T]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 113 | |
| 114 | // V5T Processors. |
Evan Cheng | 8557c2b | 2009-06-19 01:51:50 +0000 | [diff] [blame] | 115 | def : ProcNoItin<"arm10tdmi", [ArchV5T]>; |
| 116 | def : ProcNoItin<"arm1020t", [ArchV5T]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 117 | |
| 118 | // V5TE Processors. |
Evan Cheng | 8557c2b | 2009-06-19 01:51:50 +0000 | [diff] [blame] | 119 | def : ProcNoItin<"arm9e", [ArchV5TE]>; |
| 120 | def : ProcNoItin<"arm926ej-s", [ArchV5TE]>; |
| 121 | def : ProcNoItin<"arm946e-s", [ArchV5TE]>; |
| 122 | def : ProcNoItin<"arm966e-s", [ArchV5TE]>; |
| 123 | def : ProcNoItin<"arm968e-s", [ArchV5TE]>; |
| 124 | def : ProcNoItin<"arm10e", [ArchV5TE]>; |
| 125 | def : ProcNoItin<"arm1020e", [ArchV5TE]>; |
| 126 | def : ProcNoItin<"arm1022e", [ArchV5TE]>; |
| 127 | def : ProcNoItin<"xscale", [ArchV5TE]>; |
| 128 | def : ProcNoItin<"iwmmxt", [ArchV5TE]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 129 | |
| 130 | // V6 Processors. |
David Goodwin | ebb5cb9 | 2009-11-18 18:39:57 +0000 | [diff] [blame] | 131 | def : Processor<"arm1136j-s", ARMV6Itineraries, [ArchV6]>; |
Jim Grosbach | 1118b5e | 2010-04-01 00:13:43 +0000 | [diff] [blame] | 132 | def : Processor<"arm1136jf-s", ARMV6Itineraries, [ArchV6, FeatureVFP2, |
| 133 | FeatureHasSlowVMLx]>; |
David Goodwin | ebb5cb9 | 2009-11-18 18:39:57 +0000 | [diff] [blame] | 134 | def : Processor<"arm1176jz-s", ARMV6Itineraries, [ArchV6]>; |
| 135 | def : Processor<"arm1176jzf-s", ARMV6Itineraries, [ArchV6, FeatureVFP2]>; |
| 136 | def : Processor<"mpcorenovfp", ARMV6Itineraries, [ArchV6]>; |
| 137 | def : Processor<"mpcore", ARMV6Itineraries, [ArchV6, FeatureVFP2]>; |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 138 | |
Evan Cheng | c7569ed | 2010-08-11 06:30:38 +0000 | [diff] [blame] | 139 | // V6M Processors. |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 140 | def : Processor<"cortex-m0", ARMV6Itineraries, [ArchV6M]>; |
Evan Cheng | c7569ed | 2010-08-11 06:30:38 +0000 | [diff] [blame] | 141 | |
Anton Korobeynikov | fbbf1ee | 2009-06-08 21:20:36 +0000 | [diff] [blame] | 142 | // V6T2 Processors. |
Evan Cheng | cb5ce6e | 2010-08-11 06:57:53 +0000 | [diff] [blame] | 143 | def : Processor<"arm1156t2-s", ARMV6Itineraries, [ArchV6T2]>; |
| 144 | def : Processor<"arm1156t2f-s", ARMV6Itineraries, [ArchV6T2, FeatureVFP2]>; |
Anton Korobeynikov | d4022c3 | 2009-05-29 23:41:08 +0000 | [diff] [blame] | 145 | |
Anton Korobeynikov | fbbf1ee | 2009-06-08 21:20:36 +0000 | [diff] [blame] | 146 | // V7 Processors. |
Evan Cheng | 6762d91 | 2009-07-21 18:54:14 +0000 | [diff] [blame] | 147 | def : Processor<"cortex-a8", CortexA8Itineraries, |
Evan Cheng | cb5ce6e | 2010-08-11 06:57:53 +0000 | [diff] [blame] | 148 | [ArchV7A, FeatureHasSlowVMLx, |
Evan Cheng | d6b4632 | 2010-08-11 06:51:54 +0000 | [diff] [blame] | 149 | FeatureSlowFPBrcc, FeatureNEONForFP, FeatureT2XtPk]>; |
Anton Korobeynikov | 2eeeff8 | 2010-04-07 18:19:18 +0000 | [diff] [blame] | 150 | def : Processor<"cortex-a9", CortexA9Itineraries, |
Evan Cheng | cb5ce6e | 2010-08-11 06:57:53 +0000 | [diff] [blame] | 151 | [ArchV7A, FeatureT2XtPk]>; |
Evan Cheng | c7569ed | 2010-08-11 06:30:38 +0000 | [diff] [blame] | 152 | |
| 153 | // V7M Processors. |
Evan Cheng | 8d62e71 | 2010-08-11 07:00:16 +0000 | [diff] [blame^] | 154 | def : ProcNoItin<"cortex-m3", [ArchV7M]>; |
| 155 | def : ProcNoItin<"cortex-m4", [ArchV7M]>; |
Anton Korobeynikov | 6d7d2aa | 2009-05-23 19:51:43 +0000 | [diff] [blame] | 156 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 157 | //===----------------------------------------------------------------------===// |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 158 | // Register File Description |
| 159 | //===----------------------------------------------------------------------===// |
| 160 | |
| 161 | include "ARMRegisterInfo.td" |
| 162 | |
Bob Wilson | 1f595bb | 2009-04-17 19:07:39 +0000 | [diff] [blame] | 163 | include "ARMCallingConv.td" |
| 164 | |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 165 | //===----------------------------------------------------------------------===// |
| 166 | // Instruction Descriptions |
| 167 | //===----------------------------------------------------------------------===// |
| 168 | |
| 169 | include "ARMInstrInfo.td" |
| 170 | |
Jakob Stoklund Olesen | fddb766 | 2010-04-05 03:10:20 +0000 | [diff] [blame] | 171 | def ARMInstrInfo : InstrInfo; |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 172 | |
| 173 | //===----------------------------------------------------------------------===// |
| 174 | // Declare the target which we are implementing |
| 175 | //===----------------------------------------------------------------------===// |
| 176 | |
| 177 | def ARM : Target { |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 178 | // Pull in Instruction Info: |
| 179 | let InstructionSet = ARMInstrInfo; |
| 180 | } |