[cfe-commits] r85175 - /cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Mike Stump mrs at apple.com
Mon Oct 26 16:39:52 PDT 2009


Author: mrs
Date: Mon Oct 26 18:39:48 2009
New Revision: 85175

URL: http://llvm.org/viewvc/llvm-project?rev=85175&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=85175&r1=85174&r2=85175&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Oct 26 18:39:48 2009
@@ -199,6 +199,16 @@
     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 @@
     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));





More information about the cfe-commits mailing list