mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: tweaks to unindent some code
Prioritized the chunks of code with 8 or more levels of indentation. Basically early breaks/returns and joining nested ifs. Change-Id: I6817df1303226acf2eb904a29f2db720e4f7427a Reviewed-on: https://go-review.googlesource.com/55630 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
064ae118c1
commit
3366f51544
7 changed files with 96 additions and 99 deletions
|
|
@ -233,24 +233,25 @@ func (s *phiState) insertVarPhis(n int, var_ *Node, defs []*ssa.Block, typ *type
|
|||
// a D-edge, or an edge whose target is in currentRoot's subtree.
|
||||
continue
|
||||
}
|
||||
if !hasPhi.contains(c.ID) {
|
||||
// Add a phi to block c for variable n.
|
||||
hasPhi.add(c.ID)
|
||||
v := c.NewValue0I(currentRoot.Pos, ssa.OpPhi, typ, int64(n)) // TODO: line number right?
|
||||
// Note: we store the variable number in the phi's AuxInt field. Used temporarily by phi building.
|
||||
s.s.addNamedValue(var_, v)
|
||||
for i := 0; i < len(c.Preds); i++ {
|
||||
v.AddArg(s.placeholder) // Actual args will be filled in by resolveFwdRefs.
|
||||
}
|
||||
if debugPhi {
|
||||
fmt.Printf("new phi for var%d in %s: %s\n", n, c, v)
|
||||
}
|
||||
if !hasDef.contains(c.ID) {
|
||||
// There's now a new definition of this variable in block c.
|
||||
// Add it to the priority queue to explore.
|
||||
heap.Push(priq, c)
|
||||
hasDef.add(c.ID)
|
||||
}
|
||||
if hasPhi.contains(c.ID) {
|
||||
continue
|
||||
}
|
||||
// Add a phi to block c for variable n.
|
||||
hasPhi.add(c.ID)
|
||||
v := c.NewValue0I(currentRoot.Pos, ssa.OpPhi, typ, int64(n)) // TODO: line number right?
|
||||
// Note: we store the variable number in the phi's AuxInt field. Used temporarily by phi building.
|
||||
s.s.addNamedValue(var_, v)
|
||||
for i := 0; i < len(c.Preds); i++ {
|
||||
v.AddArg(s.placeholder) // Actual args will be filled in by resolveFwdRefs.
|
||||
}
|
||||
if debugPhi {
|
||||
fmt.Printf("new phi for var%d in %s: %s\n", n, c, v)
|
||||
}
|
||||
if !hasDef.contains(c.ID) {
|
||||
// There's now a new definition of this variable in block c.
|
||||
// Add it to the priority queue to explore.
|
||||
heap.Push(priq, c)
|
||||
hasDef.add(c.ID)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue