ISA lowering from MilkIR to MachV
Dependencies
///|
fn readme_call_conv() -> @abi.CallConventionLayout {
{
context_arg: { index: 0, class: Int },
user_arg_gprs: [{ index: 1, class: Int }, { index: 2, class: Int }],
arg_fprs: [],
ret_gprs: [{ index: 0, class: Int }],
ret_fprs: [],
}
}
///|
test "lower a leaf MilkIR function to AArch64 MachV" {
let builder = @milkir.IRBuilder::new("leaf")
let entry = builder.create_block()
builder.switch_to_block(entry)
builder.return_([])
let lowered = @lower.lower_function(
builder.get_function(),
isa=AArch64,
call_conv_layout=Some(readme_call_conv()),
)
inspect(lowered.get_name(), content="leaf")
inspect(lowered.get_blocks().length(), content="1")
inspect(lowered.has_calls(), content="false")
}///|
test "optimize an explicitly targeted MachV function" {
let builder = @milkir.IRBuilder::new("empty_return")
let entry = builder.create_block()
builder.switch_to_block(entry)
builder.return_([])
let lowered = @lower.lower_function(
builder.get_function(),
isa=AMD64,
call_conv_layout=Some(readme_call_conv()),
)
@lower.optimize_machv(lowered, isa=AMD64)
inspect(lowered.get_blocks().length(), content="1")
inspect(lowered.print().contains("return"), content="true")
}ISA lowering from MilkIR to MachV
Dependencies