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>
Mostly suggested by Alan.
Convert Const* ops to just one Const op.
Use more of go/types.
Get rid of typers, all types must be specified explicitly.
Change-Id: Id4758f2b887d8a6888e88a7e047d97af55e34b62
Reviewed-on: https://go-review.googlesource.com/8110
Reviewed-by: Alan Donovan <adonovan@google.com>
opt: machine-independent optimization
fuse: join basic blocks
lower: convert to machine-dependent opcodes
critical: remove critical edges for register alloc
layout: order basic blocks
schedule: order values in basic blocks
cgen: generate assembly output
opt and lower use machine-generated matching rules using
the rule generator in rulegen/
cgen will probably change in the real compiler, as we want to
generate binary directly instead of ascii assembly.
Change-Id: Iedd7ca70f6f55a4cde30e27cfad6a7fa05691b83
Reviewed-on: https://go-review.googlesource.com/7981
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
First pass adding code for SSA backend. It is standalone for now.
I've included just a few passes to make the review size manageable -
I have more passes coming.
cmd/internal/ssa is the library containing the ssa compiler proper.
cmd/internal/ssa/ssac is a driver that loads an sexpr-based IR,
converts it to SSA form, and calls the above library. It is essentially
throwaway code - it will disappear once the Go compiler calls
cmd/internal/ssa itself. The .goir files in ssac/ are dumps of fibonacci
programs I made from a hacked-up compiler. They are just for testing.
Change-Id: I5ee89356ec12c87cd916681097cd3c2cd591040c
Reviewed-on: https://go-review.googlesource.com/6681
Reviewed-by: Alan Donovan <adonovan@google.com>