Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IROpToBytecode ¶
IROpToBytecode returns the bytecode OP_* constant corresponding to the given IR op. Returns vm.OP_NOOP for ops without a direct bytecode counterpart.
func IsCheapMaterializeOp ¶
IsCheapMaterializeOp reports whether op is one of the cheap-to- re-emit loads (Const, LoadArg, LoadVar, LoadClosed). Used by the lowerer's body-emit policy and use-site materialization fallback.
Types ¶
type Op ¶
type Op uint16
Op is the kind of an IR node.
const ( OpInvalid Op = iota OpConst // .Aux = vm.Value (the constant; lowered as OP_LOAD_CONST with interned index) OpLoadArg // .Aux = int (arg index) OpLoadVar // .Aux = *vm.Var; var roots are mutable OpLoadClosed // .Aux = int (closed-over index) OpBlockArg // block parameter OpSetVar // .Refs[0] = var (Const aux=*vm.Var), .Refs[1] = value; pushes var back OpCall // .Refs[0] = fn, .Refs[1:] = args; .Aux = arity int OpTailCall // tail call ends a block OpAdd OpSub OpMul OpLt OpLte OpGt OpGte OpEq OpInc OpDec OpPop // discard top stack value; no result (OP_POP) OpReturn // .Refs[0] = value OpBranch // unconditional; .Aux = *BranchTarget OpBranchIf // .Refs[0] = cond; .Aux = struct{True,False *BranchTarget} OpMakeClosure // .Refs[0] = *Func value (the func to wrap as a closure) OpPushClosed // .Refs[0] = closure, .Refs[1] = value to attach )
func OpByKeyword ¶
OpByKeyword looks up an Op by its keyword name. The match is case-insensitive AND dash-insensitive, so "load-arg", "loadarg", and "LoadArg" all match opTable entry "LoadArg".
Used by Lisp-side IR construction primitives, where ops are passed as kebab-case keywords (the Clojure idiom).
func (Op) IsTerminator ¶
IsTerminator reports whether op ends a basic block.