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/rewritedec.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/rewritedec.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/rewritedec.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/cmd/compile/internal/ssa/rewritedec.go b/src/cmd/compile/internal/ssa/rewritedec.go index 7040abbec0..7f6f8c7b88 100644 --- a/src/cmd/compile/internal/ssa/rewritedec.go +++ b/src/cmd/compile/internal/ssa/rewritedec.go @@ -116,13 +116,13 @@ func rewriteValuedec_OpLoad_0(v *Value) bool { types := &b.Func.Config.Types _ = types // match: (Load <t> ptr mem) - // cond: t.IsComplex() && t.Size() == 8 + // cond: t.IsComplex() && t.MustSize() == 8 // result: (ComplexMake (Load <types.Float32> ptr mem) (Load <types.Float32> (OffPtr <types.Float32Ptr> [4] ptr) mem) ) for { t := v.Type ptr := v.Args[0] mem := v.Args[1] - if !(t.IsComplex() && t.Size() == 8) { + if !(t.IsComplex() && t.MustSize() == 8) { break } v.reset(OpComplexMake) @@ -140,13 +140,13 @@ func rewriteValuedec_OpLoad_0(v *Value) bool { return true } // match: (Load <t> ptr mem) - // cond: t.IsComplex() && t.Size() == 16 + // cond: t.IsComplex() && t.MustSize() == 16 // result: (ComplexMake (Load <types.Float64> ptr mem) (Load <types.Float64> (OffPtr <types.Float64Ptr> [8] ptr) mem) ) for { t := v.Type ptr := v.Args[0] mem := v.Args[1] - if !(t.IsComplex() && t.Size() == 16) { + if !(t.IsComplex() && t.MustSize() == 16) { break } v.reset(OpComplexMake) @@ -303,7 +303,7 @@ func rewriteValuedec_OpStore_0(v *Value) bool { types := &b.Func.Config.Types _ = types // match: (Store {t} dst (ComplexMake real imag) mem) - // cond: t.(Type).Size() == 8 + // cond: t.(Type).MustSize() == 8 // result: (Store {types.Float32} (OffPtr <types.Float32Ptr> [4] dst) imag (Store {types.Float32} dst real mem)) for { t := v.Aux @@ -315,7 +315,7 @@ func rewriteValuedec_OpStore_0(v *Value) bool { real := v_1.Args[0] imag := v_1.Args[1] mem := v.Args[2] - if !(t.(Type).Size() == 8) { + if !(t.(Type).MustSize() == 8) { break } v.reset(OpStore) @@ -334,7 +334,7 @@ func rewriteValuedec_OpStore_0(v *Value) bool { return true } // match: (Store {t} dst (ComplexMake real imag) mem) - // cond: t.(Type).Size() == 16 + // cond: t.(Type).MustSize() == 16 // result: (Store {types.Float64} (OffPtr <types.Float64Ptr> [8] dst) imag (Store {types.Float64} dst real mem)) for { t := v.Aux @@ -346,7 +346,7 @@ func rewriteValuedec_OpStore_0(v *Value) bool { real := v_1.Args[0] imag := v_1.Args[1] mem := v.Args[2] - if !(t.(Type).Size() == 16) { + if !(t.(Type).MustSize() == 16) { break } v.reset(OpStore) |