MCPcopy Create free account
hub / github.com/decomp/decomp / IsValid

Method IsValid

cfa/seq.go:90–106  ·  view source on GitHub ↗

IsValid reports whether the entry and exit node candidates of prim form a valid sequence of two statements in g. Control flow graph: entry ↓ exit

(g graph.Directed, dom cfg.DominatorTree)

Source from the content-addressed store, hash-verified

88// ↓
89// exit
90func (prim Seq) IsValid(g graph.Directed, dom cfg.DominatorTree) bool {
91 // Dominator sanity check.
92 entry, exit := prim.Entry, prim.Exit
93 if !dom.Dominates(entry, exit) {
94 return false
95 }
96
97 // Verify that entry has one successor (exit).
98 entrySuccs := g.From(entry)
99 if len(entrySuccs) != 1 || !g.HasEdgeFromTo(entry, exit) {
100 return false
101 }
102
103 // Verify that exit has one predecessor (entry).
104 exitPreds := g.To(exit)
105 return len(exitPreds) == 1
106}

Callers 1

FindSeqFunction · 0.45

Calls 1

DominatesMethod · 0.80

Tested by

no test coverage detected