go/src/cmd/compile/internal/walk/switch.go

// walkSwitch walks a switch statement.
func walkSwitch(sw *ir.SwitchStmt) {}

// walkSwitchExpr generates an AST implementing sw.  sw is an
// expression switch.
func walkSwitchExpr(sw *ir.SwitchStmt) {}

type exprSwitch

type exprClause

func (s *exprSwitch) Add(pos src.XPos, expr, rtype, jmp ir.Node) {}

func (s *exprSwitch) Emit(out *ir.Nodes) {}

func (s *exprSwitch) flush() {}

func (s *exprSwitch) search(cc []exprClause, out *ir.Nodes) {}

// Try to implement the clauses with a jump table. Returns true if successful.
func (s *exprSwitch) tryJumpTable(cc []exprClause, out *ir.Nodes) bool {}

func (c *exprClause) test(exprname ir.Node) ir.Node {}

func allCaseExprsAreSideEffectFree(sw *ir.SwitchStmt) bool {}

// endsInFallthrough reports whether stmts ends with a "fallthrough" statement.
func endsInFallthrough(stmts []ir.Node) (bool, src.XPos) {}

// walkSwitchType generates an AST that implements sw, where sw is a
// type switch.
func walkSwitchType(sw *ir.SwitchStmt) {}

var interfaceSwitchGen

// typeHashFieldOf returns an expression to select the type hash field
// from an interface's descriptor word (whether a *runtime._type or
// *runtime.itab pointer).
func typeHashFieldOf(pos src.XPos, itab *ir.UnaryExpr) *ir.SelectorExpr {}

var (
	rtypeHashField
	itabHashField
)

type typeSwitch

type typeClause

func (s *typeSwitch) flush(cc []typeClause, compiled *ir.Nodes) {}

// Try to implement the clauses with a jump table. Returns true if successful.
func (s *typeSwitch) tryJumpTable(cc []typeClause, out *ir.Nodes) bool {}

// binarySearch constructs a binary search tree for handling n cases,
// and appends it to out. It's used for efficiently implementing
// switch statements.
//
// less(i) should return a boolean expression. If it evaluates true,
// then cases before i will be tested; otherwise, cases i and later.
//
// leaf(i, nif) should setup nif (an OIF node) to test case i. In
// particular, it should set nif.Cond and nif.Body.
func binarySearch(n int, out *ir.Nodes, less func(i int) ir.Node, leaf func(i int, nif *ir.IfStmt)) {}

func stringSearch(expr ir.Node, cc []exprClause, out *ir.Nodes) {}