Rustfmt
This commit is contained in:
@@ -185,7 +185,9 @@ fn rewrite_expr(
|
|||||||
dummy_args.len(),
|
dummy_args.len(),
|
||||||
"number of arguments in instruction {} is incorrect\nexpected: {:?}",
|
"number of arguments in instruction {} is incorrect\nexpected: {:?}",
|
||||||
apply_target.inst().name,
|
apply_target.inst().name,
|
||||||
apply_target.inst().operands_in
|
apply_target
|
||||||
|
.inst()
|
||||||
|
.operands_in
|
||||||
.iter()
|
.iter()
|
||||||
.map(|operand| format!("{}: {}", operand.name, operand.kind.name))
|
.map(|operand| format!("{}: {}", operand.name, operand.kind.name))
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
|
|||||||
@@ -112,7 +112,9 @@ fn unwrap_inst(
|
|||||||
assert_eq!(inst.operands_in.len(), apply.args.len());
|
assert_eq!(inst.operands_in.len(), apply.args.len());
|
||||||
for (i, op) in inst.operands_in.iter().enumerate() {
|
for (i, op) in inst.operands_in.iter().enumerate() {
|
||||||
if op.is_varargs() {
|
if op.is_varargs() {
|
||||||
let name = var_pool.get(apply.args[i].maybe_var().expect("vararg without name")).name;
|
let name = var_pool
|
||||||
|
.get(apply.args[i].maybe_var().expect("vararg without name"))
|
||||||
|
.name;
|
||||||
fmtln!(fmt, "let {} = &{};", name, name);
|
fmtln!(fmt, "let {} = &{};", name, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use crate::cdsl::xform::{TransformGroupBuilder, TransformGroups};
|
|||||||
|
|
||||||
use crate::shared::immediates::Immediates;
|
use crate::shared::immediates::Immediates;
|
||||||
use crate::shared::types::Float::{F32, F64};
|
use crate::shared::types::Float::{F32, F64};
|
||||||
use crate::shared::types::Int::{I16, I128, I32, I64, I8};
|
use crate::shared::types::Int::{I128, I16, I32, I64, I8};
|
||||||
|
|
||||||
pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGroups {
|
pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGroups {
|
||||||
let mut narrow = TransformGroupBuilder::new(
|
let mut narrow = TransformGroupBuilder::new(
|
||||||
@@ -245,8 +245,20 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro
|
|||||||
def!(brz.I128(x, ebb, vararg)),
|
def!(brz.I128(x, ebb, vararg)),
|
||||||
vec![
|
vec![
|
||||||
def!((xl, xh) = isplit(x)),
|
def!((xl, xh) = isplit(x)),
|
||||||
def!(a = icmp_imm(Literal::enumerator_for(intcc, "eq"), xl, Literal::constant(imm64, 0))),
|
def!(
|
||||||
def!(b = icmp_imm(Literal::enumerator_for(intcc, "eq"), xh, Literal::constant(imm64, 0))),
|
a = icmp_imm(
|
||||||
|
Literal::enumerator_for(intcc, "eq"),
|
||||||
|
xl,
|
||||||
|
Literal::constant(imm64, 0)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
def!(
|
||||||
|
b = icmp_imm(
|
||||||
|
Literal::enumerator_for(intcc, "eq"),
|
||||||
|
xh,
|
||||||
|
Literal::constant(imm64, 0)
|
||||||
|
)
|
||||||
|
),
|
||||||
def!(c = band(a, b)),
|
def!(c = band(a, b)),
|
||||||
def!(brz(c, ebb, vararg)),
|
def!(brz(c, ebb, vararg)),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ fn legalize_inst(
|
|||||||
return LegalizeInstResult::SplitLegalizePending;
|
return LegalizeInstResult::SplitLegalizePending;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ir::ValueDef::Param(ebb, num) => {},
|
ir::ValueDef::Param(ebb, num) => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let res = pos.func.dfg.inst_results(inst).to_vec();
|
let res = pos.func.dfg.inst_results(inst).to_vec();
|
||||||
|
|||||||
@@ -129,15 +129,18 @@ fn split_any(
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn split_ebb_params(
|
pub fn split_ebb_params(func: &mut ir::Function, cfg: &ControlFlowGraph, ebb: Ebb) {
|
||||||
func: &mut ir::Function,
|
|
||||||
cfg: &ControlFlowGraph,
|
|
||||||
ebb: Ebb,
|
|
||||||
) {
|
|
||||||
let mut repairs = Vec::new();
|
let mut repairs = Vec::new();
|
||||||
let pos = &mut FuncCursor::new(func).at_top(ebb);
|
let pos = &mut FuncCursor::new(func).at_top(ebb);
|
||||||
|
|
||||||
for (num, ebb_param) in pos.func.dfg.ebb_params(ebb).to_vec().into_iter().enumerate() {
|
for (num, ebb_param) in pos
|
||||||
|
.func
|
||||||
|
.dfg
|
||||||
|
.ebb_params(ebb)
|
||||||
|
.to_vec()
|
||||||
|
.into_iter()
|
||||||
|
.enumerate()
|
||||||
|
{
|
||||||
let ty = pos.func.dfg.value_type(ebb_param);
|
let ty = pos.func.dfg.value_type(ebb_param);
|
||||||
if ty != ir::types::I128 {
|
if ty != ir::types::I128 {
|
||||||
continue;
|
continue;
|
||||||
@@ -149,11 +152,7 @@ pub fn split_ebb_params(
|
|||||||
perform_repairs(pos, cfg, repairs);
|
perform_repairs(pos, cfg, repairs);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn perform_repairs(
|
fn perform_repairs(pos: &mut FuncCursor, cfg: &ControlFlowGraph, mut repairs: Vec<Repair>) {
|
||||||
pos: &mut FuncCursor,
|
|
||||||
cfg: &ControlFlowGraph,
|
|
||||||
mut repairs: Vec<Repair>,
|
|
||||||
) {
|
|
||||||
// We have split the value requested, and now we may need to fix some EBB predecessors.
|
// We have split the value requested, and now we may need to fix some EBB predecessors.
|
||||||
while let Some(repair) = repairs.pop() {
|
while let Some(repair) = repairs.pop() {
|
||||||
for BasicBlock { inst, .. } in cfg.pred_iter(repair.ebb) {
|
for BasicBlock { inst, .. } in cfg.pred_iter(repair.ebb) {
|
||||||
|
|||||||
Reference in New Issue
Block a user