mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: change StaticCall to return a "Results"
StaticLECall (multiple value in +mem, multiple value result +mem) -> StaticCall (multiple ergister value in +mem, multiple register-sized-value result +mem) -> ARCH CallStatic (multiple ergister value in +mem, multiple register-sized-value result +mem) But the architecture-dependent stuff is indifferent to whether it is mem->mem or (mem)->(mem) until Prog generation. Deal with OpSelectN -> Prog in ssagen/ssa.go, others, as they appear. For #40724. Change-Id: I1d0436f6371054f1881862641d8e7e418e4a6a16 Reviewed-on: https://go-review.googlesource.com/c/go/+/293391 Trust: David Chase <drchase@google.com> Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
9a555fc24c
commit
e25040d162
18 changed files with 387 additions and 382 deletions
|
|
@ -761,6 +761,9 @@ func (s *regAllocState) advanceUses(v *Value) {
|
|||
// current instruction.
|
||||
func (s *regAllocState) liveAfterCurrentInstruction(v *Value) bool {
|
||||
u := s.values[v.ID].uses
|
||||
if u == nil {
|
||||
panic(fmt.Errorf("u is nil, v = %s, s.values[v.ID] = %v", v.LongString(), s.values[v.ID]))
|
||||
}
|
||||
d := u.dist
|
||||
for u != nil && u.dist == d {
|
||||
u = u.next
|
||||
|
|
@ -1208,13 +1211,17 @@ func (s *regAllocState) regalloc(f *Func) {
|
|||
s.sb = v.ID
|
||||
continue
|
||||
}
|
||||
if v.Op == OpSelect0 || v.Op == OpSelect1 {
|
||||
if v.Op == OpSelect0 || v.Op == OpSelect1 || v.Op == OpSelectN {
|
||||
if s.values[v.ID].needReg {
|
||||
var i = 0
|
||||
if v.Op == OpSelect1 {
|
||||
i = 1
|
||||
if v.Op == OpSelectN {
|
||||
s.assignReg(register(s.f.getHome(v.Args[0].ID).(LocResults)[int(v.AuxInt)].(*Register).num), v, v)
|
||||
} else {
|
||||
var i = 0
|
||||
if v.Op == OpSelect1 {
|
||||
i = 1
|
||||
}
|
||||
s.assignReg(register(s.f.getHome(v.Args[0].ID).(LocPair)[i].(*Register).num), v, v)
|
||||
}
|
||||
s.assignReg(register(s.f.getHome(v.Args[0].ID).(LocPair)[i].(*Register).num), v, v)
|
||||
}
|
||||
b.Values = append(b.Values, v)
|
||||
s.advanceUses(v)
|
||||
|
|
@ -1767,6 +1774,9 @@ func (s *regAllocState) placeSpills() {
|
|||
// put the spill of v. At the start "best" is the best place
|
||||
// we have found so far.
|
||||
// TODO: find a way to make this O(1) without arbitrary cutoffs.
|
||||
if v == nil {
|
||||
panic(fmt.Errorf("nil v, s.orig[%d], vi = %v, spill = %s", i, vi, spill.LongString()))
|
||||
}
|
||||
best := v.Block
|
||||
bestArg := v
|
||||
var bestDepth int16
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue