Documentation ¶
Index ¶
- Variables
- func CopyEdgeSlice(old []*callgraph.Edge) []*callgraph.Edge
- func CopyNodeSlice(old []*callgraph.Node) []*callgraph.Node
- func DFSPathLocalBB(bbCur, bbTarget *ssa.BasicBlock, path []*ssa.BasicBlock) (result []*ssa.BasicBlock)
- func EnumeratePathForPostDomBBs(bb1, bb2 *ssa.BasicBlock) [][]*ssa.BasicBlock
- func FindLCA(vecTargetFn []*ssa.Function, boolGiveUpWhenCallgraphIsInaccurate bool, ...) (map[*ssa.Function][]*EdgeChain, error)
- func FindSelectNexts(s *ssa.Select) (map[int]ssa.Instruction, error)
- func PathBetweenInst(inst1, inst2 ssa.Instruction) (result []*ssa.BasicBlock)
- func PathBetweenLocalInst(inst1, inst2 ssa.Instruction) (result []*ssa.BasicBlock)
- type EdgeChain
Constants ¶
This section is empty.
Variables ¶
var ErrFindNone = fmt.Errorf("Found none")
var ErrInaccurateCallgraph = fmt.Errorf("The callgraph is inaccurate: a caller has multiple callees or a callee has multiple callers")
var ErrNilNode = fmt.Errorf("Nil node in callgraph")
var ErrNotComplete = fmt.Errorf("Incomplete callchains")
var LcaErrNilNode = fmt.Errorf("Node in callgraph for target function is nil")
var LcaErrReachedMax = fmt.Errorf("Reached max layer number")
Functions ¶
func DFSPathLocalBB ¶
func DFSPathLocalBB(bbCur, bbTarget *ssa.BasicBlock, path []*ssa.BasicBlock) (result []*ssa.BasicBlock)
func EnumeratePathForPostDomBBs ¶
func EnumeratePathForPostDomBBs(bb1, bb2 *ssa.BasicBlock) [][]*ssa.BasicBlock
Enumerate all paths between bb1 and bb2. Requires that bb2 post-dominates bb1
func FindLCA ¶
func FindLCA(vecTargetFn []*ssa.Function, boolGiveUpWhenCallgraphIsInaccurate bool, boolGiveUpWhenMaxLayerIsReached bool, intMaxLayer int) (map[*ssa.Function][]*EdgeChain, error)
Find the lowest common ancestors for target functions. This function is used by two places: computing dependency and checking each channel. The configurations should be different Note 1: we can't use some classic algorithms because in callgraph one child may have multiple parents, and there may be circles in the callgraph Note 2: result is a map from one LCA to the targets it covers. It is possible that we can't find one LCA that covers every target Note 3: intMaxLayer is used if boolGiveUpWhenMaxLayerIsReached is false
func FindSelectNexts ¶
Every Select is only used in Extract. Among all Extract, only one Extract's Index is 0 (0 means obtaining the case index) This Extract will be used by N BinOp(where OP is ==), N is the number of cases (default is not counted) If the case is not empty, the next inst will be If; if the case is empty, the next inst can be anything If Select has case 0,1,2,(default), then BinOp.Y will be 0,1,2. Find the BinOp.Y == 2. If the next inst is If, default is If.Else. If the next is not If, meaning default and the last case are going to the same place
func PathBetweenInst ¶
func PathBetweenInst(inst1, inst2 ssa.Instruction) (result []*ssa.BasicBlock)
func PathBetweenLocalInst ¶
func PathBetweenLocalInst(inst1, inst2 ssa.Instruction) (result []*ssa.BasicBlock)