diff options
author | Keith Randall <khr@golang.org> | 2015-06-06 16:03:33 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2015-06-08 21:02:03 +0000 |
commit | 0dca7351e9d51bdaf980e1256ec41af8cb1b9747 (patch) | |
tree | 82553209d0f920fa55e54bc6a066c96c749ea3df /src/cmd/compile/internal/ssa/block.go | |
parent | 6241a41e33fb1dcfb36f86b0578592219a36d443 (diff) | |
download | go-0dca7351e9d51bdaf980e1256ec41af8cb1b9747.tar.gz go-0dca7351e9d51bdaf980e1256ec41af8cb1b9747.zip |
[dev.ssa] cmd/compile/internal/ssa: autogenerate opcodes
Revamp autogeneration. Get rid of gogenerate commands, they are more
trouble than they are worth. (If the code won't compile, gogenerate
doesn't work.)
Generate opcode enums & tables. This means we only have to specify
opcodes in one place instead of two.
Add arch prefixes to opcodes so they will be globally unique.
Change-Id: I175d0a89b701b2377bbe699f3756731b7c9f5a9f
Reviewed-on: https://go-review.googlesource.com/10812
Reviewed-by: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/block.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/block.go | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/src/cmd/compile/internal/ssa/block.go b/src/cmd/compile/internal/ssa/block.go index 899d69bc32..85d73bb9b8 100644 --- a/src/cmd/compile/internal/ssa/block.go +++ b/src/cmd/compile/internal/ssa/block.go @@ -4,10 +4,7 @@ package ssa -import ( - "fmt" - "strings" -) +import "fmt" // Block represents a basic block in the control flow graph of a function. type Block struct { @@ -50,29 +47,6 @@ type Block struct { // Call mem [nopanic, panic] (control opcode should be OpCall or OpStaticCall) type BlockKind int32 -// block kind ranges -const ( - blockInvalid BlockKind = 0 - blockGenericBase = 1 + 100*iota - blockAMD64Base - block386Base - - blockMax // sentinel -) - -// generic block kinds -const ( - blockGenericStart BlockKind = blockGenericBase + iota - - BlockExit // no successors. There should only be 1 of these. - BlockPlain // a single successor - BlockIf // 2 successors, if control goto Succs[0] else goto Succs[1] - BlockCall // 2 successors, normal return and panic - // TODO(khr): BlockPanic for the built-in panic call, has 1 edge to the exit block -) - -//go:generate stringer -type=BlockKind - // short form print func (b *Block) String() string { return fmt.Sprintf("b%d", b.ID) @@ -80,7 +54,7 @@ func (b *Block) String() string { // long form print func (b *Block) LongString() string { - s := strings.TrimPrefix(b.Kind.String(), "Block") + s := b.Kind.String() if b.Control != nil { s += fmt.Sprintf(" %s", b.Control) } |