sym := methodSymSuffix(rcvrtype, meth, "-fm")
if sym.Uniq() {
- return ir.AsNode(sym.Def).(*ir.Func)
+ return sym.Def.(*ir.Func)
}
sym.SetUniq(true)
gen = vargen
}
types.Pushdcl(s)
- n.Name().Curfn = Curfn
+ n.Curfn = Curfn
}
if ctxt == ir.PAUTO {
s.Block = types.Block
s.Lastlineno = base.Pos
s.Def = n
- n.Name().Vargen = int32(gen)
+ n.Vargen = int32(gen)
n.SetClass(ctxt)
if ctxt == ir.PFUNC {
n.Sym().SetFunc(true)
nnew++
n := NewName(n.Sym())
declare(n, dclcontext)
- n.Name().Defn = defn
+ n.Defn = defn
defn.PtrInit().Append(ir.Nod(ir.ODCL, n, nil))
left[i] = n
}
declare(name, ctxt)
vargen++
- n.Decl.Name().Vargen = int32(vargen)
+ n.Decl.Vargen = int32(vargen)
}
// Same as funcargs, except run over an already constructed TFUNC.
}
f := types.NewField(base.Pos, msym, t)
- f.Nname = n.Func().Nname
+ f.Nname = n.Nname
f.SetNointerface(nointerface)
mt.Methods().Append(f)
}
// If a closure reference escapes, mark the outer variable as escaping.
- if n.Name().IsClosureVar() {
- addrescapes(n.Name().Defn)
+ if n.IsClosureVar() {
+ addrescapes(n.Defn)
break
}
// then we're analyzing the inner closure but we need to move x to the
// heap in f, not in the inner closure. Flip over to f before calling moveToHeap.
oldfn := Curfn
- Curfn = n.Name().Curfn
+ Curfn = n.Curfn
ln := base.Pos
base.Pos = Curfn.Pos()
moveToHeap(n)
// See issue 16095.
heapaddr.SetIsOutputParamHeapAddr(true)
}
- n.Name().Stackcopy = stackcopy
+ n.Stackcopy = stackcopy
// Substitute the stackcopy into the function variable list so that
// liveness and other analyses use the underlying stack slot
// Modify n in place so that uses of n now mean indirection of the heapaddr.
n.SetClass(ir.PAUTOHEAP)
n.SetOffset(0)
- n.Name().Heapaddr = heapaddr
+ n.Heapaddr = heapaddr
n.SetEsc(EscHeap)
if base.Flag.LowerM != 0 {
base.WarnfAt(n.Pos(), "moved to heap: %v", n)
// pushDecl adds n to the declaration work queue, if not already present.
func (p *iexporter) pushDecl(n ir.Node) {
- if n.Sym() == nil || ir.AsNode(n.Sym().Def) != n && n.Op() != ir.OTYPE {
+ if n.Sym() == nil || n.Sym().Def != n && n.Op() != ir.OTYPE {
base.Fatalf("weird Sym: %v, %v", n, n.Sym())
}
func (w *exportWriter) methExt(m *types.Field) {
w.bool(m.Nointerface())
- w.funcExt(ir.AsNode(m.Nname).(*ir.Name))
+ w.funcExt(m.Nname.(*ir.Name))
}
func (w *exportWriter) linkname(s *types.Sym) {
initializers := lookup("init")
fn := dclfunc(initializers, ir.NewFuncType(base.Pos, nil, nil, nil))
for _, dcl := range initTodo.Dcl {
- dcl.Name().Curfn = fn
+ dcl.Curfn = fn
}
fn.Dcl = append(fn.Dcl, initTodo.Dcl...)
initTodo.Dcl = nil
}
func IsAlias(sym *types.Sym) bool {
- return sym.Def != nil && ir.AsNode(sym.Def).Sym() != sym
+ return sym.Def != nil && sym.Def.Sym() != sym
}
// recordFlags records the specified command-line flags to be placed
if ln.Class() != ir.PPARAMOUT {
break
}
- if ir.AsNode(ln.Sym().Def) != ln {
+ if ln.Sym().Def != ln {
base.Errorf("%s is shadowed during return", ln.Sym().Name)
}
}
}
if n.Type().Kind() == types.TFUNC && n.Class() == ir.PFUNC {
// function
- ptabs = append(ptabs, ptabEntry{s: s, t: ir.AsNode(s.Def).Type()})
+ ptabs = append(ptabs, ptabEntry{s: s, t: s.Def.Type()})
} else {
// variable
- ptabs = append(ptabs, ptabEntry{s: s, t: types.NewPtr(ir.AsNode(s.Def).Type())})
+ ptabs = append(ptabs, ptabEntry{s: s, t: types.NewPtr(s.Def.Type())})
}
}
}
return a.Offset() < b.Offset()
}
- if a.Name().Used() != b.Name().Used() {
- return a.Name().Used()
+ if a.Used() != b.Used() {
+ return a.Used()
}
ap := a.Type().HasPointers()
return ap
}
- ap = a.Name().Needzero()
- bp = b.Name().Needzero()
+ ap = a.Needzero()
+ bp = b.Needzero()
if ap != bp {
return ap
}
// Mark the PAUTO's unused.
for _, ln := range fn.Dcl {
if ln.Class() == ir.PAUTO {
- ln.Name().SetUsed(false)
+ ln.SetUsed(false)
}
}
if n.Op() != ir.ONAME || n.Class() != ir.PAUTO {
continue
}
- if !n.Name().Used() {
+ if !n.Used() {
fn.Dcl = fn.Dcl[:i]
break
}
for _, n := range fn.Dcl {
switch n.Class() {
case ir.PPARAM, ir.PPARAMOUT, ir.PAUTO:
- if livenessShouldTrack(n) && n.Name().Addrtaken() {
+ if livenessShouldTrack(n) && n.Addrtaken() {
dtypesym(n.Type())
// Also make sure we allocate a linker symbol
// for the stack object data, for the same reason.
}
switch n.Class() {
case ir.PAUTO:
- if !n.Name().Used() {
+ if !n.Used() {
// Text == nil -> generating abstract function
if fnsym.Func().Text != nil {
base.Fatalf("debuginfo unused node (AllocFrame should truncate fn.Func.Dcl)")
}
n := ir.Nod(ir.OADDR, ir.AsNode(s.Def), nil)
- n.SetType(types.NewPtr(ir.AsNode(s.Def).Type()))
+ n.SetType(types.NewPtr(s.Def.Type()))
n.SetTypecheck(1)
return n
}
}
n := ir.Nod(ir.OADDR, ir.AsNode(s.Def), nil)
- n.SetType(types.NewPtr(ir.AsNode(s.Def).Type()))
+ n.SetType(types.NewPtr(s.Def.Type()))
n.SetTypecheck(1)
return n
}
func emitStackObjects(e *ssafn, pp *Progs) {
var vars []ir.Node
for _, n := range e.curfn.Dcl {
- if livenessShouldTrack(n) && n.Name().Addrtaken() {
+ if livenessShouldTrack(n) && n.Addrtaken() {
vars = append(vars, n)
}
}
// Iterate through declarations. They are sorted in decreasing Xoffset order.
for _, n := range e.curfn.Dcl {
- if !n.Name().Needzero() {
+ if !n.Needzero() {
continue
}
if n.Class() != ir.PAUTO {
pll = ll
ll = ll.Left()
}
- if pll.Implicit() && ll.Type().IsPtr() && ll.Type().Sym() != nil && ir.AsNode(ll.Type().Sym().Def) != nil && ir.AsNode(ll.Type().Sym().Def).Op() == ir.OTYPE {
+ if pll.Implicit() && ll.Type().IsPtr() && ll.Type().Sym() != nil && ll.Type().Sym().Def != nil && ir.AsNode(ll.Type().Sym().Def).Op() == ir.OTYPE {
// It is invalid to automatically dereference a named pointer type when selecting a method.
// Make n.Left == ll to clarify error message.
n.SetLeft(ll)
for _, ln := range n.Dcl {
if ln.Op() == ir.ONAME && (ln.Class() == ir.PPARAM || ln.Class() == ir.PPARAMOUT) {
- ln.Name().Decldepth = 1
+ ln.Decldepth = 1
}
}
// referenced by expression n, which must be a method selector,
// method expression, or method value.
func methodExprName(n ir.Node) *ir.Name {
- name, _ := ir.AsNode(methodExprFunc(n).Nname).(*ir.Name)
+ name, _ := methodExprFunc(n).Nname.(*ir.Name)
return name
}
nodfp = NewName(lookup(".fp"))
nodfp.SetType(types.Types[types.TINT32])
nodfp.SetClass(ir.PPARAM)
- nodfp.Name().SetUsed(true)
+ nodfp.SetUsed(true)
}
// Propagate the used flag for typeswitch variables up to the NONAME in its definition.
for _, ln := range fn.Dcl {
- if ln.Op() == ir.ONAME && (ln.Class() == ir.PAUTO || ln.Class() == ir.PAUTOHEAP) && ln.Name().Defn != nil && ln.Name().Defn.Op() == ir.OTYPESW && ln.Name().Used() {
- ln.Name().Defn.Left().Name().SetUsed(true)
+ if ln.Op() == ir.ONAME && (ln.Class() == ir.PAUTO || ln.Class() == ir.PAUTOHEAP) && ln.Defn != nil && ln.Defn.Op() == ir.OTYPESW && ln.Used() {
+ ln.Defn.Left().Name().SetUsed(true)
}
}
for _, ln := range fn.Dcl {
- if ln.Op() != ir.ONAME || (ln.Class() != ir.PAUTO && ln.Class() != ir.PAUTOHEAP) || ln.Sym().Name[0] == '&' || ln.Name().Used() {
+ if ln.Op() != ir.ONAME || (ln.Class() != ir.PAUTO && ln.Class() != ir.PAUTOHEAP) || ln.Sym().Name[0] == '&' || ln.Used() {
continue
}
- if defn := ln.Name().Defn; defn != nil && defn.Op() == ir.OTYPESW {
+ if defn := ln.Defn; defn != nil && defn.Op() == ir.OTYPESW {
if defn.Left().Name().Used() {
continue
}
for _, ln := range fn.Dcl {
switch ln.Class() {
case ir.PPARAMOUT:
- if isParamStackCopy(ln) || ln.Name().Addrtaken() {
+ if isParamStackCopy(ln) || ln.Addrtaken() {
return true
}