1
0
mirror of https://github.com/golang/go synced 2024-11-23 04:00:03 -07:00

cmd/compile/internal/ssa: wire up late lower block function

Currently, the lowerBlock function is reused with lateLowerValue, meaning
that any block rewriting rules in the late lower pass are silently ignored.
Change the late lower pass to actually use the lateLowerBlock function with
the lateLowerValue function.

Change-Id: Iaac1c2955bb27078378cac50cde3716e79a7d9f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/444335
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Joel Sing 2022-10-19 15:53:43 +11:00
parent 3e6ca3a506
commit c0f27eb3d5
2 changed files with 8 additions and 4 deletions

View File

@ -21,9 +21,10 @@ type Config struct {
PtrSize int64 // 4 or 8; copy of cmd/internal/sys.Arch.PtrSize
RegSize int64 // 4 or 8; copy of cmd/internal/sys.Arch.RegSize
Types Types
lowerBlock blockRewriter // lowering function
lowerValue valueRewriter // lowering function, first round
lateLowerValue valueRewriter // lowering function that needs to be run after the first round of lower function; only used on some architectures
lowerBlock blockRewriter // block lowering function, first round
lowerValue valueRewriter // value lowering function, first round
lateLowerBlock blockRewriter // block lowering function that needs to be run after the first round; only used on some architectures
lateLowerValue valueRewriter // value lowering function that needs to be run after the first round; only used on some architectures
splitLoad valueRewriter // function for splitting merged load ops; only used on some architectures
registers []Register // machine registers
gpRegMask regMask // general purpose integer register mask
@ -185,6 +186,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
c.RegSize = 8
c.lowerBlock = rewriteBlockAMD64
c.lowerValue = rewriteValueAMD64
c.lateLowerBlock = rewriteBlockAMD64latelower
c.lateLowerValue = rewriteValueAMD64latelower
c.splitLoad = rewriteValueAMD64splitload
c.registers = registersAMD64[:]
@ -224,6 +226,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
c.RegSize = 8
c.lowerBlock = rewriteBlockARM64
c.lowerValue = rewriteValueARM64
c.lateLowerBlock = rewriteBlockARM64latelower
c.lateLowerValue = rewriteValueARM64latelower
c.registers = registersARM64[:]
c.gpRegMask = gpRegMaskARM64
@ -310,6 +313,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
c.RegSize = 8
c.lowerBlock = rewriteBlockRISCV64
c.lowerValue = rewriteValueRISCV64
c.lateLowerBlock = rewriteBlockRISCV64latelower
c.lateLowerValue = rewriteValueRISCV64latelower
c.registers = registersRISCV64[:]
c.gpRegMask = gpRegMaskRISCV64

View File

@ -14,7 +14,7 @@ func lower(f *Func) {
func lateLower(f *Func) {
// repeat rewrites until we find no more rewrites
if f.Config.lateLowerValue != nil {
applyRewrite(f, f.Config.lowerBlock, f.Config.lateLowerValue, removeDeadValues)
applyRewrite(f, f.Config.lateLowerBlock, f.Config.lateLowerValue, removeDeadValues)
}
}