summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2009-10-27 00:52:25 +0000
committerEric Christopher <echristo@apple.com>2009-10-27 00:52:25 +0000
commit7a50b280c18e93e005fb3206ce16df2c70e83a97 (patch)
treed1df75c633beb885b27fdeb10574e20a39e4c1c9 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
parentbb85c2644a99d3593d0279eb8841539e18e40270 (diff)
downloadbcm5719-llvm-7a50b280c18e93e005fb3206ce16df2c70e83a97.tar.gz
bcm5719-llvm-7a50b280c18e93e005fb3206ce16df2c70e83a97.zip
Add objectsize intrinsic and hook it up through codegen. Doesn't
do anything than return "I don't know" at the moment. llvm-svn: 85189
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
index f3a06221578..b220d55f548 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
@@ -4204,6 +4204,18 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
DAG.setRoot(Result);
return 0;
}
+ case Intrinsic::objectsize: {
+ // If we don't know by now, we're never going to know.
+ ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand(2));
+
+ assert(CI && "Non-constant type in __builtin_object_size?");
+
+ if (CI->getZExtValue() < 2)
+ setValue(&I, DAG.getConstant(-1, MVT::i32));
+ else
+ setValue(&I, DAG.getConstant(0, MVT::i32));
+ return 0;
+ }
case Intrinsic::var_annotation:
// Discard annotate attributes
return 0;
OpenPOWER on IntegriCloud