mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-19 12:10:29 +00:00
When making a direct call to a thunk, inline the call in SemIR. (#5642)
This preserves the constant values of the arguments to the thunk, which is important if the thunk requires conversion of an `IntLiteral` to some other type. This should become unnecessary once we have form support, but avoiding the indirection through a thunk function seems valuable even once that support is in place. To support this, track whether a function is a thunk on the Function object, and if so, what the callee of the thunk is. This information is also included in formatted SemIR when dumping the thunk.
This commit is contained in:
1 parent
bdf5f00af0
commit
4e5dccdbf7
22 files changed
+394
-151
No files matched your search
@@ -1717,7 +1717,7 @@ static auto MakeConstantForCall(EvalContext& eval_context,
|
||||
// Calls to builtins might be constant.
|
||||
builtin_kind = eval_context.functions()
|
||||
.Get(callee_function.function_id)
|
||||
.builtin_function_kind;
|
||||
.builtin_function_kind();
|
||||
if (builtin_kind == SemIR::BuiltinFunctionKind::None) {
|
||||
// TODO: Eventually we'll want to treat some kinds of non-builtin
|
||||
// functions as producing constants.
|
||||
|
||||
Reference in new issue
Block a user