Commit graph

3 commits

Author SHA1 Message Date
Keith Randall
d2fd43aa77 [dev.ssa] cmd/internal/gc: convert standard IR into SSA.
Hook into the current compiler to convert the existing
IR (after walk) into SSA.  Any function ending in "_ssa"
will take this path.  The resulting assembly is printed
and then discarded.

Use gc.Type directly in ssa instead of a wrapper for go types.
It makes the IR->SSA rewrite a lot simpler.

Only a few opcodes are implemented in this change.  It is
enough to compile simple examples like
    func f(p *int) int { return *p }
    func g(a []int, i int) int { return a[i] }

Change-Id: I5e18841b752a83ca0519aa1b2d36ef02ce1de6f9
Reviewed-on: https://go-review.googlesource.com/8971
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-04-16 22:31:05 +00:00
Keith Randall
412944484c [dev.ssa] cmd/internal/ssa: fix typo
Change-Id: I2209da94f1fd76267847d8d599e17f9d9a296ed3
Reviewed-on: https://go-review.googlesource.com/8320
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-03-31 23:31:17 +00:00
Keith Randall
149671dfc3 [dev.ssa] cmd/internal/ssa: add CSE pass
Implement a simple common-subexpression elimination.
It uses value numbering & a dominator tree to detect redundant computation.

Change-Id: Id0ff775e439c22f4d41bdd5976176017dd2a2086
Reviewed-on: https://go-review.googlesource.com/8172
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-03-31 21:51:15 +00:00