• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//===-- AVR.td - Describe the AVR Target Machine ----------*- tablegen -*-===//
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// This is the top level entry point for the AVR target.
10//===---------------------------------------------------------------------===//
11
12//===---------------------------------------------------------------------===//
13// Target-independent interfaces which we are implementing
14//===---------------------------------------------------------------------===//
15
16include "llvm/Target/Target.td"
17
18//===---------------------------------------------------------------------===//
19// AVR Subtarget Features.
20//===---------------------------------------------------------------------===//
21
22// :TODO: Implement the skip errata, see `gcc/config/avr/avr-arch.h` for details
23// :TODO: We define all devices with SRAM to have all variants of LD/ST/LDD/STD.
24//        In reality, avr1 (no SRAM) has one variant each of `LD` and `ST`.
25//        avr2 (with SRAM) adds the rest of the variants.
26// :TODO: s/AVRTiny/Tiny
27
28
29// A feature set aggregates features, grouping them. We don't want to create a
30// new member in AVRSubtarget (to store a value) for each set because we do not
31// care if the set is supported, only the subfeatures inside the set. We fix
32// this by simply setting the same dummy member for all feature sets, which is
33// then ignored.
34class FeatureSet<string name, string desc, list<SubtargetFeature> i>
35  : SubtargetFeature<name, "m_FeatureSetDummy", "true", desc, i>;
36
37// A family of microcontrollers, defining a set of supported features.
38class Family<string name, list<SubtargetFeature> i>
39  : FeatureSet<name, !strconcat("The device is a part of the ",
40               name, " family"), i>;
41
42// The device has SRAM, and supports the bare minimum of
43// SRAM-relevant instructions.
44//
45// These are:
46// LD - all 9 variants
47// ST - all 9 variants
48// LDD - two variants for Y and Z
49// STD - two variants for Y and Z
50// `LDS Rd, K`
51// `STS k, Rr`
52// `PUSH`/`POP`
53def FeatureSRAM           : SubtargetFeature<"sram", "m_hasSRAM", "true",
54                                  "The device has random access memory">;
55
56// The device supports the `JMP k` and `CALL k` instructions.
57def FeatureJMPCALL        : SubtargetFeature<"jmpcall", "m_hasJMPCALL", "true",
58                                  "The device supports the `JMP` and "
59                                  "`CALL` instructions">;
60
61
62// The device supports the indirect branches `IJMP` and `ICALL`.
63def FeatureIJMPCALL       : SubtargetFeature<"ijmpcall", "m_hasIJMPCALL",
64                                  "true",
65                                  "The device supports `IJMP`/`ICALL`"
66                                  "instructions">;
67
68// The device supports the extended indirect branches `EIJMP` and `EICALL`.
69def FeatureEIJMPCALL      : SubtargetFeature<"eijmpcall", "m_hasEIJMPCALL",
70                                  "true", "The device supports the "
71                                  "`EIJMP`/`EICALL` instructions">;
72
73// The device supports `ADDI Rd, K`, `SUBI Rd, K`.
74def FeatureADDSUBIW       : SubtargetFeature<"addsubiw", "m_hasADDSUBIW",
75                                  "true", "Enable 16-bit register-immediate "
76                                  "addition and subtraction instructions">;
77
78// The device has an 8-bit stack pointer (SP) register.
79def FeatureSmallStack     : SubtargetFeature<"smallstack", "m_hasSmallStack",
80                                  "true", "The device has an 8-bit "
81                                  "stack pointer">;
82
83// The device supports the 16-bit GPR pair MOVW instruction.
84def FeatureMOVW           : SubtargetFeature<"movw", "m_hasMOVW", "true",
85                                  "The device supports the 16-bit MOVW "
86                                  "instruction">;
87
88// The device supports the `LPM` instruction, with implied destination being r0.
89def FeatureLPM            : SubtargetFeature<"lpm", "m_hasLPM", "true",
90                                  "The device supports the `LPM` instruction">;
91
92// The device supports the `LPM Rd, Z[+] instruction.
93def FeatureLPMX           : SubtargetFeature<"lpmx", "m_hasLPMX", "true",
94                                  "The device supports the `LPM Rd, Z[+]` "
95                                  "instruction">;
96
97// The device supports the `ELPM` instruction.
98def FeatureELPM           : SubtargetFeature<"elpm", "m_hasELPM", "true",
99                                  "The device supports the ELPM instruction">;
100
101// The device supports the `ELPM Rd, Z[+]` instructions.
102def FeatureELPMX          : SubtargetFeature<"elpmx", "m_hasELPMX", "true",
103                                  "The device supports the `ELPM Rd, Z[+]` "
104                                  "instructions">;
105
106// The device supports the `SPM` instruction.
107def FeatureSPM            : SubtargetFeature<"spm", "m_hasSPM", "true",
108                                  "The device supports the `SPM` instruction">;
109
110// The device supports the `SPM Z+` instruction.
111def FeatureSPMX           : SubtargetFeature<"spmx", "m_hasSPMX", "true",
112                                  "The device supports the `SPM Z+` "
113                                  "instruction">;
114
115// The device supports the `DES k` instruction.
116def FeatureDES            : SubtargetFeature<"des", "m_hasDES", "true",
117                                  "The device supports the `DES k` encryption "
118                                  "instruction">;
119
120// The device supports the Read-Write-Modify instructions
121// XCH, LAS, LAC, and LAT.
122def FeatureRMW            : SubtargetFeature<"rmw", "m_supportsRMW", "true",
123                                  "The device supports the read-write-modify "
124                                  "instructions: XCH, LAS, LAC, LAT">;
125
126// The device supports the `[F]MUL[S][U]` family of instructions.
127def FeatureMultiplication : SubtargetFeature<"mul", "m_supportsMultiplication",
128                                  "true", "The device supports the "
129                                  "multiplication instructions">;
130
131// The device supports the `BREAK` instruction.
132def FeatureBREAK          : SubtargetFeature<"break", "m_hasBREAK", "true",
133                                  "The device supports the `BREAK` debugging "
134                                  "instruction">;
135
136// The device has instruction encodings specific to the Tiny core.
137def FeatureTinyEncoding   : SubtargetFeature<"tinyencoding",
138                                  "m_hasTinyEncoding", "true",
139                                  "The device has Tiny core specific "
140                                  "instruction encodings">;
141
142class ELFArch<string name>  : SubtargetFeature<"", "ELFArch",
143                                    !strconcat("ELF::",name), "">;
144
145// ELF e_flags architecture values
146def ELFArchAVR1    : ELFArch<"EF_AVR_ARCH_AVR1">;
147def ELFArchAVR2    : ELFArch<"EF_AVR_ARCH_AVR2">;
148def ELFArchAVR25   : ELFArch<"EF_AVR_ARCH_AVR25">;
149def ELFArchAVR3    : ELFArch<"EF_AVR_ARCH_AVR3">;
150def ELFArchAVR31   : ELFArch<"EF_AVR_ARCH_AVR31">;
151def ELFArchAVR35   : ELFArch<"EF_AVR_ARCH_AVR35">;
152def ELFArchAVR4    : ELFArch<"EF_AVR_ARCH_AVR4">;
153def ELFArchAVR5    : ELFArch<"EF_AVR_ARCH_AVR5">;
154def ELFArchAVR51   : ELFArch<"EF_AVR_ARCH_AVR51">;
155def ELFArchAVR6    : ELFArch<"EF_AVR_ARCH_AVR6">;
156def ELFArchAVRTiny : ELFArch<"EF_AVR_ARCH_AVRTINY">;
157def ELFArchXMEGA1  : ELFArch<"EF_AVR_ARCH_XMEGA1">;
158def ELFArchXMEGA2  : ELFArch<"EF_AVR_ARCH_XMEGA2">;
159def ELFArchXMEGA3  : ELFArch<"EF_AVR_ARCH_XMEGA3">;
160def ELFArchXMEGA4  : ELFArch<"EF_AVR_ARCH_XMEGA4">;
161def ELFArchXMEGA5  : ELFArch<"EF_AVR_ARCH_XMEGA5">;
162def ELFArchXMEGA6  : ELFArch<"EF_AVR_ARCH_XMEGA6">;
163def ELFArchXMEGA7  : ELFArch<"EF_AVR_ARCH_XMEGA7">;
164
165//===---------------------------------------------------------------------===//
166// AVR Families
167//===---------------------------------------------------------------------===//
168
169// The device has at least the bare minimum that **every** single AVR
170// device should have.
171def FamilyAVR0           : Family<"avr0", []>;
172
173def FamilyAVR1           : Family<"avr1", [FamilyAVR0, FeatureLPM]>;
174
175def FamilyAVR2           : Family<"avr2",
176                                 [FamilyAVR1, FeatureIJMPCALL, FeatureADDSUBIW,
177                                  FeatureSRAM]>;
178
179def FamilyAVR25          : Family<"avr25",
180                                 [FamilyAVR2, FeatureMOVW, FeatureLPMX,
181                                  FeatureSPM, FeatureBREAK]>;
182
183def FamilyAVR3           : Family<"avr3",
184                                 [FamilyAVR2, FeatureJMPCALL]>;
185
186def FamilyAVR31          : Family<"avr31",
187                                 [FamilyAVR3, FeatureELPM]>;
188
189def FamilyAVR35          : Family<"avr35",
190                                 [FamilyAVR3, FeatureMOVW, FeatureLPMX,
191                                  FeatureSPM, FeatureBREAK]>;
192
193def FamilyAVR4           : Family<"avr4",
194                                 [FamilyAVR2, FeatureMultiplication,
195                                  FeatureMOVW, FeatureLPMX, FeatureSPM,
196                                  FeatureBREAK]>;
197
198def FamilyAVR5           : Family<"avr5",
199                                 [FamilyAVR3, FeatureMultiplication,
200                                  FeatureMOVW, FeatureLPMX, FeatureSPM,
201                                  FeatureBREAK]>;
202
203def FamilyAVR51          : Family<"avr51",
204                                 [FamilyAVR5, FeatureELPM, FeatureELPMX]>;
205
206def FamilyAVR6           : Family<"avr6",
207                                 [FamilyAVR51]>;
208
209def FamilyAVRTiny        : Family<"avrtiny",
210                                 [FamilyAVR0, FeatureBREAK, FeatureSRAM,
211                                  FeatureTinyEncoding]>;
212
213def FamilyXMEGA          : Family<"xmega",
214                                 [FamilyAVR51, FeatureEIJMPCALL, FeatureSPMX,
215                                  FeatureDES]>;
216
217def FamilyXMEGAU         : Family<"xmegau",
218                                  [FamilyXMEGA, FeatureRMW]>;
219
220def FeatureSetSpecial    : FeatureSet<"special",
221                                      "Enable use of the entire instruction "
222                                      "set - used for debugging",
223                                      [FeatureSRAM, FeatureJMPCALL,
224                                       FeatureIJMPCALL, FeatureEIJMPCALL,
225                                       FeatureADDSUBIW, FeatureMOVW,
226                                       FeatureLPM, FeatureLPMX, FeatureELPM,
227                                       FeatureELPMX, FeatureSPM, FeatureSPMX,
228                                       FeatureDES, FeatureRMW,
229                                       FeatureMultiplication, FeatureBREAK]>;
230
231//===---------------------------------------------------------------------===//
232// AVR microcontrollers supported.
233//===---------------------------------------------------------------------===//
234
235class Device<string Name, Family Fam, ELFArch Arch,
236             list<SubtargetFeature> ExtraFeatures = []>
237  : Processor<Name, NoItineraries, !listconcat([Fam,Arch],ExtraFeatures)>;
238
239// Generic MCUs
240// Note that several versions of GCC has strange ELF architecture
241// settings for backwards compatibility - see `gas/config/tc-avr.c`
242// in AVR binutils. We do not replicate this.
243def : Device<"avr1",      FamilyAVR1,    ELFArchAVR1>;
244def : Device<"avr2",      FamilyAVR2,    ELFArchAVR2>;
245def : Device<"avr25",     FamilyAVR25,   ELFArchAVR25>;
246def : Device<"avr3",      FamilyAVR3,    ELFArchAVR3>;
247def : Device<"avr31",     FamilyAVR31,   ELFArchAVR31>;
248def : Device<"avr35",     FamilyAVR35,   ELFArchAVR35>;
249def : Device<"avr4",      FamilyAVR4,    ELFArchAVR4>;
250def : Device<"avr5",      FamilyAVR5,    ELFArchAVR5>;
251def : Device<"avr51",     FamilyAVR51,   ELFArchAVR51>;
252def : Device<"avr6",      FamilyAVR6,    ELFArchAVR6>;
253def : Device<"avrxmega1", FamilyXMEGA,   ELFArchXMEGA1>;
254def : Device<"avrxmega2", FamilyXMEGA,   ELFArchXMEGA2>;
255def : Device<"avrxmega3", FamilyXMEGA,   ELFArchXMEGA3>;
256def : Device<"avrxmega4", FamilyXMEGA,   ELFArchXMEGA4>;
257def : Device<"avrxmega5", FamilyXMEGA,   ELFArchXMEGA5>;
258def : Device<"avrxmega6", FamilyXMEGA,   ELFArchXMEGA6>;
259def : Device<"avrxmega7", FamilyXMEGA,   ELFArchXMEGA7>;
260def : Device<"avrtiny",   FamilyAVRTiny, ELFArchAVRTiny>;
261
262// Specific MCUs
263def : Device<"at90s1200",          FamilyAVR0, ELFArchAVR1>;
264def : Device<"attiny11",           FamilyAVR1, ELFArchAVR1>;
265def : Device<"attiny12",           FamilyAVR1, ELFArchAVR1>;
266def : Device<"attiny15",           FamilyAVR1, ELFArchAVR1>;
267def : Device<"attiny28",           FamilyAVR1, ELFArchAVR1>;
268def : Device<"at90s2313",          FamilyAVR2, ELFArchAVR2>;
269def : Device<"at90s2323",          FamilyAVR2, ELFArchAVR2>;
270def : Device<"at90s2333",          FamilyAVR2, ELFArchAVR2>;
271def : Device<"at90s2343",          FamilyAVR2, ELFArchAVR2>;
272def : Device<"attiny22",           FamilyAVR2, ELFArchAVR2>;
273def : Device<"attiny26",           FamilyAVR2, ELFArchAVR2, [FeatureLPMX]>;
274def : Device<"at86rf401",          FamilyAVR2, ELFArchAVR25,
275             [FeatureMOVW, FeatureLPMX]>;
276def : Device<"at90s4414",          FamilyAVR2, ELFArchAVR2>;
277def : Device<"at90s4433",          FamilyAVR2, ELFArchAVR2>;
278def : Device<"at90s4434",          FamilyAVR2, ELFArchAVR2>;
279def : Device<"at90s8515",          FamilyAVR2, ELFArchAVR2>;
280def : Device<"at90c8534",          FamilyAVR2, ELFArchAVR2>;
281def : Device<"at90s8535",          FamilyAVR2, ELFArchAVR2>;
282def : Device<"ata5272",            FamilyAVR25, ELFArchAVR25>;
283def : Device<"attiny13",           FamilyAVR25, ELFArchAVR25>;
284def : Device<"attiny13a",          FamilyAVR25, ELFArchAVR25>;
285def : Device<"attiny2313",         FamilyAVR25, ELFArchAVR25>;
286def : Device<"attiny2313a",        FamilyAVR25, ELFArchAVR25>;
287def : Device<"attiny24",           FamilyAVR25, ELFArchAVR25>;
288def : Device<"attiny24a",          FamilyAVR25, ELFArchAVR25>;
289def : Device<"attiny4313",         FamilyAVR25, ELFArchAVR25>;
290def : Device<"attiny44",           FamilyAVR25, ELFArchAVR25>;
291def : Device<"attiny44a",          FamilyAVR25, ELFArchAVR25>;
292def : Device<"attiny84",           FamilyAVR25, ELFArchAVR25>;
293def : Device<"attiny84a",          FamilyAVR25, ELFArchAVR25>;
294def : Device<"attiny25",           FamilyAVR25, ELFArchAVR25>;
295def : Device<"attiny45",           FamilyAVR25, ELFArchAVR25>;
296def : Device<"attiny85",           FamilyAVR25, ELFArchAVR25>;
297def : Device<"attiny261",          FamilyAVR25, ELFArchAVR25>;
298def : Device<"attiny261a",         FamilyAVR25, ELFArchAVR25>;
299def : Device<"attiny461",          FamilyAVR25, ELFArchAVR25>;
300def : Device<"attiny461a",         FamilyAVR25, ELFArchAVR25>;
301def : Device<"attiny861",          FamilyAVR25, ELFArchAVR25>;
302def : Device<"attiny861a",         FamilyAVR25, ELFArchAVR25>;
303def : Device<"attiny87",           FamilyAVR25, ELFArchAVR25>;
304def : Device<"attiny43u",          FamilyAVR25, ELFArchAVR25>;
305def : Device<"attiny48",           FamilyAVR25, ELFArchAVR25>;
306def : Device<"attiny88",           FamilyAVR25, ELFArchAVR25>;
307def : Device<"attiny828",          FamilyAVR25, ELFArchAVR25>;
308def : Device<"at43usb355",         FamilyAVR3,  ELFArchAVR3>;
309def : Device<"at76c711",           FamilyAVR3,  ELFArchAVR3>;
310def : Device<"atmega103",          FamilyAVR31, ELFArchAVR31>;
311def : Device<"at43usb320",         FamilyAVR31, ELFArchAVR31>;
312def : Device<"attiny167",          FamilyAVR35, ELFArchAVR35>;
313def : Device<"at90usb82",          FamilyAVR35, ELFArchAVR35>;
314def : Device<"at90usb162",         FamilyAVR35, ELFArchAVR35>;
315def : Device<"ata5505",            FamilyAVR35, ELFArchAVR35>;
316def : Device<"atmega8u2",          FamilyAVR35, ELFArchAVR35>;
317def : Device<"atmega16u2",         FamilyAVR35, ELFArchAVR35>;
318def : Device<"atmega32u2",         FamilyAVR35, ELFArchAVR35>;
319def : Device<"attiny1634",         FamilyAVR35, ELFArchAVR35>;
320def : Device<"atmega8",            FamilyAVR4,  ELFArchAVR4>; // FIXME: family may be wrong
321def : Device<"ata6289",            FamilyAVR4,  ELFArchAVR4>;
322def : Device<"atmega8a",           FamilyAVR4,  ELFArchAVR4>;
323def : Device<"ata6285",            FamilyAVR4,  ELFArchAVR4>;
324def : Device<"ata6286",            FamilyAVR4,  ELFArchAVR4>;
325def : Device<"atmega48",           FamilyAVR4,  ELFArchAVR4>;
326def : Device<"atmega48a",          FamilyAVR4,  ELFArchAVR4>;
327def : Device<"atmega48pa",         FamilyAVR4,  ELFArchAVR4>;
328def : Device<"atmega48p",          FamilyAVR4,  ELFArchAVR4>;
329def : Device<"atmega88",           FamilyAVR4,  ELFArchAVR4>;
330def : Device<"atmega88a",          FamilyAVR4,  ELFArchAVR4>;
331def : Device<"atmega88p",          FamilyAVR4,  ELFArchAVR4>;
332def : Device<"atmega88pa",         FamilyAVR4,  ELFArchAVR4>;
333def : Device<"atmega8515",         FamilyAVR2,  ELFArchAVR4,
334             [FeatureMultiplication, FeatureMOVW, FeatureLPMX, FeatureSPM]>;
335def : Device<"atmega8535",         FamilyAVR2,  ELFArchAVR4,
336             [FeatureMultiplication, FeatureMOVW, FeatureLPMX, FeatureSPM]>;
337def : Device<"atmega8hva",         FamilyAVR4,  ELFArchAVR4>;
338def : Device<"at90pwm1",           FamilyAVR4,  ELFArchAVR4>;
339def : Device<"at90pwm2",           FamilyAVR4,  ELFArchAVR4>;
340def : Device<"at90pwm2b",          FamilyAVR4,  ELFArchAVR4>;
341def : Device<"at90pwm3",           FamilyAVR4,  ELFArchAVR4>;
342def : Device<"at90pwm3b",          FamilyAVR4,  ELFArchAVR4>;
343def : Device<"at90pwm81",          FamilyAVR4,  ELFArchAVR4>;
344def : Device<"ata5790",            FamilyAVR5,  ELFArchAVR5>;
345def : Device<"ata5795",            FamilyAVR5,  ELFArchAVR5>;
346def : Device<"atmega16",           FamilyAVR5,  ELFArchAVR5>;
347def : Device<"atmega16a",          FamilyAVR5,  ELFArchAVR5>;
348def : Device<"atmega161",          FamilyAVR3,  ELFArchAVR5,
349             [FeatureMultiplication, FeatureMOVW, FeatureLPMX, FeatureSPM]>;
350def : Device<"atmega162",          FamilyAVR5,  ELFArchAVR5>;
351def : Device<"atmega163",          FamilyAVR3,  ELFArchAVR5,
352             [FeatureMultiplication, FeatureMOVW, FeatureLPMX, FeatureSPM]>;
353def : Device<"atmega164a",         FamilyAVR5,  ELFArchAVR5>;
354def : Device<"atmega164p",         FamilyAVR5,  ELFArchAVR5>;
355def : Device<"atmega164pa",        FamilyAVR5,  ELFArchAVR5>;
356def : Device<"atmega165",          FamilyAVR5,  ELFArchAVR5>;
357def : Device<"atmega165a",         FamilyAVR5,  ELFArchAVR5>;
358def : Device<"atmega165p",         FamilyAVR5,  ELFArchAVR5>;
359def : Device<"atmega165pa",        FamilyAVR5,  ELFArchAVR5>;
360def : Device<"atmega168",          FamilyAVR5,  ELFArchAVR5>;
361def : Device<"atmega168a",         FamilyAVR5,  ELFArchAVR5>;
362def : Device<"atmega168p",         FamilyAVR5,  ELFArchAVR5>;
363def : Device<"atmega168pa",        FamilyAVR5,  ELFArchAVR5>;
364def : Device<"atmega169",          FamilyAVR5,  ELFArchAVR5>;
365def : Device<"atmega169a",         FamilyAVR5,  ELFArchAVR5>;
366def : Device<"atmega169p",         FamilyAVR5,  ELFArchAVR5>;
367def : Device<"atmega169pa",        FamilyAVR5,  ELFArchAVR5>;
368def : Device<"atmega32",           FamilyAVR5,  ELFArchAVR5>;
369def : Device<"atmega32a",          FamilyAVR5,  ELFArchAVR5>;
370def : Device<"atmega323",          FamilyAVR5,  ELFArchAVR5>;
371def : Device<"atmega324a",         FamilyAVR5,  ELFArchAVR5>;
372def : Device<"atmega324p",         FamilyAVR5,  ELFArchAVR5>;
373def : Device<"atmega324pa",        FamilyAVR5,  ELFArchAVR5>;
374def : Device<"atmega325",          FamilyAVR5,  ELFArchAVR5>;
375def : Device<"atmega325a",         FamilyAVR5,  ELFArchAVR5>;
376def : Device<"atmega325p",         FamilyAVR5,  ELFArchAVR5>;
377def : Device<"atmega325pa",        FamilyAVR5,  ELFArchAVR5>;
378def : Device<"atmega3250",         FamilyAVR5,  ELFArchAVR5>;
379def : Device<"atmega3250a",        FamilyAVR5,  ELFArchAVR5>;
380def : Device<"atmega3250p",        FamilyAVR5,  ELFArchAVR5>;
381def : Device<"atmega3250pa",       FamilyAVR5,  ELFArchAVR5>;
382def : Device<"atmega328",          FamilyAVR5,  ELFArchAVR5>;
383def : Device<"atmega328p",         FamilyAVR5,  ELFArchAVR5>;
384def : Device<"atmega329",          FamilyAVR5,  ELFArchAVR5>;
385def : Device<"atmega329a",         FamilyAVR5,  ELFArchAVR5>;
386def : Device<"atmega329p",         FamilyAVR5,  ELFArchAVR5>;
387def : Device<"atmega329pa",        FamilyAVR5,  ELFArchAVR5>;
388def : Device<"atmega3290",         FamilyAVR5,  ELFArchAVR5>;
389def : Device<"atmega3290a",        FamilyAVR5,  ELFArchAVR5>;
390def : Device<"atmega3290p",        FamilyAVR5,  ELFArchAVR5>;
391def : Device<"atmega3290pa",       FamilyAVR5,  ELFArchAVR5>;
392def : Device<"atmega406",          FamilyAVR5,  ELFArchAVR5>;
393def : Device<"atmega64",           FamilyAVR5,  ELFArchAVR5>;
394def : Device<"atmega64a",          FamilyAVR5,  ELFArchAVR5>;
395def : Device<"atmega640",          FamilyAVR5,  ELFArchAVR5>;
396def : Device<"atmega644",          FamilyAVR5,  ELFArchAVR5>;
397def : Device<"atmega644a",         FamilyAVR5,  ELFArchAVR5>;
398def : Device<"atmega644p",         FamilyAVR5,  ELFArchAVR5>;
399def : Device<"atmega644pa",        FamilyAVR5,  ELFArchAVR5>;
400def : Device<"atmega645",          FamilyAVR5,  ELFArchAVR5>;
401def : Device<"atmega645a",         FamilyAVR5,  ELFArchAVR5>;
402def : Device<"atmega645p",         FamilyAVR5,  ELFArchAVR5>;
403def : Device<"atmega649",          FamilyAVR5,  ELFArchAVR5>;
404def : Device<"atmega649a",         FamilyAVR5,  ELFArchAVR5>;
405def : Device<"atmega649p",         FamilyAVR5,  ELFArchAVR5>;
406def : Device<"atmega6450",         FamilyAVR5,  ELFArchAVR5>;
407def : Device<"atmega6450a",        FamilyAVR5,  ELFArchAVR5>;
408def : Device<"atmega6450p",        FamilyAVR5,  ELFArchAVR5>;
409def : Device<"atmega6490",         FamilyAVR5,  ELFArchAVR5>;
410def : Device<"atmega6490a",        FamilyAVR5,  ELFArchAVR5>;
411def : Device<"atmega6490p",        FamilyAVR5,  ELFArchAVR5>;
412def : Device<"atmega64rfr2",       FamilyAVR5,  ELFArchAVR5>;
413def : Device<"atmega644rfr2",      FamilyAVR5,  ELFArchAVR5>;
414def : Device<"atmega16hva",        FamilyAVR5,  ELFArchAVR5>;
415def : Device<"atmega16hva2",       FamilyAVR5,  ELFArchAVR5>;
416def : Device<"atmega16hvb",        FamilyAVR5,  ELFArchAVR5>;
417def : Device<"atmega16hvbrevb",    FamilyAVR5,  ELFArchAVR5>;
418def : Device<"atmega32hvb",        FamilyAVR5,  ELFArchAVR5>;
419def : Device<"atmega32hvbrevb",    FamilyAVR5,  ELFArchAVR5>;
420def : Device<"atmega64hve",        FamilyAVR5,  ELFArchAVR5>;
421def : Device<"at90can32",          FamilyAVR5,  ELFArchAVR5>;
422def : Device<"at90can64",          FamilyAVR5,  ELFArchAVR5>;
423def : Device<"at90pwm161",         FamilyAVR5,  ELFArchAVR5>;
424def : Device<"at90pwm216",         FamilyAVR5,  ELFArchAVR5>;
425def : Device<"at90pwm316",         FamilyAVR5,  ELFArchAVR5>;
426def : Device<"atmega32c1",         FamilyAVR5,  ELFArchAVR5>;
427def : Device<"atmega64c1",         FamilyAVR5,  ELFArchAVR5>;
428def : Device<"atmega16m1",         FamilyAVR5,  ELFArchAVR5>;
429def : Device<"atmega32m1",         FamilyAVR5,  ELFArchAVR5>;
430def : Device<"atmega64m1",         FamilyAVR5,  ELFArchAVR5>;
431def : Device<"atmega16u4",         FamilyAVR5,  ELFArchAVR5>;
432def : Device<"atmega32u4",         FamilyAVR5,  ELFArchAVR5>;
433def : Device<"atmega32u6",         FamilyAVR5,  ELFArchAVR5>;
434def : Device<"at90usb646",         FamilyAVR5,  ELFArchAVR5>;
435def : Device<"at90usb647",         FamilyAVR5,  ELFArchAVR5>;
436def : Device<"at90scr100",         FamilyAVR5,  ELFArchAVR5>;
437def : Device<"at94k",              FamilyAVR3,  ELFArchAVR5,
438             [FeatureMultiplication, FeatureMOVW, FeatureLPMX]>;
439def : Device<"m3000",              FamilyAVR5,  ELFArchAVR5>;
440def : Device<"atmega128",          FamilyAVR51, ELFArchAVR51>;
441def : Device<"atmega128a",         FamilyAVR51, ELFArchAVR51>;
442def : Device<"atmega1280",         FamilyAVR51, ELFArchAVR51>;
443def : Device<"atmega1281",         FamilyAVR51, ELFArchAVR51>;
444def : Device<"atmega1284",         FamilyAVR51, ELFArchAVR51>;
445def : Device<"atmega1284p",        FamilyAVR51, ELFArchAVR51>;
446def : Device<"atmega128rfa1",      FamilyAVR51, ELFArchAVR51>;
447def : Device<"atmega128rfr2",      FamilyAVR51, ELFArchAVR51>;
448def : Device<"atmega1284rfr2",     FamilyAVR51, ELFArchAVR51>;
449def : Device<"at90can128",         FamilyAVR51, ELFArchAVR51>;
450def : Device<"at90usb1286",        FamilyAVR51, ELFArchAVR51>;
451def : Device<"at90usb1287",        FamilyAVR51, ELFArchAVR51>;
452def : Device<"atmega2560",         FamilyAVR6,  ELFArchAVR6>;
453def : Device<"atmega2561",         FamilyAVR6,  ELFArchAVR6>;
454def : Device<"atmega256rfr2",      FamilyAVR6,  ELFArchAVR6>;
455def : Device<"atmega2564rfr2",     FamilyAVR6,  ELFArchAVR6>;
456def : Device<"atxmega16a4",        FamilyXMEGA, ELFArchXMEGA2>;
457def : Device<"atxmega16a4u",       FamilyXMEGAU, ELFArchXMEGA2>;
458def : Device<"atxmega16c4",        FamilyXMEGAU, ELFArchXMEGA2>;
459def : Device<"atxmega16d4",        FamilyXMEGA, ELFArchXMEGA2>;
460def : Device<"atxmega32a4",        FamilyXMEGA, ELFArchXMEGA2>;
461def : Device<"atxmega32a4u",       FamilyXMEGAU, ELFArchXMEGA2>;
462def : Device<"atxmega32c4",        FamilyXMEGAU, ELFArchXMEGA2>;
463def : Device<"atxmega32d4",        FamilyXMEGA, ELFArchXMEGA2>;
464def : Device<"atxmega32e5",        FamilyXMEGA, ELFArchXMEGA2>;
465def : Device<"atxmega16e5",        FamilyXMEGA, ELFArchXMEGA2>;
466def : Device<"atxmega8e5",         FamilyXMEGA, ELFArchXMEGA2>;
467def : Device<"atxmega32x1",        FamilyXMEGA, ELFArchXMEGA2>;
468def : Device<"atxmega64a3",        FamilyXMEGA, ELFArchXMEGA4>;
469def : Device<"atxmega64a3u",       FamilyXMEGAU, ELFArchXMEGA4>;
470def : Device<"atxmega64a4u",       FamilyXMEGAU, ELFArchXMEGA4>;
471def : Device<"atxmega64b1",        FamilyXMEGAU, ELFArchXMEGA4>;
472def : Device<"atxmega64b3",        FamilyXMEGAU, ELFArchXMEGA4>;
473def : Device<"atxmega64c3",        FamilyXMEGAU, ELFArchXMEGA4>;
474def : Device<"atxmega64d3",        FamilyXMEGA, ELFArchXMEGA4>;
475def : Device<"atxmega64d4",        FamilyXMEGA, ELFArchXMEGA4>;
476def : Device<"atxmega64a1",        FamilyXMEGA, ELFArchXMEGA5>;
477def : Device<"atxmega64a1u",       FamilyXMEGAU, ELFArchXMEGA5>;
478def : Device<"atxmega128a3",       FamilyXMEGA, ELFArchXMEGA6>;
479def : Device<"atxmega128a3u",      FamilyXMEGAU, ELFArchXMEGA6>;
480def : Device<"atxmega128b1",       FamilyXMEGAU, ELFArchXMEGA6>;
481def : Device<"atxmega128b3",       FamilyXMEGAU, ELFArchXMEGA6>;
482def : Device<"atxmega128c3",       FamilyXMEGAU, ELFArchXMEGA6>;
483def : Device<"atxmega128d3",       FamilyXMEGA, ELFArchXMEGA6>;
484def : Device<"atxmega128d4",       FamilyXMEGA, ELFArchXMEGA6>;
485def : Device<"atxmega192a3",       FamilyXMEGA, ELFArchXMEGA6>;
486def : Device<"atxmega192a3u",      FamilyXMEGAU, ELFArchXMEGA6>;
487def : Device<"atxmega192c3",       FamilyXMEGAU, ELFArchXMEGA6>;
488def : Device<"atxmega192d3",       FamilyXMEGA, ELFArchXMEGA6>;
489def : Device<"atxmega256a3",       FamilyXMEGA, ELFArchXMEGA6>;
490def : Device<"atxmega256a3u",      FamilyXMEGAU, ELFArchXMEGA6>;
491def : Device<"atxmega256a3b",      FamilyXMEGA, ELFArchXMEGA6>;
492def : Device<"atxmega256a3bu",     FamilyXMEGAU, ELFArchXMEGA6>;
493def : Device<"atxmega256c3",       FamilyXMEGAU, ELFArchXMEGA6>;
494def : Device<"atxmega256d3",       FamilyXMEGA, ELFArchXMEGA6>;
495def : Device<"atxmega384c3",       FamilyXMEGAU, ELFArchXMEGA6>;
496def : Device<"atxmega384d3",       FamilyXMEGA, ELFArchXMEGA6>;
497def : Device<"atxmega128a1",       FamilyXMEGA, ELFArchXMEGA7>;
498def : Device<"atxmega128a1u",      FamilyXMEGAU, ELFArchXMEGA7>;
499def : Device<"atxmega128a4u",      FamilyXMEGAU, ELFArchXMEGA7>;
500def : Device<"attiny4",            FamilyAVRTiny, ELFArchAVRTiny>;
501def : Device<"attiny5",            FamilyAVRTiny, ELFArchAVRTiny>;
502def : Device<"attiny9",            FamilyAVRTiny, ELFArchAVRTiny>;
503def : Device<"attiny10",           FamilyAVRTiny, ELFArchAVRTiny>;
504def : Device<"attiny20",           FamilyAVRTiny, ELFArchAVRTiny>;
505def : Device<"attiny40",           FamilyAVRTiny, ELFArchAVRTiny>;
506
507//===---------------------------------------------------------------------===//
508// Register File Description
509//===---------------------------------------------------------------------===//
510
511include "AVRRegisterInfo.td"
512
513//===---------------------------------------------------------------------===//
514// Instruction Descriptions
515//===---------------------------------------------------------------------===//
516
517include "AVRInstrInfo.td"
518
519def AVRInstrInfo : InstrInfo;
520
521//===---------------------------------------------------------------------===//
522// Calling Conventions
523//===---------------------------------------------------------------------===//
524
525include "AVRCallingConv.td"
526
527//===---------------------------------------------------------------------===//
528// Assembly Printers
529//===---------------------------------------------------------------------===//
530
531// def AVRAsmWriter : AsmWriter {
532//  string AsmWriterClassName = "InstPrinter";
533//  bit isMCAsmWriter = 1;
534// }
535
536//===---------------------------------------------------------------------===//
537// Assembly Parsers
538//===---------------------------------------------------------------------===//
539
540// def AVRAsmParser : AsmParser {
541//   let ShouldEmitMatchRegisterName = 1;
542//   let ShouldEmitMatchRegisterAltName = 1;
543// }
544
545// def AVRAsmParserVariant : AsmParserVariant {
546//   int Variant = 0;
547//
548//   // Recognize hard coded registers.
549//   string RegisterPrefix = "$";
550// }
551
552//===---------------------------------------------------------------------===//
553// Target Declaration
554//===---------------------------------------------------------------------===//
555
556def AVR : Target {
557   let InstructionSet         = AVRInstrInfo;
558//   let AssemblyWriters        = [AVRAsmWriter];
559//
560//   let AssemblyParsers        = [AVRAsmParser];
561//   let AssemblyParserVariants = [AVRAsmParserVariant];
562}
563
564