diff options
author | Josh Bleecher Snyder <josharian@gmail.com> | 2017-04-27 15:30:31 -0700 |
---|---|---|
committer | Josh Bleecher Snyder <josharian@gmail.com> | 2017-04-27 22:57:57 +0000 |
commit | 94d540a4b6bf68ec472bf4469037955e3133fcf7 (patch) | |
tree | 856e77f96d70a7873f86b23684bf8417a7b2cf64 /src/cmd/compile/internal/ssa/phiopt.go | |
parent | 0b6a10ef246ff55085d6ec88f68f5fd96677b141 (diff) | |
download | go-94d540a4b6bf68ec472bf4469037955e3133fcf7.tar.gz go-94d540a4b6bf68ec472bf4469037955e3133fcf7.zip |
cmd/compile: add Type.MustSize and Type.MustAlignment
Type.Size and Type.Alignment are for the front end:
They calculate size and alignment if needed.
Type.MustSize and Type.MustAlignment are for the back end:
They call Fatal if size and alignment are not already calculated.
Most uses are of MustSize and MustAlignment,
but that's because the back end is newer,
and this API was added to support it.
This CL was mostly generated with sed and selective reversion.
The only mildly interesting bit is the change of the ssa.Type interface
and the supporting ssa dummy types.
Follow-up to review feedback on CL 41970.
Passes toolstash-check.
Change-Id: I0d9b9505e57453dae8fb6a236a07a7a02abd459e
Reviewed-on: https://go-review.googlesource.com/42016
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/phiopt.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/phiopt.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/ssa/phiopt.go b/src/cmd/compile/internal/ssa/phiopt.go index 60c8e58bd2..23ca779350 100644 --- a/src/cmd/compile/internal/ssa/phiopt.go +++ b/src/cmd/compile/internal/ssa/phiopt.go @@ -148,7 +148,7 @@ func phioptint(v *Value, b0 *Block, reverse int) { negate = !negate } - switch v.Type.Size() { + switch v.Type.MustSize() { case 1: v.reset(OpCopy) case 2: @@ -158,7 +158,7 @@ func phioptint(v *Value, b0 *Block, reverse int) { case 8: v.reset(OpZeroExt8to64) default: - v.Fatalf("bad int size %d", v.Type.Size()) + v.Fatalf("bad int size %d", v.Type.MustSize()) } a := b0.Control @@ -169,6 +169,6 @@ func phioptint(v *Value, b0 *Block, reverse int) { f := b0.Func if f.pass.debug > 0 { - f.Warnl(v.Block.Pos, "converted OpPhi bool -> int%d", v.Type.Size()*8) + f.Warnl(v.Block.Pos, "converted OpPhi bool -> int%d", v.Type.MustSize()*8) } } |