Commit c5368123 authored by Hajime Hoshi's avatar Hajime Hoshi Committed by Matthew Dempsky

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: default avatarMatthew Dempsky <mdempsky@google.com>
parent f1eed92f
...@@ -451,23 +451,20 @@ func (f *Func) postorder() []*Block { ...@@ -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 { ...@@ -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) { ...@@ -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 { ...@@ -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) { ...@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment