[PATCH] D51200: Introduce per-callsite inline intrinsics
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 4 18:26:05 PDT 2018
rjmccall added a comment.
In https://reviews.llvm.org/D51200#1223768, @kuhar wrote:
> In https://reviews.llvm.org/D51200#1223752, @rsmith wrote:
>
> > +rjmccall for CodeGen changes
>
>
> @rsmith @rjmccall
> I have one high-level question about the CodeGen part that I wasn't able to figure out: is it possible to bail out of custom CodeGen in CGBuiltin and somehow say: emit whatever is inside (IE treat the builtin call node as a no-op)?
You can just emit the sub-expression. Make sure you pass down the `ReturnValueSlot`, and make sure you test C++ calls that return references where the result is really treated as an l-value.
I've commented about the language design on your RFC thread.
================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:8240
+def err_argument_to_inline_intrinsic_block_call : Error<
+ "argument to %0 must not be a block call">;
+
----------------
This seems pretty trivial to add.
================
Comment at: include/clang/CodeGen/CGFunctionInfo.h:517
+ unsigned InlineCall : 2;
+
----------------
Please don't propagate this information through the `CGFunctionInfo`. I really want this type to be *less* site-specific, not *more*.
================
Comment at: lib/CodeGen/CGBuiltin.cpp:2998
+ case Builtin::BI__builtin_no_inline:
+ case Builtin::BI__builtin_always_inline: {
+ CGFunctionInfo::CallInlineKind CIK =
----------------
I wonder if it would make more sense to give this its own `Expr` subclass. We do that with several other "builtin" calls, like `__builtin_choose_expr` and `__builtin_offsetof`. That would avoid the problem of ending up in `CGBuiltin`, and it would make it easier to recognize and look through these annotation calls in Sema or IRGen.
================
Comment at: lib/CodeGen/CodeGenFunction.h:3570
+ CGFunctionInfo::CallInlineKind CIK =
+ CGFunctionInfo::CallInlineKind::DefaultInline);
RValue EmitCall(const CGFunctionInfo &CallInfo, const CGCallee &Callee,
----------------
I feel like the type of this argument should definitely be generalized to not just be about inlining.
https://reviews.llvm.org/D51200
More information about the cfe-commits
mailing list