1
0
mirror of https://github.com/golang/go synced 2024-11-19 02:14:43 -07:00

cmd/compile/internal/gc: stop exporting *gc.Sym-typed globals

The arch-specific SSA backends now no longer use gc.Sym either.

Passes toolstash -cmp.

Change-Id: Ic13b934b92a1b89b4b79c6c4796ab0a137608163
Reviewed-on: https://go-review.googlesource.com/36416
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Matthew Dempsky 2017-02-06 13:40:19 -08:00
parent 87c475c227
commit 5f374ea8fb
11 changed files with 45 additions and 44 deletions

View File

@ -737,7 +737,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
q.To.Reg = r
}
case ssa.OpAMD64CALLstatic:
if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
if v.Aux.(*obj.LSym) == gc.Deferreturn {
// Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line
@ -766,7 +766,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Deferproc.Sym)
p.To.Sym = gc.Deferproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}
@ -774,7 +774,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Newproc.Sym)
p.To.Sym = gc.Newproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}

View File

@ -635,7 +635,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
case ssa.OpARMCALLstatic:
if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
if v.Aux.(*obj.LSym) == gc.Deferreturn {
// Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line
@ -665,7 +665,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Deferproc.Sym)
p.To.Sym = gc.Deferproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}
@ -673,7 +673,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Newproc.Sym)
p.To.Sym = gc.Newproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}

View File

@ -632,7 +632,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p4.To.Type = obj.TYPE_BRANCH
gc.Patch(p4, p)
case ssa.OpARM64CALLstatic:
if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
if v.Aux.(*obj.LSym) == gc.Deferreturn {
// Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line
@ -662,7 +662,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Deferproc.Sym)
p.To.Sym = gc.Deferproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}
@ -670,7 +670,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Newproc.Sym)
p.To.Sym = gc.Newproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}

View File

