diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp --- a/llvm/lib/Support/Host.cpp +++ b/llvm/lib/Support/Host.cpp @@ -35,7 +35,7 @@ #ifdef _MSC_VER #include #endif -#if defined(__APPLE__) && (defined(__ppc__) || defined(__powerpc__)) +#if defined(__APPLE__) && (!defined(__x86_64__)) #include #include #include @@ -1220,6 +1220,33 @@ StringRef Content = P ? P->getBuffer() : ""; return detail::getHostCPUNameForS390x(Content); } +#elif defined(__APPLE__) && defined(__aarch64__) +StringRef sys::getHostCPUName() { + return "cyclone"; +} +#elif defined(__APPLE__) && defined(__arm__) +StringRef sys::getHostCPUName() { + host_basic_info_data_t hostInfo; + mach_msg_type_number_t infoCount; + + infoCount = HOST_BASIC_INFO_COUNT; + mach_port_t hostPort = mach_host_self(); + host_info(hostPort, HOST_BASIC_INFO, (host_info_t)&hostInfo, + &infoCount); + mach_port_deallocate(mach_task_self(), hostPort); + + if (hostInfo.cpu_type != CPU_TYPE_ARM) { + assert(false && "CPUType not equal to ARM should not be possible on ARM"); + return "generic"; + } + switch (hostInfo.cpu_subtype) { + case CPU_SUBTYPE_ARM_V7S: + return "swift"; + default:; + } + + return "generic"; +} #else StringRef sys::getHostCPUName() { return "generic"; } #endif