Skip to content

Commit f0f8782

Browse files
Carl PetoCarl Peto
authored andcommitted
Simple AVR support
1 parent cdfeefc commit f0f8782

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

cmake/modules/SwiftSetIfArchBitness.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ function(set_if_arch_bitness var_name)
66
"" # multi-value args
77
${ARGN})
88

9-
if("${SIA_ARCH}" STREQUAL "i386" OR
9+
if("${SIA_ARCH}" STREQUAL "avr")
10+
set("${var_name}" "${SIA_CASE_16_BIT}" PARENT_SCOPE)
11+
elseif("${SIA_ARCH}" STREQUAL "i386" OR
1012
"${SIA_ARCH}" STREQUAL "i686" OR
1113
"${SIA_ARCH}" STREQUAL "x86" OR
1214
"${SIA_ARCH}" STREQUAL "armv4t" OR

lib/Basic/LangOptions.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ static const SupportedConditionalValue SupportedConditionalCompilationArches[] =
101101
"s390x",
102102
"wasm32",
103103
"riscv64",
104+
"avr"
104105
};
105106

106107
static const SupportedConditionalValue SupportedConditionalCompilationEndianness[] = {
@@ -391,6 +392,10 @@ void LangOptions::setHasAtomicBitWidth(llvm::Triple triple) {
391392
setMaxAtomicBitWidth(128);
392393
break;
393394

395+
case llvm::Triple::ArchType::avr:
396+
setMaxAtomicBitWidth(0);
397+
break;
398+
394399
default:
395400
// Some exotic architectures may not support atomics at all. If that's the
396401
// case please update the switch with your flavor of arch. Otherwise assume
@@ -541,6 +546,9 @@ std::pair<bool, bool> LangOptions::setTarget(llvm::Triple triple) {
541546
case llvm::Triple::ArchType::riscv64:
542547
addPlatformConditionValue(PlatformConditionKind::Arch, "riscv64");
543548
break;
549+
case llvm::Triple::ArchType::avr:
550+
addPlatformConditionValue(PlatformConditionKind::Arch, "avr");
551+
break;
544552
default:
545553
UnsupportedArch = true;
546554

@@ -564,11 +572,11 @@ std::pair<bool, bool> LangOptions::setTarget(llvm::Triple triple) {
564572
}
565573

566574
// Set the "_pointerBitWidth" platform condition.
567-
if (Target.isArch32Bit()) {
568-
addPlatformConditionValue(PlatformConditionKind::PointerBitWidth, "_32");
569-
} else if (Target.isArch64Bit()) {
570-
addPlatformConditionValue(PlatformConditionKind::PointerBitWidth, "_64");
571-
}
575+
if (Target.isArch32Bit()) {
576+
addPlatformConditionValue(PlatformConditionKind::PointerBitWidth, "_32");
577+
} else if (Target.isArch64Bit()) {
578+
addPlatformConditionValue(PlatformConditionKind::PointerBitWidth, "_64");
579+
}
572580

573581
// Set the "runtime" platform condition.
574582
addPlatformConditionValue(PlatformConditionKind::Runtime,

utils/build-presets.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ build-subdir=buildbot_incremental
611611
release
612612
assertions
613613

614-
llvm-targets-to-build=X86;ARM;AArch64;PowerPC;RISCV
614+
llvm-targets-to-build=X86;ARM;AArch64;PowerPC;RISCV;AVR
615615

616616
libcxx
617617
llbuild

0 commit comments

Comments
 (0)