[dev.ssa] cmd/compile: initial implementation of likely direction

Change-Id: Id8457b18c07bf717d13c9423d8f314f253eee64f
Reviewed-on: https://go-review.googlesource.com/13580
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2015-08-11 17:28:56 -07:00
parent 212a1763fc
commit bbf8c5ce2f
7 changed files with 84 additions and 8 deletions

View file

@ -47,7 +47,21 @@ blockloop:
// Pick the next block to schedule
// Pick among the successor blocks that have not been scheduled yet.
// Just use degree for now. TODO(khr): use likely direction hints.
// Use likely direction if we have it.
var likely *Block
switch b.Likely {
case BranchLikely:
likely = b.Succs[0]
case BranchUnlikely:
likely = b.Succs[1]
}
if likely != nil && !scheduled[likely.ID] {
bid = likely.ID
continue
}
// Use degree for now.
bid = 0
mindegree := f.NumBlocks()
for _, c := range order[len(order)-1].Succs {