mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal: use sparseSet, optimize isSynthetic
changedVars was functionally a set, but couldn't be iterated over efficiently. In functions with many variables, the wasted iteration was costly. Use a sparseSet instead. (*gc.Node).String() is very expensive: it calls Sprintf, which does reflection, etc, etc. Instead, just look at .Sym.Name, which is all we care about. Change-Id: Ib61cd7b5c796e1813b8859135e85da5bfe2ac686 Reviewed-on: https://go-review.googlesource.com/92402 Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
108efc79c7
commit
e181852dd4
4 changed files with 22 additions and 23 deletions
|
|
@ -59,6 +59,11 @@ type Node struct {
|
|||
Etype types.EType // op for OASOP, etype for OTYPE, exclam for export, 6g saved reg, ChanDir for OTCHAN, for OINDEXMAP 1=LHS,0=RHS
|
||||
}
|
||||
|
||||
func (n *Node) IsSynthetic() bool {
|
||||
name := n.Sym.Name
|
||||
return name[0] == '.' || name[0] == '~'
|
||||
}
|
||||
|
||||
// IsAutoTmp indicates if n was created by the compiler as a temporary,
|
||||
// based on the setting of the .AutoTemp flag in n's Name.
|
||||
func (n *Node) IsAutoTmp() bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue