[llvm-dev] AVR target, add llvm/Support/AVRTargetParser

Mara Sophie Grosch via llvm-dev llvm-dev at lists.llvm.org
Sat Sep 25 08:24:19 PDT 2021


Hi,

I'm currently working on adding some more builtin definitions to Clangs
AVR target (__AVR_DEVICE_NAME__, __AVR_ARCH__, __AVR_MEGA__,
__AVR_XMEGA__) to improve compatibility with avr-libc.

Currently the AVR specific code in clang has a big table, mapping each
MCU to it's definition name (atxmega128a4u -> __AVR_ATxmega128A4U__) and
for every MCU I'd need more info.

Instead of adding more info to this table, I made a new class in
llvm::Support, called AVRTargetParser. I've added a AVRTargetParser.def
to llvm/include/llvm/Support, containing all the device infos to be used
with macros (like ARMTargetParser.def).

While thinking how to reduce duplication, I'm now not sure if a def file
is the best way to do it. A lot of this info also already is in
llvm/lib/Targets/AVR/AVRDevices.td. I want to reduce the info there for
more specific stuff and use the AVRTargetParser for things it already
knows - but maybe instead of a def file a td file would be better?

Thanks for any comments :)

Mara
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210925/9691f90c/attachment.sig>


More information about the llvm-dev mailing list