@ -365,7 +365,8 @@ var Thearch Arch
var (
staticbytes,
zerobase,
zerobase *Node
Newproc,
Deferproc,
Deferreturn,
@ -378,5 +379,5 @@ var (
assertE2I,
assertE2I2,
assertI2I,
assertI2I2 *Node
assertI2I2 *obj.LSym
)

View File

@ -297,19 +297,19 @@ func (s *ssaExport) AllocFrame(f *ssa.Func) {
func compile(fn *Node) {
if Newproc == nil {
Newproc = Sysfunc("newproc")
Deferproc = Sysfunc("deferproc")
Deferreturn = Sysfunc("deferreturn")
panicindex = Sysfunc("panicindex")
panicslice = Sysfunc("panicslice")
panicdivide = Sysfunc("panicdivide")
growslice = Sysfunc("growslice")
panicdottype = Sysfunc("panicdottype")
panicnildottype = Sysfunc("panicnildottype")
assertE2I = Sysfunc("assertE2I")
assertE2I2 = Sysfunc("assertE2I2")
assertI2I = Sysfunc("assertI2I")
assertI2I2 = Sysfunc("assertI2I2")
Newproc = Linksym(Sysfunc("newproc").Sym)
Deferproc = Linksym(Sysfunc("deferproc").Sym)
Deferreturn = Linksym(Sysfunc("deferreturn").Sym)
panicindex = Linksym(Sysfunc("panicindex").Sym)
panicslice = Linksym(Sysfunc("panicslice").Sym)
panicdivide = Linksym(Sysfunc("panicdivide").Sym)
growslice = Linksym(Sysfunc("growslice").Sym)
panicdottype = Linksym(Sysfunc("panicdottype").Sym)
panicnildottype = Linksym(Sysfunc("panicnildottype").Sym)
assertE2I = Linksym(Sysfunc("assertE2I").Sym)
assertE2I2 = Linksym(Sysfunc("assertE2I2").Sym)
assertI2I = Linksym(Sysfunc("assertI2I").Sym)
assertI2I2 = Linksym(Sysfunc("assertI2I2").Sym)
}
defer func(lno src.XPos) {

View File

@ -250,7 +250,7 @@ type state struct {
}
type funcLine struct {
f *Node
f *obj.LSym
line src.XPos
}
@ -3303,7 +3303,7 @@ func (s *state) sliceBoundsCheck(idx, len *ssa.Value) {
}
// If cmp (a bool) is false, panic using the given function.
func (s *state) check(cmp *ssa.Value, fn *Node) {
func (s *state) check(cmp *ssa.Value, fn *obj.LSym) {
b := s.endBlock()
b.Kind = ssa.BlockIf
b.SetControl(cmp)
@ -3344,7 +3344,7 @@ func (s *state) intDivide(n *Node, a, b *ssa.Value) *ssa.Value {
// Returns a slice of results of the given result types.
// The call is added to the end of the current block.
// If returns is false, the block is marked as an exit block.
func (s *state) rtcall(fn *Node, returns bool, results []*Type, args ...*ssa.Value) []*ssa.Value {
func (s *state) rtcall(fn *obj.LSym, returns bool, results []*Type, args ...*ssa.Value) []*ssa.Value {
// Write args to the stack
off := Ctxt.FixedFrameSize()
for _, arg := range args {
@ -3365,7 +3365,7 @@ func (s *state) rtcall(fn *Node, returns bool, results []*Type, args ...*ssa.Val
}
// Issue call
call := s.newValue1A(ssa.OpStaticCall, ssa.TypeMem, Linksym(fn.Sym), s.mem())
call := s.newValue1A(ssa.OpStaticCall, ssa.TypeMem, fn, s.mem())
s.vars[&memVar] = call
if !returns {
@ -4610,7 +4610,7 @@ func sizeAlignAuxInt(t *Type) int64 {
// extendIndex extends v to a full int width.
// panic using the given function if v does not fit in an int (only on 32-bit archs).
func (s *state) extendIndex(v *ssa.Value, panicfn *Node) *ssa.Value {
func (s *state) extendIndex(v *ssa.Value, panicfn *obj.LSym) *ssa.Value {
size := v.Type.Size()
if size == s.config.IntSize {
return v

View File

@ -487,7 +487,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p6.To.Type = obj.TYPE_BRANCH
gc.Patch(p6, p2)
case ssa.OpMIPSCALLstatic:
if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
if v.Aux.(*obj.LSym) == gc.Deferreturn {
// Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line
@ -517,7 +517,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Deferproc.Sym)
p.To.Sym = gc.Deferproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}
@ -525,7 +525,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Newproc.Sym)
p.To.Sym = gc.Newproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}

View File

@ -490,7 +490,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p6.To.Type = obj.TYPE_BRANCH
gc.Patch(p6, p2)
case ssa.OpMIPS64CALLstatic:
if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
if v.Aux.(*obj.LSym) == gc.Deferreturn {
// Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line
@ -520,7 +520,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Deferproc.Sym)
p.To.Sym = gc.Deferproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}
@ -528,7 +528,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Newproc.Sym)
p.To.Sym = gc.Newproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}

View File

@ -687,7 +687,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
gc.Patch(p4, p)
case ssa.OpPPC64CALLstatic:
if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
if v.Aux.(*obj.LSym) == gc.Deferreturn {
// Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line
@ -772,7 +772,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Deferproc.Sym)
p.To.Sym = gc.Deferproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}
@ -780,7 +780,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Newproc.Sym)
p.To.Sym = gc.Newproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}

View File

@ -473,7 +473,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p.To.Type = obj.TYPE_REG
p.To.Reg = r
case ssa.OpS390XCALLstatic:
if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
if v.Aux.(*obj.LSym) == gc.Deferreturn {
// Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line
@ -502,7 +502,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Deferproc.Sym)
p.To.Sym = gc.Deferproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}
@ -510,7 +510,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Newproc.Sym)
p.To.Sym = gc.Newproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}

View File

@ -660,7 +660,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
q.To.Reg = r
}
case ssa.Op386CALLstatic:
if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
if v.Aux.(*obj.LSym) == gc.Deferreturn {
// Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line
@ -689,7 +689,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Deferproc.Sym)
p.To.Sym = gc.Deferproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}
@ -697,7 +697,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(gc.Newproc.Sym)
p.To.Sym = gc.Newproc
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}