type edgeMem … type rewriteTarget … type rewrite … func (r *rewrite) String() string { … } // insertLoopReschedChecks inserts rescheduling checks on loop backedges. func insertLoopReschedChecks(f *Func) { … } // newPhiFor inserts a new Phi function into b, // with all inputs set to v. func newPhiFor(b *Block, v *Value) *Value { … } // rewriteNewPhis updates newphis[h] to record all places where the new phi function inserted // in block h will replace a previous definition. Block b is the block currently being processed; // if b has its own phi definition then it takes the place of h. // defsForUses provides information about other definitions of the variable that are present // (and if nil, indicates that the variable is no longer live) // sdom must yield a preorder of the flow graph if recursively walked, root-to-children. // The result of newSparseOrderedTree with order supplied by a dfs-postorder satisfies this // requirement. func rewriteNewPhis(h, b *Block, f *Func, defsForUses []*Value, newphis map[*Block]rewrite, dfPhiTargets map[rewriteTarget]bool, sdom SparseTree) { … } // addDFphis creates new trivial phis that are necessary to correctly reflect (within SSA) // a new definition for variable "x" inserted at h (usually but not necessarily a phi). // These new phis can only occur at the dominance frontier of h; block s is in the dominance // frontier of h if h does not strictly dominate s and if s is a successor of a block b where // either b = h or h strictly dominates b. // These newly created phis are themselves new definitions that may require addition of their // own trivial phi functions in their own dominance frontier, and this is handled recursively. func addDFphis(x *Value, h, b *Block, f *Func, defForUses []*Value, newphis map[*Block]rewrite, sdom SparseTree) { … } // findLastMems maps block ids to last memory-output op in a block, if any. func findLastMems(f *Func) []*Value { … } type markKind … const notFound … const notExplored … const explored … const done … type backedgesState … // backedges returns a slice of successor edges that are back // edges. For reducible loops, edge.b is the header. func backedges(f *Func) []Edge { … }