aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Support/Compiler.h
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-03-17 21:15:18 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-03-17 21:15:18 +0000
commitd697633b8cb82addebb6596c2469efc11497069f (patch)
tree023532e358a24263eeb1eb2677711fb2c6e9f5c5 /include/llvm/Support/Compiler.h
parent9fefccec52eb4c277c7f3310b2d2b9de4b922511 (diff)
downloadexternal_llvm-d697633b8cb82addebb6596c2469efc11497069f.zip
external_llvm-d697633b8cb82addebb6596c2469efc11497069f.tar.gz
external_llvm-d697633b8cb82addebb6596c2469efc11497069f.tar.bz2
Add BUILTIN_EXPECT Support/Compiler macro.
- Use for exceptional buffer conditions in raw_ostream:write to shave off a cycle or two. - Please rename if you have a better one. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67103 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/Compiler.h')
-rw-r--r--include/llvm/Support/Compiler.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h
index 7186b22..90292df 100644
--- a/include/llvm/Support/Compiler.h
+++ b/include/llvm/Support/Compiler.h
@@ -29,6 +29,12 @@
#define ATTRIBUTE_USED
#endif
+#if (__GNUC__ >= 4)
+#define BUILTIN_EXPECT(EXPR, VALUE) __builtin_expect((EXPR), (VALUE))
+#else
+#define BUILTIN_EXPECT(EXPR, VALUE) (EXPR)
+#endif
+
// C++ doesn't support 'extern template' of template specializations. GCC does,
// but requires __extension__ before it. In the header, use this:
// EXTERN_TEMPLATE_INSTANTIATION(class foo<bar>);