// acts as the set of marks for the BFS of the call graph.
funcs := make(map[ir.Node]nowritebarrierrecCall)
// q is the queue of ODCLFUNC Nodes to visit in BFS order.
- var q ir.NodeQueue
+ var q ir.NameQueue
for _, n := range xtop {
if n.Op() != ir.ODCLFUNC {
// Make nowritebarrierrec functions BFS roots.
if fn.Pragma&ir.Nowritebarrierrec != 0 {
funcs[fn] = nowritebarrierrecCall{}
- q.PushRight(fn)
+ q.PushRight(fn.Nname)
}
// Check go:nowritebarrier functions.
if fn.Pragma&ir.Nowritebarrier != 0 && fn.WBPos.IsKnown() {
// Record the path.
funcs[target] = nowritebarrierrecCall{target: src, lineno: pos}
- q.PushRight(target)
+ q.PushRight(target.Nname)
}
for !q.Empty() {
- fn := q.PopLeft().(*ir.Func)
+ fn := q.PopLeft().Func()
// Check fn.
if fn.WBPos.IsKnown() {
var asmlist []ir.Node
// exportsym marks n for export (or reexport).
-func exportsym(n ir.Node) {
+func exportsym(n *ir.Name) {
if n.Sym().OnExportList() {
return
}
return s == "init"
}
-func autoexport(n ir.Node, ctxt ir.Class) {
+func autoexport(n *ir.Name, ctxt ir.Class) {
if n.Sym().Pkg != ir.LocalPkg {
return
}
var xtop []ir.Node
-var exportlist []ir.Node
+var exportlist []*ir.Name
var importlist []*ir.Func // imported functions and methods with inlinable bodies
// main index.
allPkgs map[*types.Pkg]bool
- declTodo ir.NodeQueue
+ declTodo ir.NameQueue
strings intWriter
stringIndex map[string]uint64
}
// pushDecl adds n to the declaration work queue, if not already present.
-func (p *iexporter) pushDecl(n ir.Node) {
+func (p *iexporter) pushDecl(n *ir.Name) {
if n.Sym() == nil || n.Sym().Def != n && n.Op() != ir.OTYPE {
base.Fatalf("weird Sym: %v, %v", n, n.Sym())
}
func (w *exportWriter) qualifiedIdent(n ir.Node) {
// Ensure any referenced declarations are written out too.
- w.p.pushDecl(n)
+ w.p.pushDecl(n.Name())
s := n.Sym()
w.string(s.Name)
return c
}
-// nodeQueue is a FIFO queue of *Node. The zero value of nodeQueue is
+// NameQueue is a FIFO queue of *Name. The zero value of NameQueue is
// a ready-to-use empty queue.
-type NodeQueue struct {
- ring []Node
+type NameQueue struct {
+ ring []*Name
head, tail int
}
-// empty reports whether q contains no Nodes.
-func (q *NodeQueue) Empty() bool {
+// Empty reports whether q contains no Names.
+func (q *NameQueue) Empty() bool {
return q.head == q.tail
}
-// pushRight appends n to the right of the queue.
-func (q *NodeQueue) PushRight(n Node) {
+// PushRight appends n to the right of the queue.
+func (q *NameQueue) PushRight(n *Name) {
if len(q.ring) == 0 {
- q.ring = make([]Node, 16)
+ q.ring = make([]*Name, 16)
} else if q.head+len(q.ring) == q.tail {
// Grow the ring.
- nring := make([]Node, len(q.ring)*2)
+ nring := make([]*Name, len(q.ring)*2)
// Copy the old elements.
part := q.ring[q.head%len(q.ring):]
if q.tail-q.head <= len(part) {
q.tail++
}
-// popLeft pops a node from the left of the queue. It panics if q is
+// PopLeft pops a Name from the left of the queue. It panics if q is
// empty.
-func (q *NodeQueue) PopLeft() Node {
+func (q *NameQueue) PopLeft() *Name {
if q.Empty() {
panic("dequeue empty")
}