aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssagen
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2021-04-15 23:05:49 -0400
committerRuss Cox <rsc@golang.org>2021-04-16 19:20:53 +0000
commit95ed5c3800a87ddf9b0ec3958eaaa1a969306293 (patch)
treecb0c555f10ab706a5c491cbe48dd36da16658a1e /src/cmd/compile/internal/ssagen
parent2fc0ebb623e2859094ad3f41e61325df0c2163f8 (diff)
downloadgo-95ed5c3800a87ddf9b0ec3958eaaa1a969306293.tar.gz
go-95ed5c3800a87ddf9b0ec3958eaaa1a969306293.zip
internal/buildcfg: move build configuration out of cmd/internal/objabi
The go/build package needs access to this configuration, so move it into a new package available to the standard library. Change-Id: I868a94148b52350c76116451f4ad9191246adcff Reviewed-on: https://go-review.googlesource.com/c/go/+/310731 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssagen')
-rw-r--r--src/cmd/compile/internal/ssagen/abi.go7
-rw-r--r--src/cmd/compile/internal/ssagen/pgen.go5
-rw-r--r--src/cmd/compile/internal/ssagen/ssa.go17
3 files changed, 16 insertions, 13 deletions
diff --git a/src/cmd/compile/internal/ssagen/abi.go b/src/cmd/compile/internal/ssagen/abi.go
index 8103b08ce5..7d56362302 100644
--- a/src/cmd/compile/internal/ssagen/abi.go
+++ b/src/cmd/compile/internal/ssagen/abi.go
@@ -6,6 +6,7 @@ package ssagen
import (
"fmt"
+ "internal/buildcfg"
"io/ioutil"
"log"
"os"
@@ -213,7 +214,7 @@ func (s *SymABIs) GenABIWrappers() {
base.Fatalf("cgo exported function %s cannot have ABI wrappers", fn)
}
- if !objabi.Experiment.RegabiWrappers {
+ if !buildcfg.Experiment.RegabiWrappers {
// We'll generate ABI aliases instead of
// wrappers once we have LSyms in InitLSym.
continue
@@ -241,7 +242,7 @@ func InitLSym(f *ir.Func, hasBody bool) {
if f.Pragma&ir.Systemstack != 0 {
f.LSym.Set(obj.AttrCFunc, true)
}
- if f.ABI == obj.ABIInternal || !objabi.Experiment.RegabiWrappers {
+ if f.ABI == obj.ABIInternal || !buildcfg.Experiment.RegabiWrappers {
// Function values can only point to
// ABIInternal entry points. This will create
// the funcsym for either the defining
@@ -253,7 +254,7 @@ func InitLSym(f *ir.Func, hasBody bool) {
// when we see that.
staticdata.NeedFuncSym(f)
}
- if !objabi.Experiment.RegabiWrappers {
+ if !buildcfg.Experiment.RegabiWrappers {
// Create ABI aliases instead of wrappers.
forEachWrapperABI(f, makeABIAlias)
}
diff --git a/src/cmd/compile/internal/ssagen/pgen.go b/src/cmd/compile/internal/ssagen/pgen.go
index 92f6f562f3..62567535d7 100644
--- a/src/cmd/compile/internal/ssagen/pgen.go
+++ b/src/cmd/compile/internal/ssagen/pgen.go
@@ -5,6 +5,7 @@
package ssagen
import (
+ "internal/buildcfg"
"internal/race"
"math/rand"
"sort"
@@ -215,7 +216,7 @@ func StackOffset(slot ssa.LocalSlot) int32 {
if base.Ctxt.FixedFrameSize() == 0 {
off -= int64(types.PtrSize)
}
- if objabi.FramePointerEnabled {
+ if buildcfg.FramePointerEnabled {
off -= int64(types.PtrSize)
}
}
@@ -228,7 +229,7 @@ func fieldtrack(fnsym *obj.LSym, tracked map[*obj.LSym]struct{}) {
if fnsym == nil {
return
}
- if !objabi.Experiment.FieldTrack || len(tracked) == 0 {
+ if !buildcfg.Experiment.FieldTrack || len(tracked) == 0 {
return
}
diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go
index 61f23a9c40..f0bce0756a 100644
--- a/src/cmd/compile/internal/ssagen/ssa.go
+++ b/src/cmd/compile/internal/ssagen/ssa.go
@@ -12,6 +12,7 @@ import (
"fmt"
"go/constant"
"html"
+ "internal/buildcfg"
"os"
"path/filepath"
"sort"
@@ -227,7 +228,7 @@ const magicLastTypeName = "MagicLastTypeNameForTestingRegisterABI"
// abiForFunc implements ABI policy for a function, but does not return a copy of the ABI.
// Passing a nil function returns the default ABI based on experiment configuration.
func abiForFunc(fn *ir.Func, abi0, abi1 *abi.ABIConfig) *abi.ABIConfig {
- if objabi.Experiment.RegabiArgs {
+ if buildcfg.Experiment.RegabiArgs {
// Select the ABI based on the function's defining ABI.
if fn == nil {
return abi1
@@ -4646,7 +4647,7 @@ func (s *state) openDeferRecord(n *ir.CallExpr) {
var args []*ssa.Value
var argNodes []*ir.Name
- if objabi.Experiment.RegabiDefer && (len(n.Args) != 0 || n.Op() == ir.OCALLINTER || n.X.Type().NumResults() != 0) {
+ if buildcfg.Experiment.RegabiDefer && (len(n.Args) != 0 || n.Op() == ir.OCALLINTER || n.X.Type().NumResults() != 0) {
s.Fatalf("defer call with arguments or results: %v", n)
}
@@ -4883,7 +4884,7 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
callABI := s.f.ABIDefault
- if !objabi.Experiment.RegabiArgs {
+ if !buildcfg.Experiment.RegabiArgs {
var magicFnNameSym *types.Sym
if fn.Name() != nil {
magicFnNameSym = fn.Name().Sym()
@@ -4901,7 +4902,7 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
}
}
- if objabi.Experiment.RegabiDefer && k != callNormal && (len(n.Args) != 0 || n.Op() == ir.OCALLINTER || n.X.Type().NumResults() != 0) {
+ if buildcfg.Experiment.RegabiDefer && k != callNormal && (len(n.Args) != 0 || n.Op() == ir.OCALLINTER || n.X.Type().NumResults() != 0) {
s.Fatalf("go/defer call with arguments: %v", n)
}
@@ -4910,7 +4911,7 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
if k == callNormal && fn.Op() == ir.ONAME && fn.(*ir.Name).Class == ir.PFUNC {
fn := fn.(*ir.Name)
callee = fn
- if objabi.Experiment.RegabiArgs {
+ if buildcfg.Experiment.RegabiArgs {
// This is a static call, so it may be
// a direct call to a non-ABIInternal
// function. fn.Func may be nil for
@@ -4951,7 +4952,7 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
}
}
- if !objabi.Experiment.RegabiArgs {
+ if !buildcfg.Experiment.RegabiArgs {
if regAbiForFuncType(n.X.Type().FuncType()) {
// Magic last type in input args to call
callABI = s.f.ABI1
@@ -5135,7 +5136,7 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
// maybeNilCheckClosure checks if a nil check of a closure is needed in some
// architecture-dependent situations and, if so, emits the nil check.
func (s *state) maybeNilCheckClosure(closure *ssa.Value, k callKind) {
- if Arch.LinkArch.Family == sys.Wasm || objabi.GOOS == "aix" && k != callGo {
+ if Arch.LinkArch.Family == sys.Wasm || buildcfg.GOOS == "aix" && k != callGo {
// On AIX, the closure needs to be verified as fn can be nil, except if it's a call go. This needs to be handled by the runtime to have the "go of nil func value" error.
// TODO(neelance): On other architectures this should be eliminated by the optimization steps
s.nilCheck(closure)
@@ -6881,7 +6882,7 @@ func defframe(s *State, e *ssafn, f *ssa.Func) {
// and not address-taken (for non-SSA-able or address-taken arguments we always
// spill upfront).
// TODO(register args) Make liveness more fine-grained to that partial spilling is okay.
- if objabi.Experiment.RegabiArgs {
+ if buildcfg.Experiment.RegabiArgs {
// First, see if it is already spilled before it may be live. Look for a spill
// in the entry block up to the first safepoint.
type nameOff struct {