[libcxx-commits] [libcxxabi] d54f597 - Add cold attribute to one time construction APIs
Aditya Kumar via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Aug 13 09:30:19 PDT 2020
Author: Aditya Kumar
Date: 2020-08-13T09:28:04-07:00
New Revision: d54f5979bb829e3864016798cc1cb5eecf39c4e0
URL: https://github.com/llvm/llvm-project/commit/d54f5979bb829e3864016798cc1cb5eecf39c4e0
DIFF: https://github.com/llvm/llvm-project/commit/d54f5979bb829e3864016798cc1cb5eecf39c4e0.diff
LOG: Add cold attribute to one time construction APIs
_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
Reviewed By: ldionne
Reviewers: mclow.lists, ldionne, jfb, yfeldblum
Differential Revision: https://reviews.llvm.org/D85873
Added:
Modified:
libcxxabi/include/cxxabi.h
Removed:
################################################################################
diff --git a/libcxxabi/include/cxxabi.h b/libcxxabi/include/cxxabi.h
index d21d3e1e2331..29e28a69a919 100644
--- a/libcxxabi/include/cxxabi.h
+++ b/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 @@ extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_deleted_virtual(void);
// 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
More information about the libcxx-commits
mailing list