1
0
mirror of https://github.com/golang/go synced 2024-11-26 05:07:59 -07:00

cmd/compile: remove now-redundant AuxCall.args

Cleanup, ABI information subsumes this.

Updates #40724

Change-Id: I6c69da44380f7b0d159b22acacbd68dc000e4725
Reviewed-on: https://go-review.googlesource.com/c/go/+/303432
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
David Chase 2021-03-19 15:21:14 -04:00
parent 196c33e92d
commit a93849b9e2
5 changed files with 14 additions and 30 deletions

View File

@ -247,7 +247,7 @@ func insertLoopReschedChecks(f *Func) {
// goto header
resched := f.fe.Syslook("goschedguarded")
// TODO(register args) -- will need more details
mem1 := sched.NewValue1A(bb.Pos, OpStaticCall, types.TypeMem, StaticAuxCall(resched, nil, nil, nil), mem0)
mem1 := sched.NewValue1A(bb.Pos, OpStaticCall, types.TypeMem, StaticAuxCall(resched, nil, nil), mem0)
sched.AddEdgeTo(h)
headerMemPhi.AddArg(mem1)

View File

@ -112,7 +112,6 @@ func (a *AuxNameOffset) String() string {
type AuxCall struct {
// TODO(register args) this information is largely redundant with ../abi information, needs cleanup once new ABI is in place.
Fn *obj.LSym
args []Param // Includes receiver for method calls. Does NOT include hidden closure pointer.
results []Param
reg *regInfo // regInfo for this call // TODO for now nil means ignore
abiInfo *abi.ABIParamResultInfo // TODO remove fields above redundant with this information.
@ -285,17 +284,6 @@ func (a *AuxCall) String() string {
fn = fmt.Sprintf("AuxCall{%v", a.Fn)
}
if len(a.args) == 0 {
fn += "()"
} else {
s := "("
for _, arg := range a.args {
fn += fmt.Sprintf("%s[%v,%v]", s, arg.Type, arg.Offset)
s = ","
}
fn += ")"
}
if len(a.results) > 0 { // usual is zero or one; only some RT calls have more than one.
if len(a.results) == 1 {
fn += fmt.Sprintf("[%v,%v]", a.results[0].Type, a.results[0].Offset)
@ -323,7 +311,7 @@ func ACParamsToTypes(ps []Param) (ts []*types.Type) {
}
// StaticAuxCall returns an AuxCall for a static call.
func StaticAuxCall(sym *obj.LSym, args []Param, results []Param, paramResultInfo *abi.ABIParamResultInfo) *AuxCall {
func StaticAuxCall(sym *obj.LSym, results []Param, paramResultInfo *abi.ABIParamResultInfo) *AuxCall {
if paramResultInfo == nil {
panic(fmt.Errorf("Nil paramResultInfo, sym=%v", sym))
}
@ -331,7 +319,7 @@ func StaticAuxCall(sym *obj.LSym, args []Param, results []Param, paramResultInfo
if paramResultInfo.InRegistersUsed()+paramResultInfo.OutRegistersUsed() > 0 {
reg = &regInfo{}
}
return &AuxCall{Fn: sym, args: args, results: results, abiInfo: paramResultInfo, reg: reg}
return &AuxCall{Fn: sym, results: results, abiInfo: paramResultInfo, reg: reg}
}
// InterfaceAuxCall returns an AuxCall for an interface call.
@ -340,7 +328,7 @@ func InterfaceAuxCall(args []Param, results []Param, paramResultInfo *abi.ABIPar
if paramResultInfo.InRegistersUsed()+paramResultInfo.OutRegistersUsed() > 0 {
reg = &regInfo{}
}
return &AuxCall{Fn: nil, args: args, results: results, abiInfo: paramResultInfo, reg: reg}
return &AuxCall{Fn: nil, results: results, abiInfo: paramResultInfo, reg: reg}
}
// ClosureAuxCall returns an AuxCall for a closure call.
@ -349,7 +337,7 @@ func ClosureAuxCall(args []Param, results []Param, paramResultInfo *abi.ABIParam
if paramResultInfo.InRegistersUsed()+paramResultInfo.OutRegistersUsed() > 0 {
reg = &regInfo{}
}
return &AuxCall{Fn: nil, args: args, results: results, abiInfo: paramResultInfo, reg: reg}
return &AuxCall{Fn: nil, results: results, abiInfo: paramResultInfo, reg: reg}
}
func (*AuxCall) CanBeAnSSAAux() {}
@ -361,7 +349,7 @@ func OwnAuxCall(fn *obj.LSym, args []Param, results []Param, paramResultInfo *ab
if paramResultInfo.InRegistersUsed()+paramResultInfo.OutRegistersUsed() > 0 {
reg = &regInfo{}
}
return &AuxCall{Fn: fn, args: args, results: results, abiInfo: paramResultInfo, reg: reg}
return &AuxCall{Fn: fn, results: results, abiInfo: paramResultInfo, reg: reg}
}
const (

View File

@ -765,7 +765,7 @@ func devirt(v *Value, aux Aux, sym Sym, offset int64) *AuxCall {
return nil
}
va := aux.(*AuxCall)
return StaticAuxCall(lsym, va.args, va.results, va.abiInfo)
return StaticAuxCall(lsym, va.results, va.abiInfo)
}
// de-virtualize an InterLECall

View File

@ -516,7 +516,7 @@ func wbcall(pos src.XPos, b *Block, fn, typ *obj.LSym, ptr, val, mem, sp, sb *Va
off = round(off, config.PtrSize)
// issue call
mem = b.NewValue1A(pos, OpStaticCall, types.TypeResultMem, StaticAuxCall(fn, ACArgs, nil, b.Func.ABIDefault.ABIAnalyzeTypes(nil, argTypes, nil)), mem)
mem = b.NewValue1A(pos, OpStaticCall, types.TypeResultMem, StaticAuxCall(fn, nil, b.Func.ABIDefault.ABIAnalyzeTypes(nil, argTypes, nil)), mem)
mem.AuxInt = off - config.ctxt.FixedFrameSize()
return b.NewValue1I(pos, OpSelectN, types.TypeMem, 0, mem)
}

View File

@ -4814,8 +4814,7 @@ func (s *state) openDeferExit() {
aux := ssa.ClosureAuxCall(ACArgs, ACResults, s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults)))
call = s.newValue2A(ssa.OpClosureLECall, aux.LateExpansionResultType(), aux, codeptr, v)
} else {
aux := ssa.StaticAuxCall(fn.(*ir.Name).Linksym(), ACArgs, ACResults,
s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults)))
aux := ssa.StaticAuxCall(fn.(*ir.Name).Linksym(), ACResults, s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults)))
call = s.newValue0A(ssa.OpStaticLECall, aux.LateExpansionResultType(), aux)
}
callArgs = append(callArgs, s.mem())
@ -4995,8 +4994,7 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
// Call runtime.deferprocStack with pointer to _defer record.
ACArgs = append(ACArgs, ssa.Param{Type: types.Types[types.TUINTPTR], Offset: int32(base.Ctxt.FixedFrameSize())})
aux := ssa.StaticAuxCall(ir.Syms.DeferprocStack, ACArgs, ACResults,
s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults)))
aux := ssa.StaticAuxCall(ir.Syms.DeferprocStack, ACResults, s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults)))
callArgs = append(callArgs, addr, s.mem())
call = s.newValue0A(ssa.OpStaticLECall, aux.LateExpansionResultType(), aux)
call.AddArgs(callArgs...)
@ -5058,12 +5056,10 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
// call target
switch {
case k == callDefer:
aux := ssa.StaticAuxCall(ir.Syms.Deferproc, ACArgs, ACResults,
s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults))) // TODO paramResultInfo for DeferProc
aux := ssa.StaticAuxCall(ir.Syms.Deferproc, ACResults, s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults))) // TODO paramResultInfo for DeferProc
call = s.newValue0A(ssa.OpStaticLECall, aux.LateExpansionResultType(), aux)
case k == callGo:
aux := ssa.StaticAuxCall(ir.Syms.Newproc, ACArgs, ACResults,
s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults)))
aux := ssa.StaticAuxCall(ir.Syms.Newproc, ACResults, s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults)))
call = s.newValue0A(ssa.OpStaticLECall, aux.LateExpansionResultType(), aux) // TODO paramResultInfo for NewProc
case closure != nil:
// rawLoad because loading the code pointer from a
@ -5079,7 +5075,7 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
aux := ssa.InterfaceAuxCall(ACArgs, ACResults, params)
call = s.newValue1A(ssa.OpInterLECall, aux.LateExpansionResultType(), aux, codeptr)
case callee != nil:
aux := ssa.StaticAuxCall(callTargetLSym(callee, s.curfn.LSym), ACArgs, ACResults, params)
aux := ssa.StaticAuxCall(callTargetLSym(callee, s.curfn.LSym), ACResults, params)
call = s.newValue0A(ssa.OpStaticLECall, aux.LateExpansionResultType(), aux)
default:
s.Fatalf("bad call type %v %v", n.Op(), n)
@ -5546,7 +5542,7 @@ func (s *state) rtcall(fn *obj.LSym, returns bool, results []*types.Type, args .
// Issue call
var call *ssa.Value
aux := ssa.StaticAuxCall(fn, ACArgs, ACResults, s.f.ABIDefault.ABIAnalyzeTypes(nil, callArgTypes, results))
aux := ssa.StaticAuxCall(fn, ACResults, s.f.ABIDefault.ABIAnalyzeTypes(nil, callArgTypes, results))
callArgs = append(callArgs, s.mem())
call = s.newValue0A(ssa.OpStaticLECall, aux.LateExpansionResultType(), aux)
call.AddArgs(callArgs...)