// funcpctab writes to dst a pc-value table mapping the code in func to the values // returned by valfunc parameterized by arg. The invocation of valfunc to update the // current value is, for each p, // // sym = valfunc(func, p, 0, arg); // record sym.P as value at p->pc; // sym = valfunc(func, p, 1, arg); // // where func is the function, val is the current value, p is the instruction being // considered, and arg can be used to further parameterize valfunc. func funcpctab(ctxt *Link, func_ *LSym, desc string, valfunc func(*Link, *LSym, int32, *Prog, int32, interface{ … } // pctofileline computes either the file number (arg == 0) // or the line number (arg == 1) to use at p. // Because p.Pos applies to p, phase == 0 (before p) // takes care of the update. func pctofileline(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg interface{ … } type pcinlineState … // addBranch adds a branch from the global inlining tree in ctxt to // the function's local inlining tree, returning the index in the local tree. func (s *pcinlineState) addBranch(ctxt *Link, globalIndex int) int { … } func (s *pcinlineState) setParentPC(ctxt *Link, globalIndex int, pc int32) { … } // pctoinline computes the index into the local inlining tree to use at p. // If p is not the result of inlining, pctoinline returns -1. Because p.Pos // applies to p, phase == 0 (before p) takes care of the update. func (s *pcinlineState) pctoinline(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg interface{ … } // pctospadj computes the sp adjustment in effect. // It is oldval plus any adjustment made by p itself. // The adjustment by p takes effect only after p, so we // apply the change during phase == 1. func pctospadj(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg interface{ … } // pctopcdata computes the pcdata value in effect at p. // A PCDATA instruction sets the value in effect at future // non-PCDATA instructions. // Since PCDATA instructions have no width in the final code, // it does not matter which phase we use for the update. func pctopcdata(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg interface{ … } func linkpcln(ctxt *Link, cursym *LSym) { … } type PCIter … // NewPCIter creates a PCIter with a scale factor for the PC step size. func NewPCIter(pcScale uint32) *PCIter { … } // Next advances it to the Next pc. func (it *PCIter) Next() { … } // init prepares it to iterate over p, // and advances it to the first pc. func (it *PCIter) Init(p []byte) { … }