[llvm] 6c927f2 - Canonicalize PowerPC detection macros to __powerpc__

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 6 17:29:49 PST 2022


Author: Fangrui Song
Date: 2022-11-06T17:29:45-08:00
New Revision: 6c927f2a8659a8ca35d223b7ccc0c0a03e8a376a

URL: https://github.com/llvm/llvm-project/commit/6c927f2a8659a8ca35d223b7ccc0c0a03e8a376a
DIFF: https://github.com/llvm/llvm-project/commit/6c927f2a8659a8ca35d223b7ccc0c0a03e8a376a.diff

LOG: Canonicalize PowerPC detection macros to __powerpc__

Added: 
    

Modified: 
    llvm/include/llvm/Support/Threading.h
    llvm/lib/Support/Host.cpp
    llvm/lib/Support/Unix/Memory.inc
    llvm/unittests/ADT/PackedVectorTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/Threading.h b/llvm/include/llvm/Support/Threading.h
index 44e133de854b8..7f2708ddbb467 100644
--- a/llvm/include/llvm/Support/Threading.h
+++ b/llvm/include/llvm/Support/Threading.h
@@ -26,14 +26,13 @@
 #define LLVM_THREADING_USE_STD_CALL_ONCE 1
 #elif defined(LLVM_ON_UNIX) &&                                                 \
     (defined(_LIBCPP_VERSION) ||                                               \
-     !(defined(__NetBSD__) || defined(__OpenBSD__) ||                          \
-       (defined(__ppc__) || defined(__PPC__))))
+     !(defined(__NetBSD__) || defined(__OpenBSD__) || defined(__powerpc__)))
 // std::call_once from libc++ is used on all Unix platforms. Other
 // implementations like libstdc++ are known to have problems on NetBSD,
 // OpenBSD and PowerPC.
 #define LLVM_THREADING_USE_STD_CALL_ONCE 1
 #elif defined(LLVM_ON_UNIX) &&                                                 \
-    ((defined(__ppc__) || defined(__PPC__)) && defined(__LITTLE_ENDIAN__))
+    (defined(__powerpc__) && defined(__LITTLE_ENDIAN__))
 #define LLVM_THREADING_USE_STD_CALL_ONCE 1
 #else
 #define LLVM_THREADING_USE_STD_CALL_ONCE 0

diff  --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp
index bd8a206b84448..732aa83090439 100644
--- a/llvm/lib/Support/Host.cpp
+++ b/llvm/lib/Support/Host.cpp
@@ -1251,7 +1251,7 @@ StringRef sys::getHostCPUName() {
   return "generic";
 }
 
-#elif defined(__APPLE__) && (defined(__ppc__) || defined(__powerpc__))
+#elif defined(__APPLE__) && defined(__powerpc__)
 StringRef sys::getHostCPUName() {
   host_basic_info_data_t hostInfo;
   mach_msg_type_number_t infoCount;
@@ -1295,7 +1295,7 @@ StringRef sys::getHostCPUName() {
 
   return "generic";
 }
-#elif defined(__linux__) && (defined(__ppc__) || defined(__powerpc__))
+#elif defined(__linux__) && defined(__powerpc__)
 StringRef sys::getHostCPUName() {
   std::unique_ptr<llvm::MemoryBuffer> P = getProcCpuinfoContent();
   StringRef Content = P ? P->getBuffer() : "";

diff  --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
index 5e008069dd989..e4454fe8c517d 100644
--- a/llvm/lib/Support/Unix/Memory.inc
+++ b/llvm/lib/Support/Unix/Memory.inc
@@ -50,8 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
       llvm::sys::Memory::MF_EXEC:
     return PROT_READ | PROT_WRITE | PROT_EXEC;
   case llvm::sys::Memory::MF_EXEC:
-#if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
-     defined(_POWER) || defined(_ARCH_PPC))
+#if defined(__FreeBSD__) || defined(__powerpc__)
     // On PowerPC, having an executable page that has no read permission
     // can have unintended consequences.  The function InvalidateInstruction-
     // Cache uses instructions dcbf and icbi, both of which are treated by
@@ -213,9 +212,7 @@ void Memory::InvalidateInstructionCache(const void *Addr,
 // icache invalidation for PPC and ARM.
 #if defined(__APPLE__)
 
-#  if (defined(__POWERPC__) || defined (__ppc__) || \
-       defined(_POWER) || defined(_ARCH_PPC) || defined(__arm__) || \
-       defined(__arm64__))
+#  if (defined(__powerpc__) || defined(__arm__) || defined(__arm64__))
   sys_icache_invalidate(const_cast<void *>(Addr), Len);
 #  endif
 
@@ -226,8 +223,7 @@ void Memory::InvalidateInstructionCache(const void *Addr,
 
 #else
 
-#  if (defined(__POWERPC__) || defined (__ppc__) || \
-       defined(_POWER) || defined(_ARCH_PPC)) && defined(__GNUC__)
+#  if defined(__powerpc__) && defined(__GNUC__)
   const size_t LineSize = 32;
 
   const intptr_t Mask = ~(LineSize - 1);

diff  --git a/llvm/unittests/ADT/PackedVectorTest.cpp b/llvm/unittests/ADT/PackedVectorTest.cpp
index 24df398934670..b4e017971efac 100644
--- a/llvm/unittests/ADT/PackedVectorTest.cpp
+++ b/llvm/unittests/ADT/PackedVectorTest.cpp
@@ -8,7 +8,7 @@
 
 // BitVectorTest tests fail on PowerPC for unknown reasons, so disable this
 // as well since it depends on a BitVector.
-#ifndef __ppc__
+#ifndef __powerpc__
 
 #include "llvm/ADT/PackedVector.h"
 #include "gtest/gtest.h"


        


More information about the llvm-commits mailing list