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

llvm-svn: 44497
This commit is contained in:
Oliver Hunt 2007-12-02 01:03:24 +00:00
parent 9724ce12f9
commit a96fe8d5c5
3 changed files with 6 additions and 1 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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