Skip to content

v2.mir #

fn lower_from_ssa #

fn lower_from_ssa(ssa_mod &ssa.Module) Module

enum AbiArgClass #

enum AbiArgClass {
	in_reg
	indirect
}

enum ValueKind #

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

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
pub mut:
	blocks           []ssa.BlockID
	params           []ssa.ValueID
	abi_ret_indirect bool
	abi_param_class  []AbiArgClass
}

struct Instruction #

struct Instruction {
pub mut:
	op               ssa.OpCode
	operands         []ssa.ValueID
	selected_op      string
	abi_ret_indirect bool
	abi_arg_class    []AbiArgClass
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) ssa #

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

fn (Module) type_size #

fn (m &Module) type_size(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
}