dylanmckay added a comment. @aykevl
> A thought: should the AVR family be included in the target triple? Like > avr5-unknown-unknown (similar to armv6m-none-eabi, armv7m-none-eabi, etc). > The different variations do sometimes change the architecture in > incompatible ways, such as with the call instruction which pushes a return > address of two or three bytes depending on the architecture variant (and thus > makes it impossible to pass parameters on the stack reliably). I've thought about this a few years ago, I suspect it is not possible. It seems like we really do need to compile a sysroot/stdlib/runtime libraries for each and every distinct MCU. https://github.com/rust-lang/rust/issues/44036#issuecomment-324330757 >> Does each device have a subtly different ISA? > > **tl;dr** Sometimes, yes > > In general, all devices can be _more or less_ grouped into families. > > For example, `avr1`, `avr2`, `avr25`, ... `avr5`, `avr51`, are all family > names. These families each define an subset of the full AVR ISA. > > You can find the AVR backend's definition of these families in AVRDevices.td > <https://github.com/llvm-mirror/llvm/blob/master/lib/Target/AVR/AVRDevices.td#L153>. > You can see that in general, the families build up on top of each other in > terms of supported instructions/features. > > The problem is that not every realised ISA can be cleanly separated into a > family. > > For example, the ATtiny26 > <https://github.com/llvm-mirror/llvm/blob/master/lib/Target/AVR/AVRDevices.td#L255> > is a part of the `avr2` family, but it also happens to support the "LPMX" > set of instructions > > Another example is the ATMega8515 > <https://github.com/llvm-mirror/llvm/blob/master/lib/Target/AVR/AVRDevices.td#L315>, > which _almost_ implements all of `avr4`, but not quite all, and so the > linked definition bases the device off `avr2` and adds the extra features > explicitly. > >> Does the backend need to know about peripherals? > > No > >> Or why do you want the LLVM backend to know when it's targeting, for >> example, "atmega328"? > > Solely for deciding what subset of the ISA is supported.All device-specific > information required (or used) by the backend can be found inside > AVRDevices.td > <https://github.com/llvm-mirror/llvm/blob/master/lib/Target/AVR/AVRDevices.td>. There is a bunch of other related discussion on https://github.com/rust-lang/rust/issues/44036 too. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77221/new/ https://reviews.llvm.org/D77221 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits