aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/abi/abiutils.go
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2021-01-21 12:04:46 -0500
committerDavid Chase <drchase@google.com>2021-02-24 17:54:29 +0000
commit7a2f3273c5598bf53e37d0c8a4cb8a8caf7c4ca4 (patch)
treed95022f8c4850fd59e9cc4941089f46e9b6e046b /src/cmd/compile/internal/abi/abiutils.go
parentadb467ffd2d82b796de12bdd8effa2cfefe01f29 (diff)
downloadgo-7a2f3273c5598bf53e37d0c8a4cb8a8caf7c4ca4.tar.gz
go-7a2f3273c5598bf53e37d0c8a4cb8a8caf7c4ca4.zip
cmd/compile: plumb abi info into ssagen/ssa
Plumb abi information into ssa/ssagen for plain calls and plain functions (not methods). Does not extend all the way through the compiler (yet). One test disabled because it extends far enough to break the test. Normalized all the compiler's register args TODOs to // TODO(register args) ... For #40724. Change-Id: I0173a4579f032ac3c9db3aef1749d40da5ea01ff Reviewed-on: https://go-review.googlesource.com/c/go/+/293389 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>
Diffstat (limited to 'src/cmd/compile/internal/abi/abiutils.go')
-rw-r--r--src/cmd/compile/internal/abi/abiutils.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/abi/abiutils.go b/src/cmd/compile/internal/abi/abiutils.go
index e935821802..7b388ec3dc 100644
--- a/src/cmd/compile/internal/abi/abiutils.go
+++ b/src/cmd/compile/internal/abi/abiutils.go
@@ -116,6 +116,13 @@ func NewABIConfig(iRegsCount, fRegsCount int) *ABIConfig {
return &ABIConfig{regAmounts: RegAmounts{iRegsCount, fRegsCount}, regsForTypeCache: make(map[*types.Type]int)}
}
+// Copy returns a copy of an ABIConfig for use in a function's compilation so that access to the cache does not need to be protected with a mutex.
+func (a *ABIConfig) Copy() *ABIConfig {
+ b := *a
+ b.regsForTypeCache = make(map[*types.Type]int)
+ return &b
+}
+
// NumParamRegs returns the number of parameter registers used for a given type,
// without regard for the number available.
func (a *ABIConfig) NumParamRegs(t *types.Type) int {
@@ -157,12 +164,12 @@ func (a *ABIConfig) NumParamRegs(t *types.Type) int {
// 'config' and analyzes the function to determine how its parameters
// and results will be passed (in registers or on the stack), returning
// an ABIParamResultInfo object that holds the results of the analysis.
-func (config *ABIConfig) ABIAnalyze(t *types.Type) ABIParamResultInfo {
+func (config *ABIConfig) ABIAnalyze(t *types.Type) *ABIParamResultInfo {
setup()
s := assignState{
rTotal: config.regAmounts,
}
- result := ABIParamResultInfo{config: config}
+ result := &ABIParamResultInfo{config: config}
// Receiver
ft := t.FuncType()