mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] cmd/compile/internal/inline: refactor mkinlcall
This CL refactors mkinlcall by extracting the core InlinedCallExpr construction code into a new "oldInline" function, and adds a new "NewInline" hook point that can be overriden with a new inliner implementation that only needs to worry about the details of constructing the InlinedCallExpr. It also moves the delayretvars optimization check into CanInline, so it's performed just once per inlinable function rather than once for each inlined call. Finally, it skips printing the function body about to be inlined (and updates the couple of regress tests that expected this output). We already report the inline body as it was saved, and this diagnostic is only applicable to the current inliner, which clones existing function body instances. In the unified IR inliner, we'll directly construct inline bodies from the serialized representation. Change-Id: Ibdbe617da83c07665dcbda402cc8d4d4431dde2f Reviewed-on: https://go-review.googlesource.com/c/go/+/323290 Trust: Matthew Dempsky <mdempsky@google.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
parent
88583a2a66
commit
417955d151
7 changed files with 113 additions and 91 deletions
|
|
@ -166,6 +166,11 @@ type Inline struct {
|
|||
// another package is imported.
|
||||
Dcl []*Name
|
||||
Body []Node
|
||||
|
||||
// CanDelayResults reports whether it's safe for the inliner to delay
|
||||
// initializing the result parameters until immediately before the
|
||||
// "return" statement.
|
||||
CanDelayResults bool
|
||||
}
|
||||
|
||||
// A Mark represents a scope boundary.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue