mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
cmd/compile: remove redundant function idom
Change-Id: Ib14b5421bb5e407bbd4d3cbfc68c92d3dd257cb1 Reviewed-on: https://go-review.googlesource.com/30732 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
f1eed92fd0
commit
c5368123fe
|
@ -451,23 +451,20 @@ func (f *Func) postorder() []*Block {
|
||||||
return f.cachedPostorder
|
return f.cachedPostorder
|
||||||
}
|
}
|
||||||
|
|
||||||
// idom returns a map from block ID to the immediate dominator of that block.
|
// Idom returns a map from block ID to the immediate dominator of that block.
|
||||||
// f.Entry.ID maps to nil. Unreachable blocks map to nil as well.
|
// f.Entry.ID maps to nil. Unreachable blocks map to nil as well.
|
||||||
func (f *Func) idom() []*Block {
|
func (f *Func) Idom() []*Block {
|
||||||
if f.cachedIdom == nil {
|
if f.cachedIdom == nil {
|
||||||
f.cachedIdom = dominators(f)
|
f.cachedIdom = dominators(f)
|
||||||
}
|
}
|
||||||
return f.cachedIdom
|
return f.cachedIdom
|
||||||
}
|
}
|
||||||
func (f *Func) Idom() []*Block {
|
|
||||||
return f.idom()
|
|
||||||
}
|
|
||||||
|
|
||||||
// sdom returns a sparse tree representing the dominator relationships
|
// sdom returns a sparse tree representing the dominator relationships
|
||||||
// among the blocks of f.
|
// among the blocks of f.
|
||||||
func (f *Func) sdom() SparseTree {
|
func (f *Func) sdom() SparseTree {
|
||||||
if f.cachedSdom == nil {
|
if f.cachedSdom == nil {
|
||||||
f.cachedSdom = newSparseTree(f, f.idom())
|
f.cachedSdom = newSparseTree(f, f.Idom())
|
||||||
}
|
}
|
||||||
return f.cachedSdom
|
return f.cachedSdom
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ type lcaRangeBlock struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeLCArange(f *Func) *lcaRange {
|
func makeLCArange(f *Func) *lcaRange {
|
||||||
dom := f.idom()
|
dom := f.Idom()
|
||||||
|
|
||||||
// Build tree
|
// Build tree
|
||||||
blocks := make([]lcaRangeBlock, f.NumBlocks())
|
blocks := make([]lcaRangeBlock, f.NumBlocks())
|
||||||
|
|
|
@ -463,7 +463,7 @@ func prove(f *Func) {
|
||||||
})
|
})
|
||||||
|
|
||||||
ft := newFactsTable()
|
ft := newFactsTable()
|
||||||
idom := f.idom()
|
idom := f.Idom()
|
||||||
sdom := f.sdom()
|
sdom := f.sdom()
|
||||||
|
|
||||||
// DFS on the dominator tree.
|
// DFS on the dominator tree.
|
||||||
|
|
|
@ -57,7 +57,7 @@ type SparseTreeHelper struct {
|
||||||
// NewSparseTreeHelper returns a SparseTreeHelper for use
|
// NewSparseTreeHelper returns a SparseTreeHelper for use
|
||||||
// in the gc package, for example in phi-function placement.
|
// in the gc package, for example in phi-function placement.
|
||||||
func NewSparseTreeHelper(f *Func) *SparseTreeHelper {
|
func NewSparseTreeHelper(f *Func) *SparseTreeHelper {
|
||||||
dom := f.idom()
|
dom := f.Idom()
|
||||||
ponums := make([]int32, f.NumBlocks())
|
ponums := make([]int32, f.NumBlocks())
|
||||||
po := postorderWithNumbering(f, ponums)
|
po := postorderWithNumbering(f, ponums)
|
||||||
return makeSparseTreeHelper(newSparseTree(f, dom), dom, po, ponums)
|
return makeSparseTreeHelper(newSparseTree(f, dom), dom, po, ponums)
|
||||||
|
|
|
@ -56,7 +56,7 @@ func tighten(f *Func) {
|
||||||
|
|
||||||
// Grab loop information.
|
// Grab loop information.
|
||||||
// We use this to make sure we don't tighten a value into a (deeper) loop.
|
// We use this to make sure we don't tighten a value into a (deeper) loop.
|
||||||
idom := f.idom()
|
idom := f.Idom()
|
||||||
loops := f.loopnest()
|
loops := f.loopnest()
|
||||||
loops.calculateDepths()
|
loops.calculateDepths()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue