aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/c.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/include/c.h b/src/include/c.h
index d5dc3632f74..ff7c2eddcec 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -192,6 +192,22 @@
#endif
/*
+ * Marking certain functions as "hot" or "cold" can be useful to assist the
+ * compiler in arranging the assembly code in a more efficient way.
+ */
+#if defined(__has_attribute) && __has_attribute (cold)
+#define pg_attribute_cold __attribute__((cold))
+#else
+#define pg_attribute_cold
+#endif
+
+#if defined(__has_attribute) && __has_attribute (hot)
+#define pg_attribute_hot __attribute__((hot))
+#else
+#define pg_attribute_hot
+#endif
+
+/*
* Mark a point as unreachable in a portable fashion. This should preferably
* be something that the compiler understands, to aid code generation.
* In assert-enabled builds, we prefer abort() for debugging reasons.