Home | History | Annotate | Download | only in AVR
      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 
     16 include "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.
     34 class 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.
     38 class 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`
     53 def 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.
     57 def 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`.
     63 def 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`.
     69 def 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`.
     74 def 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.
     79 def 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.
     84 def 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.
     89 def FeatureLPM            : SubtargetFeature<"lpm", "m_hasLPM", "true",
     90                                   "The device supports the `LPM` instruction">;
     91 
     92 // The device supports the `LPM Rd, Z[+] instruction.
     93 def FeatureLPMX           : SubtargetFeature<"lpmx", "m_hasLPMX", "true",
     94                                   "The device supports the `LPM Rd, Z[+]` "
     95                                   "instruction">;
     96 
     97 // The device supports the `ELPM` instruction.
     98 def FeatureELPM           : SubtargetFeature<"elpm", "m_hasELPM", "true",
     99                                   "The device supports the ELPM instruction">;
    100 
    101 // The device supports the `ELPM Rd, Z[+]` instructions.
    102 def FeatureELPMX          : SubtargetFeature<"elpmx", "m_hasELPMX", "true",
    103                                   "The device supports the `ELPM Rd, Z[+]` "
    104                                   "instructions">;
    105 
    106 // The device supports the `SPM` instruction.
    107 def FeatureSPM            : SubtargetFeature<"spm", "m_hasSPM", "true",
    108                                   "The device supports the `SPM` instruction">;
    109 
    110 // The device supports the `SPM Z+` instruction.
    111 def FeatureSPMX           : SubtargetFeature<"spmx", "m_hasSPMX", "true",
    112                                   "The device supports the `SPM Z+` "
    113                                   "instruction">;
    114 
    115 // The device supports the `DES k` instruction.
    116 def 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.
    122 def 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.
    127 def FeatureMultiplication : SubtargetFeature<"mul", "m_supportsMultiplication",
    128                                   "true", "The device supports the "
    129                                   "multiplication instructions">;
    130 
    131 // The device supports the `BREAK` instruction.
    132 def 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.
    137 def FeatureTinyEncoding   : SubtargetFeature<"tinyencoding",
    138                                   "m_hasTinyEncoding", "true",
    139                                   "The device has Tiny core specific "
    140                                   "instruction encodings">;
    141 
    142 class ELFArch<string name>  : SubtargetFeature<"", "ELFArch",
    143                                     !strconcat("ELF::",name), "">;
    144 
    145 // ELF e_flags architecture values
    146 def ELFArchAVR1    : ELFArch<"EF_AVR_ARCH_AVR1">;
    147 def ELFArchAVR2    : ELFArch<"EF_AVR_ARCH_AVR2">;
    148 def ELFArchAVR25   : ELFArch<"EF_AVR_ARCH_AVR25">;
    149 def ELFArchAVR3    : ELFArch<"EF_AVR_ARCH_AVR3">;
    150 def ELFArchAVR31   : ELFArch<"EF_AVR_ARCH_AVR31">;
    151 def ELFArchAVR35   : ELFArch<"EF_AVR_ARCH_AVR35">;
    152 def ELFArchAVR4    : ELFArch<"EF_AVR_ARCH_AVR4">;
    153 def ELFArchAVR5    : ELFArch<"EF_AVR_ARCH_AVR5">;
    154 def ELFArchAVR51   : ELFArch<"EF_AVR_ARCH_AVR51">;
    155 def ELFArchAVR6    : ELFArch<"EF_AVR_ARCH_AVR6">;
    156 def ELFArchAVRTiny : ELFArch<"EF_AVR_ARCH_AVRTINY">;
    157 def ELFArchXMEGA1  : ELFArch<"EF_AVR_ARCH_XMEGA1">;
    158 def ELFArchXMEGA2  : ELFArch<"EF_AVR_ARCH_XMEGA2">;
    159 def ELFArchXMEGA3  : ELFArch<"EF_AVR_ARCH_XMEGA3">;
    160 def ELFArchXMEGA4  : ELFArch<"EF_AVR_ARCH_XMEGA4">;
    161 def ELFArchXMEGA5  : ELFArch<"EF_AVR_ARCH_XMEGA5">;
    162 def ELFArchXMEGA6  : ELFArch<"EF_AVR_ARCH_XMEGA6">;
    163 def 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.
    171 def FamilyAVR0           : Family<"avr0", []>;
    172 
    173 def FamilyAVR1           : Family<"avr1", [FamilyAVR0, FeatureLPM]>;
    174 
    175 def FamilyAVR2           : Family<"avr2",
    176                                  [FamilyAVR1, FeatureIJMPCALL, FeatureADDSUBIW,
    177                                   FeatureSRAM]>;
    178 
    179 def FamilyAVR25          : Family<"avr25",
    180                                  [FamilyAVR2, FeatureMOVW, FeatureLPMX,
    181                                   FeatureSPM, FeatureBREAK]>;
    182 
    183 def FamilyAVR3           : Family<"avr3",
    184                                  [FamilyAVR2, FeatureJMPCALL]>;
    185 
    186 def FamilyAVR31          : Family<"avr31",
    187                                  [FamilyAVR3, FeatureELPM]>;
    188 
    189 def FamilyAVR35          : Family<"avr35",
    190                                  [FamilyAVR3, FeatureMOVW, FeatureLPMX,
    191                                   FeatureSPM, FeatureBREAK]>;
    192 
    193 def FamilyAVR4           : Family<"avr4",
    194                                  [FamilyAVR2, FeatureMultiplication,
    195                                   FeatureMOVW, FeatureLPMX, FeatureSPM,
    196                                   FeatureBREAK]>;
    197 
    198 def FamilyAVR5           : Family<"avr5",
    199                                  [FamilyAVR3, FeatureMultiplication,
    200                                   FeatureMOVW, FeatureLPMX, FeatureSPM,
    201                                   FeatureBREAK]>;
    202 
    203 def FamilyAVR51          : Family<"avr51",
    204                                  [FamilyAVR5, FeatureELPM, FeatureELPMX]>;
    205 
    206 def FamilyAVR6           : Family<"avr6",
    207                                  [FamilyAVR51]>;
    208 
    209 def FamilyAVRTiny        : Family<"avrtiny",
    210                                  [FamilyAVR0, FeatureBREAK, FeatureSRAM,
    211                                   FeatureTinyEncoding]>;
    212 
    213 def FamilyXMEGA          : Family<"xmega",
    214                                  [FamilyAVR51, FeatureEIJMPCALL, FeatureSPMX,
    215                                   FeatureDES]>;
    216 
    217 def FamilyXMEGAU         : Family<"xmegau",
    218                                   [FamilyXMEGA, FeatureRMW]>;
    219 
    220 def 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 
    235 class 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.
    243 def : Device<"avr1",      FamilyAVR1,    ELFArchAVR1>;
    244 def : Device<"avr2",      FamilyAVR2,    ELFArchAVR2>;
    245 def : Device<"avr25",     FamilyAVR25,   ELFArchAVR25>;
    246 def : Device<"avr3",      FamilyAVR3,    ELFArchAVR3>;
    247 def : Device<"avr31",     FamilyAVR31,   ELFArchAVR31>;
    248 def : Device<"avr35",     FamilyAVR35,   ELFArchAVR35>;
    249 def : Device<"avr4",      FamilyAVR4,    ELFArchAVR4>;
    250 def : Device<"avr5",      FamilyAVR5,    ELFArchAVR5>;
    251 def : Device<"avr51",     FamilyAVR51,   ELFArchAVR51>;
    252 def : Device<"avr6",      FamilyAVR6,    ELFArchAVR6>;
    253 def : Device<"avrxmega1", FamilyXMEGA,   ELFArchXMEGA1>;
    254 def : Device<"avrxmega2", FamilyXMEGA,   ELFArchXMEGA2>;
    255 def : Device<"avrxmega3", FamilyXMEGA,   ELFArchXMEGA3>;
    256 def : Device<"avrxmega4", FamilyXMEGA,   ELFArchXMEGA4>;
    257 def : Device<"avrxmega5", FamilyXMEGA,   ELFArchXMEGA5>;
    258 def : Device<"avrxmega6", FamilyXMEGA,   ELFArchXMEGA6>;
    259 def : Device<"avrxmega7", FamilyXMEGA,   ELFArchXMEGA7>;
    260 def : Device<"avrtiny",   FamilyAVRTiny, ELFArchAVRTiny>;
    261 
    262 // Specific MCUs
    263 def : Device<"at90s1200",          FamilyAVR0, ELFArchAVR1>;
    264 def : Device<"attiny11",           FamilyAVR1, ELFArchAVR1>;
    265 def : Device<"attiny12",           FamilyAVR1, ELFArchAVR1>;
    266 def : Device<"attiny15",           FamilyAVR1, ELFArchAVR1>;
    267 def : Device<"attiny28",           FamilyAVR1, ELFArchAVR1>;
    268 def : Device<"at90s2313",          FamilyAVR2, ELFArchAVR2>;
    269 def : Device<"at90s2323",          FamilyAVR2, ELFArchAVR2>;
    270 def : Device<"at90s2333",          FamilyAVR2, ELFArchAVR2>;
    271 def : Device<"at90s2343",          FamilyAVR2, ELFArchAVR2>;
    272 def : Device<"attiny22",           FamilyAVR2, ELFArchAVR2>;
    273 def : Device<"attiny26",           FamilyAVR2, ELFArchAVR2, [FeatureLPMX]>;
    274 def : Device<"at86rf401",          FamilyAVR2, ELFArchAVR25,
    275              [FeatureMOVW, FeatureLPMX]>;
    276 def : Device<"at90s4414",          FamilyAVR2, ELFArchAVR2>;
    277 def : Device<"at90s4433",          FamilyAVR2, ELFArchAVR2>;
    278 def : Device<"at90s4434",          FamilyAVR2, ELFArchAVR2>;
    279 def : Device<"at90s8515",          FamilyAVR2, ELFArchAVR2>;
    280 def : Device<"at90c8534",          FamilyAVR2, ELFArchAVR2>;
    281 def : Device<"at90s8535",          FamilyAVR2, ELFArchAVR2>;
    282 def : Device<"ata5272",            FamilyAVR25, ELFArchAVR25>;
    283 def : Device<"attiny13",           FamilyAVR25, ELFArchAVR25>;
    284 def : Device<"attiny13a",          FamilyAVR25, ELFArchAVR25>;
    285 def : Device<"attiny2313",         FamilyAVR25, ELFArchAVR25>;
    286 def : Device<"attiny2313a",        FamilyAVR25, ELFArchAVR25>;
    287 def : Device<"attiny24",           FamilyAVR25, ELFArchAVR25>;
    288 def : Device<"attiny24a",          FamilyAVR25, ELFArchAVR25>;
    289 def : Device<"attiny4313",         FamilyAVR25, ELFArchAVR25>;
    290 def : Device<"attiny44",           FamilyAVR25, ELFArchAVR25>;
    291 def : Device<"attiny44a",          FamilyAVR25, ELFArchAVR25>;
    292 def : Device<"attiny84",           FamilyAVR25, ELFArchAVR25>;
    293 def : Device<"attiny84a",          FamilyAVR25, ELFArchAVR25>;
    294 def : Device<"attiny25",           FamilyAVR25, ELFArchAVR25>;
    295 def : Device<"attiny45",           FamilyAVR25, ELFArchAVR25>;
    296 def : Device<"attiny85",           FamilyAVR25, ELFArchAVR25>;
    297 def : Device<"attiny261",          FamilyAVR25, ELFArchAVR25>;
    298 def : Device<"attiny261a",         FamilyAVR25, ELFArchAVR25>;
    299 def : Device<"attiny461",          FamilyAVR25, ELFArchAVR25>;
    300 def : Device<"attiny461a",         FamilyAVR25, ELFArchAVR25>;
    301 def : Device<"attiny861",          FamilyAVR25, ELFArchAVR25>;
    302 def : Device<"attiny861a",         FamilyAVR25, ELFArchAVR25>;
    303 def : Device<"attiny87",           FamilyAVR25, ELFArchAVR25>;
    304 def : Device<"attiny43u",          FamilyAVR25, ELFArchAVR25>;
    305 def : Device<"attiny48",           FamilyAVR25, ELFArchAVR25>;
    306 def : Device<"attiny88",           FamilyAVR25, ELFArchAVR25>;
    307 def : Device<"attiny828",          FamilyAVR25, ELFArchAVR25>;
    308 def : Device<"at43usb355",         FamilyAVR3,  ELFArchAVR3>;
    309 def : Device<"at76c711",           FamilyAVR3,  ELFArchAVR3>;
    310 def : Device<"atmega103",          FamilyAVR31, ELFArchAVR31>;
    311 def : Device<"at43usb320",         FamilyAVR31, ELFArchAVR31>;
    312 def : Device<"attiny167",          FamilyAVR35, ELFArchAVR35>;
    313 def : Device<"at90usb82",          FamilyAVR35, ELFArchAVR35>;
    314 def : Device<"at90usb162",         FamilyAVR35, ELFArchAVR35>;
    315 def : Device<"ata5505",            FamilyAVR35, ELFArchAVR35>;
    316 def : Device<"atmega8u2",          FamilyAVR35, ELFArchAVR35>;
    317 def : Device<"atmega16u2",         FamilyAVR35, ELFArchAVR35>;
    318 def : Device<"atmega32u2",         FamilyAVR35, ELFArchAVR35>;
    319 def : Device<"attiny1634",         FamilyAVR35, ELFArchAVR35>;
    320 def : Device<"atmega8",            FamilyAVR4,  ELFArchAVR4>; // FIXME: family may be wrong
    321 def : Device<"ata6289",            FamilyAVR4,  ELFArchAVR4>;
    322 def : Device<"atmega8a",           FamilyAVR4,  ELFArchAVR4>;
    323 def : Device<"ata6285",            FamilyAVR4,  ELFArchAVR4>;
    324 def : Device<"ata6286",            FamilyAVR4,  ELFArchAVR4>;
    325 def : Device<"atmega48",           FamilyAVR4,  ELFArchAVR4>;
    326 def : Device<"atmega48a",          FamilyAVR4,  ELFArchAVR4>;
    327 def : Device<"atmega48pa",         FamilyAVR4,  ELFArchAVR4>;
    328 def : Device<"atmega48p",          FamilyAVR4,  ELFArchAVR4>;
    329 def : Device<"atmega88",           FamilyAVR4,  ELFArchAVR4>;
    330 def : Device<"atmega88a",          FamilyAVR4,  ELFArchAVR4>;
    331 def : Device<"atmega88p",          FamilyAVR4,  ELFArchAVR4>;
    332 def : Device<"atmega88pa",         FamilyAVR4,  ELFArchAVR4>;
    333 def : Device<"atmega8515",         FamilyAVR2,  ELFArchAVR4,
    334              [FeatureMultiplication, FeatureMOVW, FeatureLPMX, FeatureSPM]>;
    335 def : Device<"atmega8535",         FamilyAVR2,  ELFArchAVR4,
    336              [FeatureMultiplication, FeatureMOVW, FeatureLPMX, FeatureSPM]>;
    337 def : Device<"atmega8hva",         FamilyAVR4,  ELFArchAVR4>;
    338 def : Device<"at90pwm1",           FamilyAVR4,  ELFArchAVR4>;
    339 def : Device<"at90pwm2",           FamilyAVR4,  ELFArchAVR4>;
    340 def : Device<"at90pwm2b",          FamilyAVR4,  ELFArchAVR4>;
    341 def : Device<"at90pwm3",           FamilyAVR4,  ELFArchAVR4>;
    342 def : Device<"at90pwm3b",          FamilyAVR4,  ELFArchAVR4>;
    343 def : Device<"at90pwm81",          FamilyAVR4,  ELFArchAVR4>;
    344 def : Device<"ata5790",            FamilyAVR5,  ELFArchAVR5>;
    345 def : Device<"ata5795",            FamilyAVR5,  ELFArchAVR5>;
    346 def : Device<"atmega16",           FamilyAVR5,  ELFArchAVR5>;
    347 def : Device<"atmega16a",          FamilyAVR5,  ELFArchAVR5>;
    348 def : Device<"atmega161",          FamilyAVR3,  ELFArchAVR5,
    349              [FeatureMultiplication, FeatureMOVW, FeatureLPMX, FeatureSPM]>;
    350 def : Device<"atmega162",          FamilyAVR5,  ELFArchAVR5>;
    351 def : Device<"atmega163",          FamilyAVR3,  ELFArchAVR5,
    352              [FeatureMultiplication, FeatureMOVW, FeatureLPMX, FeatureSPM]>;
    353 def : Device<"atmega164a",         FamilyAVR5,  ELFArchAVR5>;
    354 def : Device<"atmega164p",         FamilyAVR5,  ELFArchAVR5>;
    355 def : Device<"atmega164pa",        FamilyAVR5,  ELFArchAVR5>;
    356 def : Device<"atmega165",          FamilyAVR5,  ELFArchAVR5>;
    357 def : Device<"atmega165a",         FamilyAVR5,  ELFArchAVR5>;
    358 def : Device<"atmega165p",         FamilyAVR5,  ELFArchAVR5>;
    359 def : Device<"atmega165pa",        FamilyAVR5,  ELFArchAVR5>;
    360 def : Device<"atmega168",          FamilyAVR5,  ELFArchAVR5>;
    361 def : Device<"atmega168a",         FamilyAVR5,  ELFArchAVR5>;
    362 def : Device<"atmega168p",         FamilyAVR5,  ELFArchAVR5>;
    363 def : Device<"atmega168pa",        FamilyAVR5,  ELFArchAVR5>;
    364 def : Device<"atmega169",          FamilyAVR5,  ELFArchAVR5>;
    365 def : Device<"atmega169a",         FamilyAVR5,  ELFArchAVR5>;
    366 def : Device<"atmega169p",         FamilyAVR5,  ELFArchAVR5>;
    367 def : Device<"atmega169pa",        FamilyAVR5,  ELFArchAVR5>;
    368 def : Device<"atmega32",           FamilyAVR5,  ELFArchAVR5>;
    369 def : Device<"atmega32a",          FamilyAVR5,  ELFArchAVR5>;
    370 def : Device<"atmega323",          FamilyAVR5,  ELFArchAVR5>;
    371 def : Device<"atmega324a",         FamilyAVR5,  ELFArchAVR5>;
    372 def : Device<"atmega324p",         FamilyAVR5,  ELFArchAVR5>;
    373 def : Device<"atmega324pa",        FamilyAVR5,  ELFArchAVR5>;
    374 def : Device<"atmega325",          FamilyAVR5,  ELFArchAVR5>;
    375 def : Device<"atmega325a",         FamilyAVR5,  ELFArchAVR5>;
    376 def : Device<"atmega325p",         FamilyAVR5,  ELFArchAVR5>;
    377 def : Device<"atmega325pa",        FamilyAVR5,  ELFArchAVR5>;
    378 def : Device<"atmega3250",         FamilyAVR5,  ELFArchAVR5>;
    379 def : Device<"atmega3250a",        FamilyAVR5,  ELFArchAVR5>;
    380 def : Device<"atmega3250p",        FamilyAVR5,  ELFArchAVR5>;
    381 def : Device<"atmega3250pa",       FamilyAVR5,  ELFArchAVR5>;
    382 def : Device<"atmega328",          FamilyAVR5,  ELFArchAVR5>;
    383 def : Device<"atmega328p",         FamilyAVR5,  ELFArchAVR5>;
    384 def : Device<"atmega329",          FamilyAVR5,  ELFArchAVR5>;
    385 def : Device<"atmega329a",         FamilyAVR5,  ELFArchAVR5>;
    386 def : Device<"atmega329p",         FamilyAVR5,  ELFArchAVR5>;
    387 def : Device<"atmega329pa",        FamilyAVR5,  ELFArchAVR5>;
    388 def : Device<"atmega3290",         FamilyAVR5,  ELFArchAVR5>;
    389 def : Device<"atmega3290a",        FamilyAVR5,  ELFArchAVR5>;
    390 def : Device<"atmega3290p",        FamilyAVR5,  ELFArchAVR5>;
    391 def : Device<"atmega3290pa",       FamilyAVR5,  ELFArchAVR5>;
    392 def : Device<"atmega406",          FamilyAVR5,  ELFArchAVR5>;
    393 def : Device<"atmega64",           FamilyAVR5,  ELFArchAVR5>;
    394 def : Device<"atmega64a",          FamilyAVR5,  ELFArchAVR5>;
    395 def : Device<"atmega640",          FamilyAVR5,  ELFArchAVR5>;
    396 def : Device<"atmega644",          FamilyAVR5,  ELFArchAVR5>;
    397 def : Device<"atmega644a",         FamilyAVR5,  ELFArchAVR5>;
    398 def : Device<"atmega644p",         FamilyAVR5,  ELFArchAVR5>;
    399 def : Device<"atmega644pa",        FamilyAVR5,  ELFArchAVR5>;
    400 def : Device<"atmega645",          FamilyAVR5,  ELFArchAVR5>;
    401 def : Device<"atmega645a",         FamilyAVR5,  ELFArchAVR5>;
    402 def : Device<"atmega645p",         FamilyAVR5,  ELFArchAVR5>;
    403 def : Device<"atmega649",          FamilyAVR5,  ELFArchAVR5>;
    404 def : Device<"atmega649a",         FamilyAVR5,  ELFArchAVR5>;
    405 def : Device<"atmega649p",         FamilyAVR5,  ELFArchAVR5>;
    406 def : Device<"atmega6450",         FamilyAVR5,  ELFArchAVR5>;
    407 def : Device<"atmega6450a",        FamilyAVR5,  ELFArchAVR5>;
    408 def : Device<"atmega6450p",        FamilyAVR5,  ELFArchAVR5>;
    409 def : Device<"atmega6490",         FamilyAVR5,  ELFArchAVR5>;
    410 def : Device<"atmega6490a",        FamilyAVR5,  ELFArchAVR5>;
    411 def : Device<"atmega6490p",        FamilyAVR5,  ELFArchAVR5>;
    412 def : Device<"atmega64rfr2",       FamilyAVR5,  ELFArchAVR5>;
    413 def : Device<"atmega644rfr2",      FamilyAVR5,  ELFArchAVR5>;
    414 def : Device<"atmega16hva",        FamilyAVR5,  ELFArchAVR5>;
    415 def : Device<"atmega16hva2",       FamilyAVR5,  ELFArchAVR5>;
    416 def : Device<"atmega16hvb",        FamilyAVR5,  ELFArchAVR5>;
    417 def : Device<"atmega16hvbrevb",    FamilyAVR5,  ELFArchAVR5>;
    418 def : Device<"atmega32hvb",        FamilyAVR5,  ELFArchAVR5>;
    419 def : Device<"atmega32hvbrevb",    FamilyAVR5,  ELFArchAVR5>;
    420 def : Device<"atmega64hve",        FamilyAVR5,  ELFArchAVR5>;
    421 def : Device<"at90can32",          FamilyAVR5,  ELFArchAVR5>;
    422 def : Device<"at90can64",          FamilyAVR5,  ELFArchAVR5>;
    423 def : Device<"at90pwm161",         FamilyAVR5,  ELFArchAVR5>;
    424 def : Device<"at90pwm216",         FamilyAVR5,  ELFArchAVR5>;
    425 def : Device<"at90pwm316",         FamilyAVR5,  ELFArchAVR5>;
    426 def : Device<"atmega32c1",         FamilyAVR5,  ELFArchAVR5>;
    427 def : Device<"atmega64c1",         FamilyAVR5,  ELFArchAVR5>;
    428 def : Device<"atmega16m1",         FamilyAVR5,  ELFArchAVR5>;
    429 def : Device<"atmega32m1",         FamilyAVR5,  ELFArchAVR5>;
    430 def : Device<"atmega64m1",         FamilyAVR5,  ELFArchAVR5>;
    431 def : Device<"atmega16u4",         FamilyAVR5,  ELFArchAVR5>;
    432 def : Device<"atmega32u4",         FamilyAVR5,  ELFArchAVR5>;
    433 def : Device<"atmega32u6",         FamilyAVR5,  ELFArchAVR5>;
    434 def : Device<"at90usb646",         FamilyAVR5,  ELFArchAVR5>;
    435 def : Device<"at90usb647",         FamilyAVR5,  ELFArchAVR5>;
    436 def : Device<"at90scr100",         FamilyAVR5,  ELFArchAVR5>;
    437 def : Device<"at94k",              FamilyAVR3,  ELFArchAVR5,
    438              [FeatureMultiplication, FeatureMOVW, FeatureLPMX]>;
    439 def : Device<"m3000",              FamilyAVR5,  ELFArchAVR5>;
    440 def : Device<"atmega128",          FamilyAVR51, ELFArchAVR51>;
    441 def : Device<"atmega128a",         FamilyAVR51, ELFArchAVR51>;
    442 def : Device<"atmega1280",         FamilyAVR51, ELFArchAVR51>;
    443 def : Device<"atmega1281",         FamilyAVR51, ELFArchAVR51>;
    444 def : Device<"atmega1284",         FamilyAVR51, ELFArchAVR51>;
    445 def : Device<"atmega1284p",        FamilyAVR51, ELFArchAVR51>;
    446 def : Device<"atmega128rfa1",      FamilyAVR51, ELFArchAVR51>;
    447 def : Device<"atmega128rfr2",      FamilyAVR51, ELFArchAVR51>;
    448 def : Device<"atmega1284rfr2",     FamilyAVR51, ELFArchAVR51>;
    449 def : Device<"at90can128",         FamilyAVR51, ELFArchAVR51>;
    450 def : Device<"at90usb1286",        FamilyAVR51, ELFArchAVR51>;
    451 def : Device<"at90usb1287",        FamilyAVR51, ELFArchAVR51>;
    452 def : Device<"atmega2560",         FamilyAVR6,  ELFArchAVR6>;
    453 def : Device<"atmega2561",         FamilyAVR6,  ELFArchAVR6>;
    454 def : Device<"atmega256rfr2",      FamilyAVR6,  ELFArchAVR6>;
    455 def : Device<"atmega2564rfr2",     FamilyAVR6,  ELFArchAVR6>;
    456 def : Device<"atxmega16a4",        FamilyXMEGA, ELFArchXMEGA2>;
    457 def : Device<"atxmega16a4u",       FamilyXMEGAU, ELFArchXMEGA2>;
    458 def : Device<"atxmega16c4",        FamilyXMEGAU, ELFArchXMEGA2>;
    459 def : Device<"atxmega16d4",        FamilyXMEGA, ELFArchXMEGA2>;
    460 def : Device<"atxmega32a4",        FamilyXMEGA, ELFArchXMEGA2>;
    461 def : Device<"atxmega32a4u",       FamilyXMEGAU, ELFArchXMEGA2>;
    462 def : Device<"atxmega32c4",        FamilyXMEGAU, ELFArchXMEGA2>;
    463 def : Device<"atxmega32d4",        FamilyXMEGA, ELFArchXMEGA2>;
    464 def : Device<"atxmega32e5",        FamilyXMEGA, ELFArchXMEGA2>;
    465 def : Device<"atxmega16e5",        FamilyXMEGA, ELFArchXMEGA2>;
    466 def : Device<"atxmega8e5",         FamilyXMEGA, ELFArchXMEGA2>;
    467 def : Device<"atxmega32x1",        FamilyXMEGA, ELFArchXMEGA2>;
    468 def : Device<"atxmega64a3",        FamilyXMEGA, ELFArchXMEGA4>;
    469 def : Device<"atxmega64a3u",       FamilyXMEGAU, ELFArchXMEGA4>;
    470 def : Device<"atxmega64a4u",       FamilyXMEGAU, ELFArchXMEGA4>;
    471 def : Device<"atxmega64b1",        FamilyXMEGAU, ELFArchXMEGA4>;
    472 def : Device<"atxmega64b3",        FamilyXMEGAU, ELFArchXMEGA4>;
    473 def : Device<"atxmega64c3",        FamilyXMEGAU, ELFArchXMEGA4>;
    474 def : Device<"atxmega64d3",        FamilyXMEGA, ELFArchXMEGA4>;
    475 def : Device<"atxmega64d4",        FamilyXMEGA, ELFArchXMEGA4>;
    476 def : Device<"atxmega64a1",        FamilyXMEGA, ELFArchXMEGA5>;
    477 def : Device<"atxmega64a1u",       FamilyXMEGAU, ELFArchXMEGA5>;
    478 def : Device<"atxmega128a3",       FamilyXMEGA, ELFArchXMEGA6>;
    479 def : Device<"atxmega128a3u",      FamilyXMEGAU, ELFArchXMEGA6>;
    480 def : Device<"atxmega128b1",       FamilyXMEGAU, ELFArchXMEGA6>;
    481 def : Device<"atxmega128b3",       FamilyXMEGAU, ELFArchXMEGA6>;
    482 def : Device<"atxmega128c3",       FamilyXMEGAU, ELFArchXMEGA6>;
    483 def : Device<"atxmega128d3",       FamilyXMEGA, ELFArchXMEGA6>;
    484 def : Device<"atxmega128d4",       FamilyXMEGA, ELFArchXMEGA6>;
    485 def : Device<"atxmega192a3",       FamilyXMEGA, ELFArchXMEGA6>;
    486 def : Device<"atxmega192a3u",      FamilyXMEGAU, ELFArchXMEGA6>;
    487 def : Device<"atxmega192c3",       FamilyXMEGAU, ELFArchXMEGA6>;
    488 def : Device<"atxmega192d3",       FamilyXMEGA, ELFArchXMEGA6>;
    489 def : Device<"atxmega256a3",       FamilyXMEGA, ELFArchXMEGA6>;
    490 def : Device<"atxmega256a3u",      FamilyXMEGAU, ELFArchXMEGA6>;
    491 def : Device<"atxmega256a3b",      FamilyXMEGA, ELFArchXMEGA6>;
    492 def : Device<"atxmega256a3bu",     FamilyXMEGAU, ELFArchXMEGA6>;
    493 def : Device<"atxmega256c3",       FamilyXMEGAU, ELFArchXMEGA6>;
    494 def : Device<"atxmega256d3",       FamilyXMEGA, ELFArchXMEGA6>;
    495 def : Device<"atxmega384c3",       FamilyXMEGAU, ELFArchXMEGA6>;
    496 def : Device<"atxmega384d3",       FamilyXMEGA, ELFArchXMEGA6>;
    497 def : Device<"atxmega128a1",       FamilyXMEGA, ELFArchXMEGA7>;
    498 def : Device<"atxmega128a1u",      FamilyXMEGAU, ELFArchXMEGA7>;
    499 def : Device<"atxmega128a4u",      FamilyXMEGAU, ELFArchXMEGA7>;
    500 def : Device<"attiny4",            FamilyAVRTiny, ELFArchAVRTiny>;
    501 def : Device<"attiny5",            FamilyAVRTiny, ELFArchAVRTiny>;
    502 def : Device<"attiny9",            FamilyAVRTiny, ELFArchAVRTiny>;
    503 def : Device<"attiny10",           FamilyAVRTiny, ELFArchAVRTiny>;
    504 def : Device<"attiny20",           FamilyAVRTiny, ELFArchAVRTiny>;
    505 def : Device<"attiny40",           FamilyAVRTiny, ELFArchAVRTiny>;
    506 
    507 //===---------------------------------------------------------------------===//
    508 // Register File Description
    509 //===---------------------------------------------------------------------===//
    510 
    511 include "AVRRegisterInfo.td"
    512 
    513 //===---------------------------------------------------------------------===//
    514 // Instruction Descriptions
    515 //===---------------------------------------------------------------------===//
    516 
    517 include "AVRInstrInfo.td"
    518 
    519 def AVRInstrInfo : InstrInfo;
    520 
    521 //===---------------------------------------------------------------------===//
    522 // Calling Conventions
    523 //===---------------------------------------------------------------------===//
    524 
    525 include "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 
    556 def AVR : Target {
    557    let InstructionSet         = AVRInstrInfo;
    558 //   let AssemblyWriters        = [AVRAsmWriter];
    559 //
    560 //   let AssemblyParsers        = [AVRAsmParser];
    561 //   let AssemblyParserVariants = [AVRAsmParserVariant];
    562 }
    563 
    564