aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/layout.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2015-08-11 17:28:56 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2015-08-12 22:03:08 +0000
commitbbf8c5ce2ffc7085bc63e2edf0117adaccada53e (patch)
tree9115daa4dfe86c54975d8b54f5fe58a768fa0afa /src/cmd/compile/internal/ssa/layout.go
parent212a1763fc7d0cf17ae9e27680dcb3e346d1c71b (diff)
downloadgo-bbf8c5ce2ffc7085bc63e2edf0117adaccada53e.tar.gz
go-bbf8c5ce2ffc7085bc63e2edf0117adaccada53e.zip
[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>
Diffstat (limited to 'src/cmd/compile/internal/ssa/layout.go')
-rw-r--r--src/cmd/compile/internal/ssa/layout.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/ssa/layout.go b/src/cmd/compile/internal/ssa/layout.go
index c2d72267b1..7e865f948e 100644
--- a/src/cmd/compile/internal/ssa/layout.go
+++ b/src/cmd/compile/internal/ssa/layout.go
@@ -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 {