irwalk

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package irwalk provides the nil-guarded gIR traversal iterators shared by the analysis passes, the frontends' whole-program rewrites, and converter tests. Use them instead of hand-writing the four-deep `module → function → block → instruction` nest, where a pass can silently forget a nil check.

These are range-over-func iterators, so `continue`/`break`/`return` behaves as in a plain loop. Every consumer runs ONCE per scan, so the per-element closure call is not hot; the engine's per-(function × rule) inner loops are deliberately left as hand-written loops.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Calls

func Calls(prog *ir.Program) iter.Seq[*ir.CallCommon]

Calls yields the CallCommon of every CALL/INVOKE instruction in prog.

func Funcs

func Funcs(prog *ir.Program) iter.Seq2[*ir.Module, *ir.Function]

Funcs yields every non-nil function in prog with its owning module.

func Instrs

func Instrs(fn *ir.Function) iter.Seq[*ir.Instruction]

Instrs yields every non-nil instruction of fn.

func SetCallee

func SetCallee(cc *ir.CallCommon, name string)

SetCallee rewrites a call's resolved callee to name, keeping the call's function-value operand (when it names a function) in sync — the two fields name the same callee, and a rewrite that updated only Callee would leave a stale FuncName behind for any pass that reads the operand.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL