Skip to content

v2.mir

fn lower_from_ssa #

fn lower_from_ssa(ssa_mod &ssa.Module) Module

fn AbiArgClass.from #

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

fn AbiEightbyteClass.from #

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

fn AbiLocationKind.from #

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

fn AbiPassMode.from #

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

fn ValueKind.from #

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

enum AbiArgClass #

enum AbiArgClass as u8 {
	in_reg
	indirect
}

enum AbiEightbyteClass #

enum AbiEightbyteClass {
	no_class
	integer
	sse
	sseup
	memory
}

enum AbiLocationKind #

enum AbiLocationKind {
	none
	int_reg
	sse_reg
	stack
}

enum AbiPassMode #

enum AbiPassMode {
	direct
	indirect
}

Classification metadata for future ABI-aware codegen. The active x64 lowering path still consumes the legacy abi_*_class and abi_ret_indirect projection fields in this palier.

enum ValueKind #

enum ValueKind {
	unknown
	constant
	argument
	global
	instruction
	basic_block
	string_literal
	c_string_literal
	func_ref
}

fn (ValueKind) str #

fn (k ValueKind) str() string

str returns the symbolic name for a MIR value kind.

struct AbiLocation #

struct AbiLocation {
pub mut:
	kind   AbiLocationKind
	index  int
	offset int
	class  AbiEightbyteClass
}

struct AbiValueClass #

struct AbiValueClass {
pub mut:
	mode    AbiPassMode
	size    int
	classes []AbiEightbyteClass
}

struct AbiValueLayout #

struct AbiValueLayout {
pub mut:
	value_class AbiValueClass
	locs        []AbiLocation
}

struct BasicBlock #

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

struct Function #

struct Function {
pub:
	id          int
	name        string
	typ         ssa.TypeID
	linkage     ssa.Linkage
	call_conv   ssa.CallConv
	is_c_extern bool // C-language extern function (provided by libc/system libraries)
pub mut:
	blocks            []ssa.BlockID
	params            []ssa.ValueID
	abi_ret_indirect  bool
	abi_param_class   []AbiArgClass
	abi_ret_class     AbiValueClass
	abi_param_classes []AbiValueClass
	abi_param_layouts []AbiValueLayout
}

struct Instruction #

struct Instruction {
pub mut:
	op               ssa.OpCode
	operands         []ssa.ValueID
	abi_ret_indirect bool
	abi_arg_class    []AbiArgClass
	abi_ret_class    AbiValueClass
	abi_arg_classes  []AbiValueClass
	abi_arg_layouts  []AbiValueLayout
pub:
	typ       ssa.TypeID
	block     int
	src_index int
}

struct Module #

@[heap]
struct Module {
pub:
	name    string
	target  ssa.TargetData
	ssa_mod &ssa.Module        = unsafe { nil }
	env     &types.Environment = unsafe { nil }
pub mut:
	type_store ssa.TypeStore
	values     []Value
	instrs     []Instruction
	blocks     []BasicBlock
	funcs      []Function
	globals    []ssa.GlobalVar
}

fn (Module) release_after_native_codegen #

fn (mut m Module) release_after_native_codegen()

release_after_native_codegen releases MIR storage after native codegen has copied everything it needs into the object writer/linker.

fn (Module) ssa #

fn (m &Module) ssa() &ssa.Module

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 Value #

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