[dev.ssa] cmd/compile: add HTML SSA printer

This is an initial implementation.
There are many rough edges and TODOs,
which will hopefully be polished out
with use.

Fixes #12071.

Change-Id: I1d6fd5a343063b5200623bceef2c2cfcc885794e
Reviewed-on: https://go-review.googlesource.com/13472
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2015-08-10 12:15:52 -07:00
parent 3e7904b648
commit 35fb514596
7 changed files with 607 additions and 45 deletions

View file

@ -11,6 +11,7 @@ type Config struct {
lowerBlock func(*Block) bool // lowering function
lowerValue func(*Value, *Config) bool // lowering function
fe Frontend // callbacks into compiler frontend
HTML *HTMLWriter // html writer, for debugging
// TODO: more stuff. Compiler flags of interest, ...
}
@ -31,12 +32,7 @@ type TypeSource interface {
TypeBytePtr() Type // TODO: use unsafe.Pointer instead?
}
type Frontend interface {
TypeSource
// StringData returns a symbol pointing to the given string's contents.
StringData(string) interface{} // returns *gc.Sym
type Logger interface {
// Log logs a message from the compiler.
Logf(string, ...interface{})
@ -48,6 +44,14 @@ type Frontend interface {
Unimplementedf(msg string, args ...interface{})
}
type Frontend interface {
TypeSource
Logger
// StringData returns a symbol pointing to the given string's contents.
StringData(string) interface{} // returns *gc.Sym
}
// NewConfig returns a new configuration object for the given architecture.
func NewConfig(arch string, fe Frontend) *Config {
c := &Config{arch: arch, fe: fe}