1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:55:01 -07: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:
Hajime Hoshi 2016-10-09 01:09:52 +09:00 committed by Matthew Dempsky
parent f1eed92fd0
commit c5368123fe
5 changed files with 7 additions and 10 deletions

View File

@ -451,23 +451,20 @@ func (f *Func) postorder() []*Block {
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.
func (f *Func) idom() []*Block {
func (f *Func) Idom() []*Block {
if f.cachedIdom == nil {
f.cachedIdom = dominators(f)
}
return f.cachedIdom
}
func (f *Func) Idom() []*Block {
return f.idom()
}
// sdom returns a sparse tree representing the dominator relationships
// among the blocks of f.
func (f *Func) sdom() SparseTree {
if f.cachedSdom == nil {
f.cachedSdom = newSparseTree(f, f.idom())
f.cachedSdom = newSparseTree(f, f.Idom())
}
return f.cachedSdom
}

View File

@ -30,7 +30,7 @@ type lcaRangeBlock struct {
}
func makeLCArange(f *Func) *lcaRange {
dom := f.idom()
dom := f.Idom()
// Build tree
blocks := make([]lcaRangeBlock, f.NumBlocks())

View File

@ -463,7 +463,7 @@ func prove(f *Func) {
})
ft := newFactsTable()
idom := f.idom()
idom := f.Idom()
sdom := f.sdom()
// DFS on the dominator tree.

View File

@ -57,7 +57,7 @@ type SparseTreeHelper struct {
// NewSparseTreeHelper returns a SparseTreeHelper for use
// in the gc package, for example in phi-function placement.
func NewSparseTreeHelper(f *Func) *SparseTreeHelper {
dom := f.idom()
dom := f.Idom()
ponums := make([]int32, f.NumBlocks())
po := postorderWithNumbering(f, ponums)
return makeSparseTreeHelper(newSparseTree(f, dom), dom, po, ponums)

View File

@ -56,7 +56,7 @@ func tighten(f *Func) {
// Grab loop information.
// 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.calculateDepths()