1
0
mirror of https://github.com/golang/go synced 2024-10-05 16:41:21 -06:00

[dev.ssa] cmd/compile: everything is live and reachable after regalloc

This CL makes function printing and HTML generation
accurate after regalloc.

Prior to this CL, text and HTML function outputs
showed live values and blocks as dead.

Change-Id: I70669cd8641af841447fc5d2ecbd754b281356f0
Reviewed-on: https://go-review.googlesource.com/13812
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2015-08-21 10:15:15 -07:00
parent 8f51ae8ba5
commit 7393c24877

View File

@ -6,6 +6,20 @@ package ssa
// findlive returns the reachable blocks and live values in f.
func findlive(f *Func) (reachable []bool, live []bool) {
// After regalloc, consider all blocks and values to be reachable and live.
// See the comment at the top of regalloc.go and in deadcode for details.
if f.RegAlloc != nil {
reachable = make([]bool, f.NumBlocks())
for i := range reachable {
reachable[i] = true
}
live = make([]bool, f.NumValues())
for i := range live {
live[i] = true
}
return reachable, live
}
// Find all reachable basic blocks.
reachable = make([]bool, f.NumBlocks())
reachable[f.Entry.ID] = true