diff options
| author | Mike Stump <mrs@apple.com> | 2009-10-27 22:09:17 +0000 | 
|---|---|---|
| committer | Mike Stump <mrs@apple.com> | 2009-10-27 22:09:17 +0000 | 
| commit | 876387ba4ff804995cd3707af70925341c6b58b9 (patch) | |
| tree | 7c61a34d236f5226857fff03dfefe552d7637606 /clang/lib/CodeGen/CGBuiltin.cpp | |
| parent | a4374e66f0b92446c4fee3f3f61329a5ff832ba6 (diff) | |
| download | bcm5719-llvm-876387ba4ff804995cd3707af70925341c6b58b9.tar.gz bcm5719-llvm-876387ba4ff804995cd3707af70925341c6b58b9.zip | |
__builtin_object_size refinements.  Ensure we handle expressions with
side-effects up front, as when we switch to the llvm intrinsic call
for __builtin_object_size later, it will have two evaluations.
We also finish off the intrinsic version of the code so we can just
turn it on once llvm has the intrinsic.
llvm-svn: 85324
Diffstat (limited to 'clang/lib/CodeGen/CGBuiltin.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 12 | 
1 files changed, 7 insertions, 5 deletions
| diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 29b46611e2e..c26921969a8 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -203,11 +203,13 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,  #if 0      // We pass this builtin onto the optimizer so that it can      // figure out the object size in more complex cases. -    Value *F = CGM.getIntrinsic(Intrinsic::objectsize, 0, 0); -    Builder.CreateCall2(F, -                        EmitScalarExpr(E->getArg(0))); -                        EmitScalarExpr(E->getArg(1))); -    return RValue::get(Address); +    const llvm::Type *ResType[] = { +      ConvertType(E->getType()) +    }; +    Value *F = CGM.getIntrinsic(Intrinsic::objectsize, ResType, 1); +    return RValue::get(Builder.CreateCall2(F, +                                           EmitScalarExpr(E->getArg(0)), +                                           EmitScalarExpr(E->getArg(1))));  #else      // FIXME: Implement. For now we just always fail and pretend we      // don't know the object size. | 

