diff options
author | Eric Christopher <echristo@apple.com> | 2009-12-23 03:49:37 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2009-12-23 03:49:37 +0000 |
commit | c87915629b965cfd6d8db08ebe990de5fcb2b077 (patch) | |
tree | 26676048296905543f265bb48fa492b49f4e28df /clang/lib/CodeGen | |
parent | 9a05f20d410720f3f7dd710cadaff574104a037d (diff) | |
download | bcm5719-llvm-c87915629b965cfd6d8db08ebe990de5fcb2b077.tar.gz bcm5719-llvm-c87915629b965cfd6d8db08ebe990de5fcb2b077.zip |
Update for the intrinsic changes in llvm: the object size intrinsic
only takes a boolean second argument now. Update tests accordingly.
Currently the builtin still accepts the full range for compatibility.
llvm-svn: 91983
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index a791fd04f4f..98dd9ec9910 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -209,10 +209,19 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, const llvm::Type *ResType[] = { ConvertType(E->getType()) }; + + // LLVM only supports 0 and 2, make sure that we pass along that + // as a boolean. + Value *Ty = EmitScalarExpr(E->getArg(1)); + ConstantInt *CI = dyn_cast<ConstantInt>(Ty); + assert(CI); + uint64_t val = CI->getZExtValue(); + CI = ConstantInt::get(llvm::Type::getInt1Ty(VMContext), (val & 0x2) >> 1); + Value *F = CGM.getIntrinsic(Intrinsic::objectsize, ResType, 1); return RValue::get(Builder.CreateCall2(F, EmitScalarExpr(E->getArg(0)), - EmitScalarExpr(E->getArg(1)))); + CI)); } case Builtin::BI__builtin_prefetch: { Value *Locality, *RW, *Address = EmitScalarExpr(E->getArg(0)); |