[llvm-commits] [llvm] r67103 - in /llvm/trunk: include/llvm/Support/Compiler.h lib/Support/raw_ostream.cpp
Török Edwin
edwintorok at gmail.com
Tue Mar 17 14:36:47 PDT 2009
On 2009-03-17 23:15, Daniel Dunbar wrote:
> Author: ddunbar
> Date: Tue Mar 17 16:15:18 2009
> New Revision: 67103
>
> URL: http://llvm.org/viewvc/llvm-project?rev=67103&view=rev
> Log:
> 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.
>
> Modified:
> llvm/trunk/include/llvm/Support/Compiler.h
> llvm/trunk/lib/Support/raw_ostream.cpp
>
> Modified: llvm/trunk/include/llvm/Support/Compiler.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=67103&r1=67102&r2=67103&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/Compiler.h (original)
> +++ llvm/trunk/include/llvm/Support/Compiler.h Tue Mar 17 16:15:18 2009
> @@ -29,6 +29,12 @@
> #define ATTRIBUTE_USED
> #endif
>
> +#if (__GNUC__ >= 4)
> +#define BUILTIN_EXPECT(EXPR, VALUE) __builtin_expect((EXPR), (VALUE))
>
AFAIK gcc 3.2+ supports __builtin_expect():
http://gcc.gnu.org/onlinedocs/gcc-3.2.3/gcc/Other-Builtins.html#Other
Builtins
So the ifdef could be:
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
Best regards,
--Edwin
More information about the llvm-commits
mailing list