type Block … type Edge … func (e Edge) Block() *Block { … } func (e Edge) Index() int { … } func (e Edge) String() string { … } type BlockKind … // short form print func (b *Block) String() string { … } // long form print func (b *Block) LongString() string { … } // NumControls returns the number of non-nil control values the // block has. func (b *Block) NumControls() int { … } // ControlValues returns a slice containing the non-nil control // values of the block. The index of each control value will be // the same as it is in the Controls property and can be used // in ReplaceControl calls. func (b *Block) ControlValues() []*Value { … } // SetControl removes all existing control values and then adds // the control value provided. The number of control values after // a call to SetControl will always be 1. func (b *Block) SetControl(v *Value) { … } // ResetControls sets the number of controls for the block to 0. func (b *Block) ResetControls() { … } // AddControl appends a control value to the existing list of control values. func (b *Block) AddControl(v *Value) { … } // ReplaceControl exchanges the existing control value at the index provided // for the new value. The index must refer to a valid control value. func (b *Block) ReplaceControl(i int, v *Value) { … } // CopyControls replaces the controls for this block with those from the // provided block. The provided block is not modified. func (b *Block) CopyControls(from *Block) { … } // Reset sets the block to the provided kind and clears all the blocks control // and auxiliary values. Other properties of the block, such as its successors, // predecessors and values are left unmodified. func (b *Block) Reset(kind BlockKind) { … } // resetWithControl resets b and adds control v. // It is equivalent to b.Reset(kind); b.AddControl(v), // except that it is one call instead of two and avoids a bounds check. // It is intended for use by rewrite rules, where this matters. func (b *Block) resetWithControl(kind BlockKind, v *Value) { … } // resetWithControl2 resets b and adds controls v and w. // It is equivalent to b.Reset(kind); b.AddControl(v); b.AddControl(w), // except that it is one call instead of three and avoids two bounds checks. // It is intended for use by rewrite rules, where this matters. func (b *Block) resetWithControl2(kind BlockKind, v, w *Value) { … } // truncateValues truncates b.Values at the ith element, zeroing subsequent elements. // The values in b.Values after i must already have had their args reset, // to maintain correct value uses counts. func (b *Block) truncateValues(i int) { … } // AddEdgeTo adds an edge from block b to block c. func (b *Block) AddEdgeTo(c *Block) { … } // removePred removes the ith input edge from b. // It is the responsibility of the caller to remove // the corresponding successor edge, and adjust any // phi values by calling b.removePhiArg(v, i). func (b *Block) removePred(i int) { … } // removeSucc removes the ith output edge from b. // It is the responsibility of the caller to remove // the corresponding predecessor edge. // Note that this potentially reorders successors of b, so it // must be used very carefully. func (b *Block) removeSucc(i int) { … } func (b *Block) swapSuccessors() { … } // Swaps b.Succs[x] and b.Succs[y]. func (b *Block) swapSuccessorsByIdx(x, y int) { … } // removePhiArg removes the ith arg from phi. // It must be called after calling b.removePred(i) to // adjust the corresponding phi value of the block: // // b.removePred(i) // for _, v := range b.Values { // // if v.Op != OpPhi { // continue // } // b.removePhiArg(v, i) // // } func (b *Block) removePhiArg(phi *Value, i int) { … } // uniquePred returns the predecessor of b, if there is exactly one. // Returns nil otherwise. func (b *Block) uniquePred() *Block { … } // LackingPos indicates whether b is a block whose position should be inherited // from its successors. This is true if all the values within it have unreliable positions // and if it is "plain", meaning that there is no control flow that is also very likely // to correspond to a well-understood source position. func (b *Block) LackingPos() bool { … } func (b *Block) AuxIntString() string { … } // likelyBranch reports whether block b is the likely branch of all of its predecessors. func (b *Block) likelyBranch() bool { … } func (b *Block) Logf(msg string, args ...interface{ … } func (b *Block) Log() bool { … } func (b *Block) Fatalf(msg string, args ...interface{ … } type BranchPrediction … const BranchUnlikely … const BranchUnknown … const BranchLikely … type Hotness … const HotNotFlowIn … const HotInitial … const HotPgo … const HotNot … const HotInitialNotFlowIn … const HotPgoInitial … const HotPgoInitialNotFLowIn …