pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
llvm-netbsd: Improve latch for llvm::once_flag
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Sun Feb 5 16:54:57 2017 +0100
Changeset: 07b61aec28c28408d19ad564740bd64d05bb0e2b
Modified Files:
llvm-git/distinfo
Added Files:
llvm-git/patches/patch-include_llvm_CodeGen_Passes.h
llvm-git/patches/patch-include_llvm_PassSupport.h
llvm-git/patches/patch-include_llvm_Support_Threading.h
llvm-git/patches/patch-lib_CodeGen_TargetPassConfig.cpp
llvm-git/patches/patch-lib_Support_ManagedStatic.cpp
llvm-git/patches/patch-lib_Target_X86_X86InstrFMA3Info.cpp
Log Message:
llvm-netbsd: Improve latch for llvm::once_flag
To be send upstream.
Sponsored by <The NetBSD Foundation>
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=07b61aec28c28408d19ad564740bd64d05bb0e2b
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
llvm-git/distinfo | 6 ++
.../patches/patch-include_llvm_CodeGen_Passes.h | 13 ++++
llvm-git/patches/patch-include_llvm_PassSupport.h | 49 +++++++++++++++
.../patches/patch-include_llvm_Support_Threading.h | 69 ++++++++++++++++++++++
.../patches/patch-lib_CodeGen_TargetPassConfig.cpp | 13 ++++
.../patches/patch-lib_Support_ManagedStatic.cpp | 13 ++++
.../patch-lib_Target_X86_X86InstrFMA3Info.cpp | 13 ++++
7 files changed, 176 insertions(+)
diffs:
diff --git a/llvm-git/distinfo b/llvm-git/distinfo
index 7931384fd5..e5c342f324 100644
--- a/llvm-git/distinfo
+++ b/llvm-git/distinfo
@@ -12,3 +12,9 @@ Size (libcxx-3.6.2.src.tar.xz) = 944020 bytes
SHA1 (llvm-3.6.2.src.tar.xz) = 7a00257eb2bc9431e4c77c3a36b033072c54bc7e
RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
+SHA1 (patch-include_llvm_CodeGen_Passes.h) = d4870a6c985e4ab59215cf08e28ffd7187c119e0
+SHA1 (patch-include_llvm_PassSupport.h) = 7ce4d14911c0c37f36b7a0417fe65475669b12b2
+SHA1 (patch-include_llvm_Support_Threading.h) = 466f5ce7ed60e8ec65d8a6de05514c77a3012cec
+SHA1 (patch-lib_CodeGen_TargetPassConfig.cpp) = 7452ee81e9d9719c850104800f45d115fc4801da
+SHA1 (patch-lib_Support_ManagedStatic.cpp) = d13a2498e8d91364c08cd724bd9bf26c95068ac1
+SHA1 (patch-lib_Target_X86_X86InstrFMA3Info.cpp) = f78053c75c818ee158d8fbdc2e08b1e70c9e21c0
diff --git a/llvm-git/patches/patch-include_llvm_CodeGen_Passes.h b/llvm-git/patches/patch-include_llvm_CodeGen_Passes.h
new file mode 100644
index 0000000000..476ac5b32d
--- /dev/null
+++ b/llvm-git/patches/patch-include_llvm_CodeGen_Passes.h
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- include/llvm/CodeGen/Passes.h.orig 2017-02-02 23:04:55.000000000 +0000
++++ include/llvm/CodeGen/Passes.h
+@@ -418,7 +418,7 @@ namespace llvm {
+ Registry.registerPass(*PI, true); \
+ return PI; \
+ } \
+- LLVM_DEFINE_ONCE_FLAG(Initialize##passName##PassFlag); \
++ static llvm::once_flag Initialize##passName##PassFlag; \
+ void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
+ llvm::call_once(Initialize##passName##PassFlag, \
+ initialize##passName##PassOnce, std::ref(Registry)); \
diff --git a/llvm-git/patches/patch-include_llvm_PassSupport.h b/llvm-git/patches/patch-include_llvm_PassSupport.h
new file mode 100644
index 0000000000..0ed5f960a5
--- /dev/null
+++ b/llvm-git/patches/patch-include_llvm_PassSupport.h
@@ -0,0 +1,49 @@
+$NetBSD$
+
+--- include/llvm/PassSupport.h.orig 2016-10-19 20:19:34.000000000 +0000
++++ include/llvm/PassSupport.h
+@@ -41,7 +41,7 @@ class TargetMachine;
+ Registry.registerPass(*PI, true); \
+ return PI; \
+ } \
+- LLVM_DEFINE_ONCE_FLAG(Initialize##passName##PassFlag); \
++ static llvm::once_flag Initialize##passName##PassFlag; \
+ void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
+ llvm::call_once(Initialize##passName##PassFlag, \
+ initialize##passName##PassOnce, std::ref(Registry)); \
+@@ -61,7 +61,7 @@ class TargetMachine;
+ Registry.registerPass(*PI, true); \
+ return PI; \
+ } \
+- LLVM_DEFINE_ONCE_FLAG(Initialize##passName##PassFlag); \
++ static llvm::once_flag Initialize##passName##PassFlag; \
+ void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
+ llvm::call_once(Initialize##passName##PassFlag, \
+ initialize##passName##PassOnce, std::ref(Registry)); \
+@@ -152,7 +152,7 @@ struct RegisterAnalysisGroup : public Re
+ Registry.registerAnalysisGroup(&agName::ID, 0, *AI, false, true); \
+ return AI; \
+ } \
+- LLVM_DEFINE_ONCE_FLAG(Initialize##agName##AnalysisGroupFlag); \
++ static llvm::once_flag Initialize##agName##AnalysisGroupFlag; \
+ void llvm::initialize##agName##AnalysisGroup(PassRegistry &Registry) { \
+ llvm::call_once(Initialize##agName##AnalysisGroupFlag, \
+ initialize##agName##AnalysisGroupOnce, \
+@@ -173,7 +173,7 @@ struct RegisterAnalysisGroup : public Re
+ true); \
+ return AI; \
+ } \
+- LLVM_DEFINE_ONCE_FLAG(Initialize##passName##PassFlag); \
++ static llvm::once_flag Initialize##passName##PassFlag; \
+ void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
+ llvm::call_once(Initialize##passName##PassFlag, \
+ initialize##passName##PassOnce, std::ref(Registry)); \
+@@ -194,7 +194,7 @@ struct RegisterAnalysisGroup : public Re
+ Registry.registerAnalysisGroup(&agName::ID, &passName::ID, *AI, def, true); \
+ return AI; \
+ } \
+- LLVM_DEFINE_ONCE_FLAG(Initialize##passName##PassFlag); \
++ static llvm::once_flag Initialize##passName##PassFlag; \
+ void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
+ llvm::call_once(Initialize##passName##PassFlag, \
+ initialize##passName##PassOnce, std::ref(Registry)); \
diff --git a/llvm-git/patches/patch-include_llvm_Support_Threading.h b/llvm-git/patches/patch-include_llvm_Support_Threading.h
new file mode 100644
index 0000000000..f30790fa45
--- /dev/null
+++ b/llvm-git/patches/patch-include_llvm_Support_Threading.h
@@ -0,0 +1,69 @@
+$NetBSD$
+
+--- include/llvm/Support/Threading.h.orig 2017-02-02 23:04:55.000000000 +0000
++++ include/llvm/Support/Threading.h
+@@ -60,19 +60,14 @@ namespace llvm {
+
+ typedef std::once_flag once_flag;
+
+- /// This macro is the only way you should define your once flag for LLVM's
+- /// call_once.
+-#define LLVM_DEFINE_ONCE_FLAG(flag) static once_flag flag
+-
+ #else
+
+ enum InitStatus { Uninitialized = 0, Wait = 1, Done = 2 };
+- typedef volatile sys::cas_flag once_flag;
+-
+- /// This macro is the only way you should define your once flag for LLVM's
+- /// call_once.
+-#define LLVM_DEFINE_ONCE_FLAG(flag) \
+- static ::llvm::once_flag flag = ::llvm::Uninitialized
++ class once_flag {
++ public:
++ once_flag() : status(::llvm::Uninitialized) {};
++ volatile ::llvm::sys::cas_flag status;
++ };
+
+ #endif
+
+@@ -82,7 +77,7 @@ namespace llvm {
+ /// \code
+ /// void foo() {...};
+ /// ...
+- /// LLVM_DEFINE_ONCE_FLAG(flag);
++ /// static once_flag flag;
+ /// call_once(flag, foo);
+ /// \endcode
+ ///
+@@ -96,24 +91,24 @@ namespace llvm {
+ #else
+ // For other platforms we use a generic (if brittle) version based on our
+ // atomics.
+- sys::cas_flag old_val = sys::CompareAndSwap(&flag, Wait, Uninitialized);
++ sys::cas_flag old_val = sys::CompareAndSwap(&flag.status, Wait, Uninitialized);
+ if (old_val == Uninitialized) {
+ std::forward<Function>(F)(std::forward<Args>(ArgList)...);
+ sys::MemoryFence();
+ TsanIgnoreWritesBegin();
+- TsanHappensBefore(&flag);
+- flag = Done;
++ TsanHappensBefore(&flag.status);
++ flag.status = Done;
+ TsanIgnoreWritesEnd();
+ } else {
+ // Wait until any thread doing the call has finished.
+- sys::cas_flag tmp = flag;
++ sys::cas_flag tmp = flag.status;
+ sys::MemoryFence();
+ while (tmp != Done) {
+- tmp = flag;
++ tmp = flag.status;
+ sys::MemoryFence();
+ }
+ }
+- TsanHappensAfter(&flag);
++ TsanHappensAfter(&flag.status);
+ #endif
+ }
+
diff --git a/llvm-git/patches/patch-lib_CodeGen_TargetPassConfig.cpp b/llvm-git/patches/patch-lib_CodeGen_TargetPassConfig.cpp
new file mode 100644
index 0000000000..5059f2ea1a
--- /dev/null
+++ b/llvm-git/patches/patch-lib_CodeGen_TargetPassConfig.cpp
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- lib/CodeGen/TargetPassConfig.cpp.orig 2017-02-02 23:04:55.000000000 +0000
++++ lib/CodeGen/TargetPassConfig.cpp
+@@ -733,7 +733,7 @@ MachinePassRegistry RegisterRegAlloc::Re
+
+ /// A dummy default pass factory indicates whether the register allocator is
+ /// overridden on the command line.
+-LLVM_DEFINE_ONCE_FLAG(InitializeDefaultRegisterAllocatorFlag);
++static llvm::once_flag InitializeDefaultRegisterAllocatorFlag;
+ static FunctionPass *useDefaultRegisterAllocator() { return nullptr; }
+ static RegisterRegAlloc
+ defaultRegAlloc("default",
diff --git a/llvm-git/patches/patch-lib_Support_ManagedStatic.cpp b/llvm-git/patches/patch-lib_Support_ManagedStatic.cpp
new file mode 100644
index 0000000000..16cdb5070f
--- /dev/null
+++ b/llvm-git/patches/patch-lib_Support_ManagedStatic.cpp
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- lib/Support/ManagedStatic.cpp.orig 2016-07-05 12:47:20.000000000 +0000
++++ lib/Support/ManagedStatic.cpp
+@@ -21,7 +21,7 @@ using namespace llvm;
+
+ static const ManagedStaticBase *StaticList = nullptr;
+ static sys::Mutex *ManagedStaticMutex = nullptr;
+-LLVM_DEFINE_ONCE_FLAG(mutex_init_flag);
++static llvm::once_flag mutex_init_flag;
+
+ static void initializeMutex() {
+ ManagedStaticMutex = new sys::Mutex();
diff --git a/llvm-git/patches/patch-lib_Target_X86_X86InstrFMA3Info.cpp b/llvm-git/patches/patch-lib_Target_X86_X86InstrFMA3Info.cpp
new file mode 100644
index 0000000000..eb066d5612
--- /dev/null
+++ b/llvm-git/patches/patch-lib_Target_X86_X86InstrFMA3Info.cpp
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- lib/Target/X86/X86InstrFMA3Info.cpp.orig 2017-02-05 15:43:39.582556537 +0000
++++ lib/Target/X86/X86InstrFMA3Info.cpp
+@@ -23,7 +23,7 @@ using namespace llvm;
+
+ /// This flag is used in the method llvm::call_once() used below to make the
+ /// initialization of the map 'OpcodeToGroup' thread safe.
+-LLVM_DEFINE_ONCE_FLAG(InitGroupsOnceFlag);
++static llvm::once_flag InitGroupsOnceFlag;
+
+ static ManagedStatic<X86InstrFMA3Info> X86InstrFMA3InfoObj;
+ X86InstrFMA3Info *X86InstrFMA3Info::getX86InstrFMA3Info() {
Home |
Main Index |
Thread Index |
Old Index