in lib/Basic/Targets.cpp inside class AVRTargetInfo, we currently handle a few different MCUs and set the processor defines appropriately.
if (CPU == "atmega328") {
Builder.defineMacro("__AVR_ATmega328__");
} else if (CPU == "atmega328p") {
Builder.defineMacro("__AVR_ATmega328P__");
} else if (CPU == "atmega168") {
Builder.defineMacro("__AVR_ATmega168__");
} else if (CPU == "atmega168p") {
...
This should be rewritten as a StringSwitch, and the entire set of supported CPUs should be added, Ideally, a warning would also be emitted along the lines of "unknown MCU" if we don't recognise this.
A goal might be to allow MCUs to be specified inside a TableGen file - perhaps AVRMCUs.def, and have all information in one centralized place.
in
lib/Basic/Targets.cpp
inside classAVRTargetInfo
, we currently handle a few different MCUs and set the processor defines appropriately.This should be rewritten as a
StringSwitch
, and the entire set of supported CPUs should be added, Ideally, a warning would also be emitted along the lines of "unknown MCU" if we don't recognise this.A goal might be to allow MCUs to be specified inside a TableGen file - perhaps
AVRMCUs.def
, and have all information in one centralized place.