diff options
author | Keith Randall <khr@golang.org> | 2015-05-28 16:45:33 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2015-05-30 06:08:26 +0000 |
commit | a9cec30fdcc549282e0a5d520edb2eaf60f3061a (patch) | |
tree | dbcd629c320607cb71e523e25e27349add3eed29 /src/cmd/compile/internal/ssa/block.go | |
parent | b0da62903d045f6d3e832ba1181387a1e9ad33f1 (diff) | |
download | go-a9cec30fdcc549282e0a5d520edb2eaf60f3061a.tar.gz go-a9cec30fdcc549282e0a5d520edb2eaf60f3061a.zip |
[dev.ssa] cmd/compile/internal/ssa: Implement block rewriting rules
Change-Id: I47e5349e34fc18118c4d35bf433f875b958cc3e5
Reviewed-on: https://go-review.googlesource.com/10495
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 | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/cmd/compile/internal/ssa/block.go b/src/cmd/compile/internal/ssa/block.go index dcf3676bc2..899d69bc32 100644 --- a/src/cmd/compile/internal/ssa/block.go +++ b/src/cmd/compile/internal/ssa/block.go @@ -48,27 +48,27 @@ type Block struct { // Plain nil [next] // If a boolean Value [then, else] // Call mem [nopanic, panic] (control opcode should be OpCall or OpStaticCall) -type BlockKind int8 +type BlockKind int32 +// block kind ranges const ( - BlockExit BlockKind = iota // 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 + 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 - BlockUnknown - - // 386/amd64 variants of BlockIf that take the flags register as an arg - BlockEQ - BlockNE - BlockLT - BlockLE - BlockGT - BlockGE - BlockULT - BlockULE - BlockUGT - BlockUGE ) //go:generate stringer -type=BlockKind |