type sanity … // sanityCheck performs integrity checking of the SSA representation // of the function fn and returns true if it was valid. Diagnostics // are written to reporter if non-nil, os.Stderr otherwise. Some // diagnostics are only warnings and do not imply a negative result. // // Sanity-checking is intended to facilitate the debugging of code // transformation passes. func sanityCheck(fn *Function, reporter io.Writer) bool { … } // mustSanityCheck is like sanityCheck but panics instead of returning // a negative result. func mustSanityCheck(fn *Function, reporter io.Writer) { … } func (s *sanity) diagnostic(prefix, format string, args ...interface{ … } func (s *sanity) errorf(format string, args ...interface{ … } func (s *sanity) warnf(format string, args ...interface{ … } // findDuplicate returns an arbitrary basic block that appeared more // than once in blocks, or nil if all were unique. func findDuplicate(blocks []*BasicBlock) *BasicBlock { … } func (s *sanity) checkInstr(idx int, instr Instruction) { … } func (s *sanity) checkFinalInstr(instr Instruction) { … } func (s *sanity) checkBlock(b *BasicBlock, index int) { … } func (s *sanity) checkReferrerList(v Value) { … } func (s *sanity) checkFunctionParams() { … } // checkTransientFields checks whether all transient fields of Function are cleared. func (s *sanity) checkTransientFields() { … } func (s *sanity) checkFunction(fn *Function) bool { … } // sanityCheckPackage checks invariants of packages upon creation. // It does not require that the package is built. // Unlike sanityCheck (for functions), it just panics at the first error. func sanityCheckPackage(pkg *Package) { … }