ssainspect

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: MIT Imports: 8 Imported by: 5

README

ssainspect

pkgo.dev

This project is EXPERIMENTAL status. Do NOT use it for your production.

Author

Appify Technologies, Inc.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "ssainspect",
	Doc:  "make an Inspector",
	Run:  runAnalyzer,
	Requires: []*analysis.Analyzer{
		buildssa.Analyzer,
	},
	ResultType: reflect.TypeFor[*Inspector](),
}

Functions

func All

func All(funcs []*ssa.Function) iter.Seq[*Cursor]

All returns an iterator which inspects all SSA functions, basic blocks and instructions.

Types

type Cursor

type Cursor struct {
	Func       *ssa.Function
	Block      *ssa.BasicBlock
	Instr      ssa.Instruction
	InstrIndex int
}

Cursor holds the current function, block and instruction in iteration by All.

func (*Cursor) FirstBlock added in v0.2.0

func (cur *Cursor) FirstBlock() bool

FirstBlock returns whether cur.Block is a first block in the function.

func (*Cursor) FirstInstr

func (cur *Cursor) FirstInstr() bool

FirstInstr returns whether cur.Instruction is a first instruction in the block.

func (*Cursor) InCycle

func (cur *Cursor) InCycle() bool

InCycle returns whether the block is in cycle (loop).

type Inspector added in v0.3.0

type Inspector struct {
	// contains filtered or unexported fields
}

Inspector provides an iterator which iterats all SSA functions, basic blocks and instructions.

func New added in v0.3.0

func New(funcs []*ssa.Function) *Inspector

New creates Inspector.

func (*Inspector) All added in v0.3.0

func (i *Inspector) All() iter.Seq[*Cursor]

All returns an iterator which inspects all SSA functions, basic blocks and instructions. The iteration result is cached in Inspector.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