Commit a0247e7a authored by Andres Freund's avatar Andres Freund

Add pg_noinline macro to c.h.

Forcing a function not to be inlined can be useful if it's the
slow-path of a performance critical function, or should be visible in
profiles to allow for proper cost attribution.

Author: Andres Freund
Discussion: https://postgr.es/m/20170914061207.zxotvyopetm7lrrp@alap3.anarazel.de
parent d133982d
...@@ -642,6 +642,22 @@ typedef NameData *Name; ...@@ -642,6 +642,22 @@ typedef NameData *Name;
#define pg_attribute_noreturn() #define pg_attribute_noreturn()
#endif #endif
/*
* Forcing a function not to be inlined can be useful if it's the slow-path of
* a performance critical function, or should be visible in profiles to allow
* for proper cost attribution.
*/
/* GCC, Sunpro and XLC support noinline via __attribute */
#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__)
#define pg_noinline __attribute__((noinline))
/* msvc via declspec */
#elif defined(_MSC_VER)
#define pg_noinline __declspec(noinline)
#else
#define pg_noinline
#endif
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
* Section 6: assertions * Section 6: assertions
* ---------------------------------------------------------------- * ----------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment