Add Cortex-M0 support. It's a ARMv6m device (no ARM mode) with some 32-bit
[oota-llvm.git] / lib / Target / ARM / ARM.td
1 //===- ARM.td - Describe the ARM Target Machine -----------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //
11 //===----------------------------------------------------------------------===//
12
13 //===----------------------------------------------------------------------===//
14 // Target-independent interfaces which we are implementing
15 //===----------------------------------------------------------------------===//
16
17 include "llvm/Target/Target.td"
18
19 //===----------------------------------------------------------------------===//
20 // ARM Subtarget features.
21 //
22
23 def ArchV4T     : SubtargetFeature<"v4t", "ARMArchVersion", "V4T",
24                                    "ARM v4T">;
25 def ArchV5T     : SubtargetFeature<"v5t", "ARMArchVersion", "V5T",
26                                    "ARM v5T">;
27 def ArchV5TE    : SubtargetFeature<"v5te", "ARMArchVersion", "V5TE",
28                                    "ARM v5TE, v5TEj, v5TExp">;
29 def ArchV6      : SubtargetFeature<"v6", "ARMArchVersion", "V6",
30                                    "ARM v6">;
31 def ArchV6T2    : SubtargetFeature<"v6t2", "ARMArchVersion", "V6T2",
32                                    "ARM v6t2">;
33 def ArchV7A     : SubtargetFeature<"v7a", "ARMArchVersion", "V7A",
34                                    "ARM v7A">;
35 def ArchV7M     : SubtargetFeature<"v7m", "ARMArchVersion", "V7M",
36                                    "ARM v7M">;
37 def FeatureVFP2 : SubtargetFeature<"vfp2", "ARMFPUType", "VFPv2",
38                                    "Enable VFP2 instructions">;
39 def FeatureVFP3 : SubtargetFeature<"vfp3", "ARMFPUType", "VFPv3",
40                                    "Enable VFP3 instructions">;
41 def FeatureNEON : SubtargetFeature<"neon", "ARMFPUType", "NEON",
42                                    "Enable NEON instructions">;
43 def FeatureThumb2 : SubtargetFeature<"thumb2", "ThumbMode", "Thumb2",
44                                      "Enable Thumb2 instructions">;
45 def FeatureFP16   : SubtargetFeature<"fp16", "HasFP16", "true",
46                                      "Enable half-precision floating point">;
47 def FeatureHWDiv  : SubtargetFeature<"hwdiv", "HasHardwareDivide", "true",
48                                      "Enable divide instructions">;
49 def FeatureT2ExtractPack: SubtargetFeature<"t2xtpk", "HasT2ExtractPack", "true",
50                                  "Enable Thumb2 extract and pack instructions">;
51 def FeatureDB : SubtargetFeature<"db", "HasDataBarrier", "true",
52                                  "Has data barrier (dmb / dsb) instructions">;
53 def FeatureSlowFPBrcc : SubtargetFeature<"slow-fp-brcc", "SlowFPBrcc", "true",
54                                          "FP compare + branch is slow">;
55
56 // Some processors have multiply-accumulate instructions that don't
57 // play nicely with other VFP instructions, and it's generally better
58 // to just not use them.
59 // FIXME: Currently, this is only flagged for Cortex-A8. It may be true for
60 // others as well. We should do more benchmarking and confirm one way or
61 // the other.
62 def FeatureHasSlowVMLx   : SubtargetFeature<"vmlx", "SlowVMLx", "true",
63                                             "Disable VFP MAC instructions">;
64 // Some processors benefit from using NEON instructions for scalar
65 // single-precision FP operations.
66 def FeatureNEONForFP : SubtargetFeature<"neonfp", "UseNEONForSinglePrecisionFP",
67                                         "true",
68                                         "Use NEON for single precision FP">;
69
70 // Disable 32-bit to 16-bit narrowing for experimentation.
71 def FeaturePref32BitThumb : SubtargetFeature<"32bit", "Pref32BitThumb", "true",
72                                              "Prefer 32-bit Thumb instrs">;
73
74 //===----------------------------------------------------------------------===//
75 // ARM Processors supported.
76 //
77
78 include "ARMSchedule.td"
79
80 class ProcNoItin<string Name, list<SubtargetFeature> Features>
81  : Processor<Name, GenericItineraries, Features>;
82
83 // V4 Processors.
84 def : ProcNoItin<"generic",         []>;
85 def : ProcNoItin<"arm8",            []>;
86 def : ProcNoItin<"arm810",          []>;
87 def : ProcNoItin<"strongarm",       []>;
88 def : ProcNoItin<"strongarm110",    []>;
89 def : ProcNoItin<"strongarm1100",   []>;
90 def : ProcNoItin<"strongarm1110",   []>;
91
92 // V4T Processors.
93 def : ProcNoItin<"arm7tdmi",        [ArchV4T]>;
94 def : ProcNoItin<"arm7tdmi-s",      [ArchV4T]>;
95 def : ProcNoItin<"arm710t",         [ArchV4T]>;
96 def : ProcNoItin<"arm720t",         [ArchV4T]>;
97 def : ProcNoItin<"arm9",            [ArchV4T]>;
98 def : ProcNoItin<"arm9tdmi",        [ArchV4T]>;
99 def : ProcNoItin<"arm920",          [ArchV4T]>;
100 def : ProcNoItin<"arm920t",         [ArchV4T]>;
101 def : ProcNoItin<"arm922t",         [ArchV4T]>;
102 def : ProcNoItin<"arm940t",         [ArchV4T]>;
103 def : ProcNoItin<"ep9312",          [ArchV4T]>;
104
105 // V5T Processors.
106 def : ProcNoItin<"arm10tdmi",       [ArchV5T]>;
107 def : ProcNoItin<"arm1020t",        [ArchV5T]>;
108
109 // V5TE Processors.
110 def : ProcNoItin<"arm9e",           [ArchV5TE]>;
111 def : ProcNoItin<"arm926ej-s",      [ArchV5TE]>;
112 def : ProcNoItin<"arm946e-s",       [ArchV5TE]>;
113 def : ProcNoItin<"arm966e-s",       [ArchV5TE]>;
114 def : ProcNoItin<"arm968e-s",       [ArchV5TE]>;
115 def : ProcNoItin<"arm10e",          [ArchV5TE]>;
116 def : ProcNoItin<"arm1020e",        [ArchV5TE]>;
117 def : ProcNoItin<"arm1022e",        [ArchV5TE]>;
118 def : ProcNoItin<"xscale",          [ArchV5TE]>;
119 def : ProcNoItin<"iwmmxt",          [ArchV5TE]>;
120
121 // V6 Processors.
122 def : Processor<"arm1136j-s",       ARMV6Itineraries, [ArchV6]>;
123 def : Processor<"arm1136jf-s",      ARMV6Itineraries, [ArchV6, FeatureVFP2,
124                                                        FeatureHasSlowVMLx]>;
125 def : Processor<"arm1176jz-s",      ARMV6Itineraries, [ArchV6]>;
126 def : Processor<"arm1176jzf-s",     ARMV6Itineraries, [ArchV6, FeatureVFP2]>;
127 def : Processor<"mpcorenovfp",      ARMV6Itineraries, [ArchV6]>;
128 def : Processor<"mpcore",           ARMV6Itineraries, [ArchV6, FeatureVFP2]>;
129
130 // V6M Processors.
131 def : Processor<"cortex-m0",        ARMV6Itineraries, [ArchV6, FeatureDB]>;
132
133 // V6T2 Processors.
134 def : Processor<"arm1156t2-s",     ARMV6Itineraries,
135                  [ArchV6T2, FeatureThumb2]>;
136 def : Processor<"arm1156t2f-s",    ARMV6Itineraries,
137                  [ArchV6T2, FeatureThumb2, FeatureVFP2]>;
138
139 // V7 Processors.
140 def : Processor<"cortex-a8",        CortexA8Itineraries,
141                 [ArchV7A, FeatureThumb2, FeatureNEON, FeatureHasSlowVMLx,
142                  FeatureSlowFPBrcc, FeatureNEONForFP, FeatureT2ExtractPack,
143                  FeatureDB]>;
144 def : Processor<"cortex-a9",        CortexA9Itineraries,
145                 [ArchV7A, FeatureThumb2, FeatureNEON, FeatureT2ExtractPack,
146                  FeatureDB]>;
147
148 // V7M Processors.
149 def : ProcNoItin<"cortex-m3",       [ArchV7M, FeatureThumb2, FeatureHWDiv,
150                                      FeatureDB]>;
151 def : ProcNoItin<"cortex-m4",       [ArchV7M, FeatureThumb2, FeatureHWDiv,
152                                      FeatureDB]>;
153
154 //===----------------------------------------------------------------------===//
155 // Register File Description
156 //===----------------------------------------------------------------------===//
157
158 include "ARMRegisterInfo.td"
159
160 include "ARMCallingConv.td"
161
162 //===----------------------------------------------------------------------===//
163 // Instruction Descriptions
164 //===----------------------------------------------------------------------===//
165
166 include "ARMInstrInfo.td"
167
168 def ARMInstrInfo : InstrInfo;
169
170 //===----------------------------------------------------------------------===//
171 // Declare the target which we are implementing
172 //===----------------------------------------------------------------------===//
173
174 def ARM : Target {
175   // Pull in Instruction Info:
176   let InstructionSet = ARMInstrInfo;
177 }