[PATCH] D51778: Introduce LLVM_HOT
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 7 04:32:34 PDT 2018
xbolva00 created this revision.
Herald added a subscriber: llvm-commits.
>From GCC docs (I found no docs for this attribute in LLVM docs; but LLVM understands hot/cold attribute too):
"The hot attribute on a function is used to inform the compiler that the function is a hot spot of the compiled program. The function is optimized more aggressively and on many targets it is placed into a special subsection of the text section so all hot functions appear close together, improving locality."
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
We can mark Clang/LLVM hotspots with LLVM_HOT as follow-up.
Repository:
rL LLVM
https://reviews.llvm.org/D51778
Files:
include/llvm/Support/Compiler.h
Index: include/llvm/Support/Compiler.h
===================================================================
--- include/llvm/Support/Compiler.h
+++ include/llvm/Support/Compiler.h
@@ -217,6 +217,12 @@
#define LLVM_ATTRIBUTE_RETURNS_NONNULL
#endif
+#if __has_attribute(hot)
+#define LLVM_HOT __attribute__((__hot__))
+#else
+#define LLVM_HOT
+#endif
+
/// \macro LLVM_ATTRIBUTE_RETURNS_NOALIAS Used to mark a function as returning a
/// pointer that does not alias any other valid pointer.
#ifdef __GNUC__
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51778.164387.patch
Type: text/x-patch
Size: 511 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180907/5c80bcf2/attachment.bin>
More information about the llvm-commits
mailing list