aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/inline
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-04-26 14:32:23 -0700
committerDan Scales <danscales@google.com>2021-05-07 21:35:41 +0000
commitf24eac47710b0170fd45611ab1867e87701e0a95 (patch)
tree485a45d4d3be76ca28f3fc6d0f18e994b86b25d4 /src/cmd/compile/internal/inline
parent3980c4db192783c6aefa0a5978e553046c9c7dea (diff)
downloadgo-f24eac47710b0170fd45611ab1867e87701e0a95.tar.gz
go-f24eac47710b0170fd45611ab1867e87701e0a95.zip
cmd/compile: improving the documentation of various fields and functions
This is only changes to comments, so should be fine to go into 1.17. Change-Id: I01e28dc76b03fb3ca846d976f8ac84bc2acb2ea2 Reviewed-on: https://go-review.googlesource.com/c/go/+/318009 Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/inline')
-rw-r--r--src/cmd/compile/internal/inline/inl.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go
index e07bb3b324..a6829e9835 100644
--- a/src/cmd/compile/internal/inline/inl.go
+++ b/src/cmd/compile/internal/inline/inl.go
@@ -53,8 +53,8 @@ const (
inlineBigFunctionMaxCost = 20 // Max cost of inlinee when inlining into a "big" function.
)
+// InlinePackage finds functions that can be inlined and clones them before walk expands them.
func InlinePackage() {
- // Find functions that can be inlined and clone them before walk expands them.
ir.VisitFuncsBottomUp(typecheck.Target.Decls, func(list []*ir.Func, recursive bool) {
numfns := numNonClosures(list)
for _, n := range list {
@@ -74,8 +74,8 @@ func InlinePackage() {
}
// CanInline determines whether fn is inlineable.
-// If so, CanInline saves fn->nbody in fn->inl and substitutes it with a copy.
-// fn and ->nbody will already have been typechecked.
+// If so, CanInline saves copies of fn.Body and fn.Dcl in fn.Inl.
+// fn and fn.Body will already have been typechecked.
func CanInline(fn *ir.Func) {
if fn.Nname == nil {
base.Fatalf("CanInline no nname %+v", fn)
@@ -520,7 +520,7 @@ func inlcopy(n ir.Node) ir.Node {
return edit(n)
}
-// Inlcalls/nodelist/node walks fn's statements and expressions and substitutes any
+// InlineCalls/inlnode walks fn's statements and expressions and substitutes any
// calls made to inlineable functions. This is the external entry point.
func InlineCalls(fn *ir.Func) {
savefn := ir.CurFunc