diff options
author | Oliver Hunt <oliver@apple.com> | 2007-12-02 01:03:24 +0000 |
---|---|---|
committer | Oliver Hunt <oliver@apple.com> | 2007-12-02 01:03:24 +0000 |
commit | 6f0768bc565028d2536fc41ee0d466c13985a921 (patch) | |
tree | 29ec958f59b15292e6d247422c6e301e4ecf4bfc | |
parent | 2efcd2f04e6151ff3144e697529cfa483ad4cb65 (diff) |
Add support for __builtin_expect which is needed for assert,
among other things.
Also change a codegen warning to dump to stderr so it doesn't
mess with -emit-llvm output
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44497 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | CodeGen/CGBuiltin.cpp | 4 | ||||
-rw-r--r-- | CodeGen/CGStmt.cpp | 2 | ||||
-rw-r--r-- | include/clang/AST/Builtins.def | 1 |
3 files changed, 6 insertions, 1 deletions
diff --git a/CodeGen/CGBuiltin.cpp b/CodeGen/CGBuiltin.cpp index 803d89ee54..52a41d8533 100644 --- a/CodeGen/CGBuiltin.cpp +++ b/CodeGen/CGBuiltin.cpp @@ -97,6 +97,10 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { return RValue::get(Result); } + case Builtin::BI__builtin_expect: { + llvm::Value *Condition = EmitScalarExpr(E->getArg(0)); + return RValue::get(Condition); + } } return RValue::get(0); diff --git a/CodeGen/CGStmt.cpp b/CodeGen/CGStmt.cpp index 9059a83119..b010e81009 100644 --- a/CodeGen/CGStmt.cpp +++ b/CodeGen/CGStmt.cpp @@ -38,7 +38,7 @@ void CodeGenFunction::EmitStmt(const Stmt *S) { else EmitAggExpr(E, 0, false); } else { - printf("Unimplemented stmt!\n"); + fprintf(stderr, "Unimplemented stmt!\n"); S->dump(getContext().SourceMgr); } break; diff --git a/include/clang/AST/Builtins.def b/include/clang/AST/Builtins.def index 7733a9b1b2..f2f182401e 100644 --- a/include/clang/AST/Builtins.def +++ b/include/clang/AST/Builtins.def @@ -67,5 +67,6 @@ BUILTIN(__builtin_va_start, "va&.", "n") BUILTIN(__builtin_va_end, "va&", "n") BUILTIN(__builtin_va_copy, "va&a", "n") BUILTIN(__builtin_memcpy, "v*v*vC*z", "n") +BUILTIN(__builtin_expect, "iii" , "nc") #undef BUILTIN |