[libcxx-commits] [PATCH] D85873: Add cold attribute to one time construction APIs
Aditya Kumar via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Aug 12 22:14:29 PDT 2020
hiraditya created this revision.
hiraditya added reviewers: mclow.lists, ldionne, jfb, yfeldblum.
Herald added subscribers: libcxx-commits, dexonsmith.
hiraditya requested review of this revision.
_cxa_guard_acquire is used for only one purpose, namely guarding local static variable initialization, and since that purpose is definitionally cold, it should be attributed as cold.
Similarly for __cxa_guard_release and __cxa_guard_abort
Repository:
rCXXA libc++abi
https://reviews.llvm.org/D85873
Files:
libcxxabi/include/cxxabi.h
Index: libcxxabi/include/cxxabi.h
===================================================================
--- libcxxabi/include/cxxabi.h
+++ libcxxabi/include/cxxabi.h
@@ -21,6 +21,7 @@
#define _LIBCPPABI_VERSION 1002
#define _LIBCXXABI_NORETURN __attribute__((noreturn))
+#define _LIBCXXABI_ALWAYS_COLD __attribute__((cold))
#ifdef __cplusplus
@@ -78,13 +79,13 @@
// 3.3.2 One-time Construction API
#if defined(_LIBCXXABI_GUARD_ABI_ARM)
-extern _LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(uint32_t *);
-extern _LIBCXXABI_FUNC_VIS void __cxa_guard_release(uint32_t *);
-extern _LIBCXXABI_FUNC_VIS void __cxa_guard_abort(uint32_t *);
+extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD int __cxa_guard_acquire(uint32_t *);
+extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD void __cxa_guard_release(uint32_t *);
+extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD void __cxa_guard_abort(uint32_t *);
#else
-extern _LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(uint64_t *);
-extern _LIBCXXABI_FUNC_VIS void __cxa_guard_release(uint64_t *);
-extern _LIBCXXABI_FUNC_VIS void __cxa_guard_abort(uint64_t *);
+extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD int __cxa_guard_acquire(uint64_t *);
+extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD void __cxa_guard_release(uint64_t *);
+extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_ALWAYS_COLD void __cxa_guard_abort(uint64_t *);
#endif
// 3.3.3 Array Construction and Destruction API
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85873.285253.patch
Type: text/x-patch
Size: 1432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200813/9896d79d/attachment-0001.bin>
More information about the libcxx-commits
mailing list