I have not studied the large algorithm sections. Overall the code looks
pretty clean.
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/blockopt.go
File src/pkg/exp/ssa/blockopt.go (right):
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/blockopt.go#newcode18
src/pkg/exp/ssa/blockopt.go:18: // markReachable set Index=-1 for all
blocks reachable from b.
s/set/sets/
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/blockopt.go#newcode31
src/pkg/exp/ssa/blockopt.go:31: func collectUnreachable(f *Function) {
s/collectUnreachable/eliminateUnreachable/
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/blockopt.go#newcode32
src/pkg/exp/ssa/blockopt.go:32: // We use b.Index as the mark bit: 0
means white, -1 means black.
perhaps
const white = 0
const black = -1
why use comments when you can express it in code
btw. , wouldn't used/unused be better than black/white?
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/blockopt.go#newcode51
src/pkg/exp/ssa/blockopt.go:51: for i, b := range f.Blocks {
any reason for not compressing f.Blocks now? (remove the nil entries)
You're doing most of the work anyway. It's fine if you still want to be
able to deal with nil entries elsewhere.
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/blockopt.go#newcode102
src/pkg/exp/ssa/blockopt.go:102: f.Blocks[b.Index] = nil // delete b
make deleteBlock a method of f? - Then you don't need the comment.
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/blockopt.go#newcode136
src/pkg/exp/ssa/blockopt.go:136: f.Blocks[b.Index] = nil // delete b
dito
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/blockopt.go#newcode146
src/pkg/exp/ssa/blockopt.go:146: collectUnreachable(f)
better name and you don't need the comment
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/blockopt.go#newcode178
src/pkg/exp/ssa/blockopt.go:178: // Eliminate nils from Blocks and
update Index.
The re-indexing and elimination of nil entries happens again here.
Definitively should be factored out.
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/doc.go
File src/pkg/exp/ssa/doc.go (right):
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/doc.go#newcode37
src/pkg/exp/ssa/doc.go:37: // called "lifting", to improve the accuracy
and performance of
the comma here seems odd to me. remove and replace ; on text line with
period?
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/dom.go
File src/pkg/exp/ssa/dom.go (right):
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/dom.go#newcode11
src/pkg/exp/ssa/dom.go:11: // We also apply the optimisations to SLT
described in Georgiadis et
optimizations ?
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/dom.go#newcode26
src/pkg/exp/ssa/dom.go:26: type domTree struct {
why not domNode ?
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/dom.go#newcode228
src/pkg/exp/ssa/dom.go:228: for changed {
for changed := true; changed; {
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/dom.go#newcode262
src/pkg/exp/ssa/dom.go:262: panic("sanityCheckDomTree failed for " +
f.FullName())
another use for panicf
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/dom.go#newcode276
src/pkg/exp/ssa/dom.go:276: // printDomTreeDot prints the dominator tree
of f in AT&T GraphViz format.
wow, really? why not dot format? how much is it different?
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/func.go
File src/pkg/exp/ssa/func.go (right):
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/func.go#newcode44
src/pkg/exp/ssa/func.go:44: panic(fmt.Sprintf("no edge %s -> %s", c, b))
if you have more of these (seems useful), consider defining panicf.
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/func.go#newcode241
src/pkg/exp/ssa/func.go:241: // (value-defining Instructions) in f, to
aid deubgging.
debugging
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/func.go#newcode546
src/pkg/exp/ssa/func.go:546: // emit. comment is an optional string to
improve readability.
s/to improve readability/for more readable debugging output/.
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/lift.go
File src/pkg/exp/ssa/lift.go (right):
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/lift.go#newcode151
src/pkg/exp/ssa/lift.go:151: // During this pass we will replace deleted
some
replace deleted some ... ? (sentence)
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/lift.go#newcode256
src/pkg/exp/ssa/lift.go:256: // take removes an arbitrary element from a
set s and
the algorithm doesn't remove an arbitrary element, though
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/lift.go#newcode399
src/pkg/exp/ssa/lift.go:399: // constructing it lazily if it's the
implicit zero initialization.
double blank
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/sanity.go
File src/pkg/exp/ssa/sanity.go (right):
https://codereview.appspot.com/7229074/diff/11002/src/pkg/exp/ssa/sanity.go#newcode301
src/pkg/exp/ssa/sanity.go:301: // they were "optimised" away, even the
entry block.
optimized ?
https://codereview.appspot.com/7229074/
--
---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.