diff options
author | Eric Christopher <echristo@apple.com> | 2009-10-27 00:52:25 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2009-10-27 00:52:25 +0000 |
commit | 7b5e61707a128a222e5e7ab20eb8154ca81001cb (patch) | |
tree | 97b92c485a5974efe8f986bc8d97daae634ff793 /lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | |
parent | dd22a45acc24ff1e4954fda753c555a6365d1dec (diff) |
Add objectsize intrinsic and hook it up through codegen. Doesn't
do anything than return "I don't know" at the moment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85189 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index f3a0622157..b220d55f54 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/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; |