aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/abi/abiutils.go
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2021-03-15 21:12:08 +0000
committerDavid Chase <drchase@google.com>2021-03-15 21:28:45 +0000
commite61c9ddb7f1a790f6a52f563dccb4ac264f2e704 (patch)
treecf3c49cf8575bfe24eb7fae5b66220f274e6ba95 /src/cmd/compile/internal/abi/abiutils.go
parent8ed438c077d82c4b4662c327dbbdb3c64e7547ca (diff)
downloadgo-e61c9ddb7f1a790f6a52f563dccb4ac264f2e704.tar.gz
go-e61c9ddb7f1a790f6a52f563dccb4ac264f2e704.zip
Revert "cmd/compile: spill output parameters passed in registers as autos"
This reverts commit 8ed438c077d82c4b4662c327dbbdb3c64e7547ca, CL 300749. Reason for revert: Looks like it crashes on link-register architectures Change-Id: I0c261df58900008cada3359889d2a87508158447 Reviewed-on: https://go-review.googlesource.com/c/go/+/302053 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/abi/abiutils.go')
-rw-r--r--src/cmd/compile/internal/abi/abiutils.go31
1 files changed, 5 insertions, 26 deletions
diff --git a/src/cmd/compile/internal/abi/abiutils.go b/src/cmd/compile/internal/abi/abiutils.go
index e92827fc7f..ecde34313a 100644
--- a/src/cmd/compile/internal/abi/abiutils.go
+++ b/src/cmd/compile/internal/abi/abiutils.go
@@ -69,14 +69,6 @@ func (a *ABIParamResultInfo) SpillAreaSize() int64 {
return a.spillAreaSize
}
-// ArgWidth returns the amount of stack needed for all the inputs
-// and outputs of a function or method, including ABI-defined parameter
-// slots and ABI-defined spill slots for register-resident parameters.
-// The name is inherited from (*Type).ArgWidth(), which it replaces.
-func (a *ABIParamResultInfo) ArgWidth() int64 {
- return a.spillAreaSize + a.offsetToSpillArea
-}
-
// RegIndex stores the index into the set of machine registers used by
// the ABI on a specific architecture for parameter passing. RegIndex
// values 0 through N-1 (where N is the number of integer registers
@@ -422,25 +414,20 @@ func (config *ABIConfig) ABIAnalyzeFuncType(ft *types.Func) *ABIParamResultInfo
// ABIAnalyze returns the same result as ABIAnalyzeFuncType, but also
// updates the offsets of all the receiver, input, and output fields.
-// If setNname is true, it also sets the FrameOffset of the Nname for
-// the field(s); this is for use when compiling a function and figuring out
-// spill locations. Doing this for callers can cause races for register
-// outputs because their frame location transitions from BOGUS_FUNARG_OFFSET
-// to zero to an as-if-AUTO offset that has no use for callers.
-func (config *ABIConfig) ABIAnalyze(t *types.Type, setNname bool) *ABIParamResultInfo {
+func (config *ABIConfig) ABIAnalyze(t *types.Type) *ABIParamResultInfo {
ft := t.FuncType()
result := config.ABIAnalyzeFuncType(ft)
// Fill in the frame offsets for receiver, inputs, results
k := 0
if t.NumRecvs() != 0 {
- config.updateOffset(result, ft.Receiver.FieldSlice()[0], result.inparams[0], false, setNname)
+ config.updateOffset(result, ft.Receiver.FieldSlice()[0], result.inparams[0], false)
k++
}
for i, f := range ft.Params.FieldSlice() {
- config.updateOffset(result, f, result.inparams[k+i], false, setNname)
+ config.updateOffset(result, f, result.inparams[k+i], false)
}
for i, f := range ft.Results.FieldSlice() {
- config.updateOffset(result, f, result.outparams[i], true, setNname)
+ config.updateOffset(result, f, result.outparams[i], true)
}
return result
}
@@ -455,7 +442,7 @@ func FieldOffsetOf(f *types.Field) int64 {
return f.Offset
}
-func (config *ABIConfig) updateOffset(result *ABIParamResultInfo, f *types.Field, a ABIParamAssignment, isReturn, setNname bool) {
+func (config *ABIConfig) updateOffset(result *ABIParamResultInfo, f *types.Field, a ABIParamAssignment, isReturn bool) {
// Everything except return values in registers has either a frame home (if not in a register) or a frame spill location.
if !isReturn || len(a.Registers) == 0 {
// The type frame offset DOES NOT show effects of minimum frame size.
@@ -468,19 +455,11 @@ func (config *ABIConfig) updateOffset(result *ABIParamResultInfo, f *types.Field
// Set the Offset the first time. After that, we may recompute it, but it should never change.
f.Offset = off
if f.Nname != nil {
- // always set it in this case.
f.Nname.(*ir.Name).SetFrameOffset(off)
- f.Nname.(*ir.Name).SetIsOutputParamInRegisters(false)
}
} else if fOffset != off {
panic(fmt.Errorf("Offset changed from %d to %d", fOffset, off))
}
- } else {
- if setNname && f.Nname != nil {
- fname := f.Nname.(*ir.Name)
- fname.SetIsOutputParamInRegisters(true)
- fname.SetFrameOffset(0)
- }
}
}