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
|
|
@ -487,12 +487,14 @@ func wbcall(pos src.XPos, b *Block, fn, typ *obj.LSym, ptr, val, mem, sp, sb *Va
|
|||
off := config.ctxt.FixedFrameSize()
|
||||
|
||||
var ACArgs []Param
|
||||
var argTypes []*types.Type
|
||||
if typ != nil { // for typedmemmove
|
||||
taddr := b.NewValue1A(pos, OpAddr, b.Func.Config.Types.Uintptr, typ, sb)
|
||||
off = round(off, taddr.Type.Alignment())
|
||||
arg := b.NewValue1I(pos, OpOffPtr, taddr.Type.PtrTo(), off, sp)
|
||||
mem = b.NewValue3A(pos, OpStore, types.TypeMem, ptr.Type, arg, taddr, mem)
|
||||
ACArgs = append(ACArgs, Param{Type: b.Func.Config.Types.Uintptr, Offset: int32(off)})
|
||||
argTypes = append(argTypes, b.Func.Config.Types.Uintptr)
|
||||
off += taddr.Type.Size()
|
||||
}
|
||||
|
||||
|
|
@ -500,6 +502,7 @@ func wbcall(pos src.XPos, b *Block, fn, typ *obj.LSym, ptr, val, mem, sp, sb *Va
|
|||
arg := b.NewValue1I(pos, OpOffPtr, ptr.Type.PtrTo(), off, sp)
|
||||
mem = b.NewValue3A(pos, OpStore, types.TypeMem, ptr.Type, arg, ptr, mem)
|
||||
ACArgs = append(ACArgs, Param{Type: ptr.Type, Offset: int32(off)})
|
||||
argTypes = append(argTypes, ptr.Type)
|
||||
off += ptr.Type.Size()
|
||||
|
||||
if val != nil {
|
||||
|
|
@ -507,15 +510,15 @@ func wbcall(pos src.XPos, b *Block, fn, typ *obj.LSym, ptr, val, mem, sp, sb *Va
|
|||
arg = b.NewValue1I(pos, OpOffPtr, val.Type.PtrTo(), off, sp)
|
||||
mem = b.NewValue3A(pos, OpStore, types.TypeMem, val.Type, arg, val, mem)
|
||||
ACArgs = append(ACArgs, Param{Type: val.Type, Offset: int32(off)})
|
||||
argTypes = append(argTypes, val.Type)
|
||||
off += val.Type.Size()
|
||||
}
|
||||
off = round(off, config.PtrSize)
|
||||
|
||||
// issue call
|
||||
// TODO(register args) -- will need more details
|
||||
mem = b.NewValue1A(pos, OpStaticCall, types.TypeMem, StaticAuxCall(fn, ACArgs, nil, nil), mem)
|
||||
mem = b.NewValue1A(pos, OpStaticCall, types.TypeResultMem, StaticAuxCall(fn, ACArgs, nil, b.Func.ABIDefault.ABIAnalyzeTypes(nil, argTypes, nil)), mem)
|
||||
mem.AuxInt = off - config.ctxt.FixedFrameSize()
|
||||
return mem
|
||||
return b.NewValue1I(pos, OpSelectN, types.TypeMem, 0, mem)
|
||||
}
|
||||
|
||||
// round to a multiple of r, r is a power of 2
|
||||
|
|
@ -563,12 +566,20 @@ func IsReadOnlyGlobalAddr(v *Value) bool {
|
|||
|
||||
// IsNewObject reports whether v is a pointer to a freshly allocated & zeroed object at memory state mem.
|
||||
func IsNewObject(v *Value, mem *Value) bool {
|
||||
// TODO this will need updating for register args; the OpLoad is wrong.
|
||||
if v.Op != OpLoad {
|
||||
return false
|
||||
}
|
||||
if v.MemoryArg() != mem {
|
||||
return false
|
||||
}
|
||||
if mem.Op != OpSelectN {
|
||||
return false
|
||||
}
|
||||
if mem.Type != types.TypeMem {
|
||||
return false
|
||||
} // assume it is the right selection if true
|
||||
mem = mem.Args[0]
|
||||
if mem.Op != OpStaticCall {
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue