Skip to content

v3.mir

fn arm64_target #

fn arm64_target() Target

arm64_target returns the target descriptor used by the native ARM64 pipeline.

fn default_target #

fn default_target() Target

default_target returns a conservative target descriptor for target-neutral MIR.

fn lower_from_ssa #

fn lower_from_ssa(m &ssa.Module) Module

lower_from_ssa lowers an SSA module into target-neutral MIR.

fn lower_from_ssa_for_target #

fn lower_from_ssa_for_target(m &ssa.Module, target Target) Module

lower_from_ssa_for_target lowers an SSA module into MIR with target ABI metadata.

fn AbiKind.from #

fn AbiKind.from[W](input W) !AbiKind

fn AbiLocationKind.from #

fn AbiLocationKind.from[W](input W) !AbiLocationKind

fn TargetArch.from #

fn TargetArch.from[W](input W) !TargetArch

enum AbiKind #

enum AbiKind {
	unknown
	aapcs64
}

enum AbiLocationKind #

enum AbiLocationKind {
	none
	register
	stack
	indirect
}

enum TargetArch #

enum TargetArch {
	unknown
	arm64
}

struct AbiLocation #

struct AbiLocation {
pub:
	kind           AbiLocationKind
	register_index int
	register_count int
	stack_offset   int
	size           int
}

struct BasicBlock #

struct BasicBlock {
pub mut:
	id     int
	name   string
	parent int
	instrs []ssa.ValueID
	preds  []ssa.BlockID
	succs  []ssa.BlockID
}

struct Function #

struct Function {
pub mut:
	id          int
	name        string
	typ         ssa.TypeID
	blocks      []ssa.BlockID
	params      []ssa.ValueID
	is_c_extern bool
	abi         FunctionAbi
}

struct FunctionAbi #

struct FunctionAbi {
pub:
	params          []AbiLocation
	ret             AbiLocation
	stack_args_size int
	stack_align     int
}

struct Instruction #

struct Instruction {
pub mut:
	op       ssa.OpCode
	operands []ssa.ValueID
	typ      ssa.TypeID
	block    int
}

struct Module #

@[heap]
struct Module {
pub mut:
	target     Target
	type_store ssa.TypeStore
	values     []Value
	instrs     []Instruction
	blocks     []BasicBlock
	funcs      []Function
	globals    []ssa.GlobalVar
}

fn (Module) type_size #

fn (m &Module) type_size(typ_id ssa.TypeID) int

fn (Module) type_align #

fn (m &Module) type_align(typ_id ssa.TypeID) int

struct Target #

struct Target {
pub:
	arch         TargetArch
	abi          AbiKind
	pointer_size int
	int_arg_regs int
	ret_regs     int
	stack_align  int
}

struct Value #

struct Value {
pub mut:
	id    int
	kind  ssa.ValueKind
	typ   ssa.TypeID
	name  string
	index int
	uses  []ssa.ValueID
}