summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGBuiltin.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-10-26 23:39:48 +0000
committerMike Stump <mrs@apple.com>2009-10-26 23:39:48 +0000
commit7a484dd6a9a900c1c25794a0d555e40e417f693b (patch)
tree104c6071567c3fb794918b05a080c9422b289a60 /clang/lib/CodeGen/CGBuiltin.cpp
parent5183a14bfbcd339681c6451053fa3d5152f53d12 (diff)
downloadbcm5719-llvm-7a484dd6a9a900c1c25794a0d555e40e417f693b.tar.gz
bcm5719-llvm-7a484dd6a9a900c1c25794a0d555e40e417f693b.zip
Prep for future __builtin_object_size refinements. The theory is that
someone will add an llvm intrinsic for us to use, so the optimizer can figure out the hard cases. WIP. For those that want to help, double check with Eric before starting. He has a bit of code this will plug into. llvm-svn: 85175
Diffstat (limited to 'clang/lib/CodeGen/CGBuiltin.cpp')
-rw-r--r--clang/lib/CodeGen/CGBuiltin.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 987cd24e2c8..29b46611e2e 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -199,6 +199,16 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
return RValue::get(Builder.CreateCall(F, ArgValue, "tmp"));
}
case Builtin::BI__builtin_object_size: {
+ // FIXME: We're awaiting the llvm intrincis.
+#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);
+#else
// FIXME: Implement. For now we just always fail and pretend we
// don't know the object size.
llvm::APSInt TypeArg = E->getArg(1)->EvaluateAsInt(CGM.getContext());
@@ -207,6 +217,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
bool UseMinimum = TypeArg.getZExtValue() & 2;
return RValue::get(
llvm::ConstantInt::get(ResType, UseMinimum ? 0 : -1LL));
+#endif
}
case Builtin::BI__builtin_prefetch: {
Value *Locality, *RW, *Address = EmitScalarExpr(E->getArg(0));
OpenPOWER on IntegriCloud