Skip to content
Snippets Groups Projects
Commit 614207d1 authored by Russel Arbore's avatar Russel Arbore
Browse files

Compile dynamic constant math to sched IR

parent b98e2a33
No related branches found
No related tags found
1 merge request!34Dynamic Constant Math
This commit is part of merge request !34. Comments created here will be created in the context of that merge request.
......@@ -1213,7 +1213,7 @@ impl<'a> FunctionContext<'a> {
fn compile_dynamic_constant(
&self,
dc: DynamicConstantID,
_block: &mut SBlock,
block: &mut SBlock,
partition_idx: usize,
manifest: &Manifest,
) -> SValue {
......@@ -1228,6 +1228,30 @@ impl<'a> FunctionContext<'a> {
.position(|(_, kind)| *kind == ParameterKind::DynamicConstant(idx))
.unwrap(),
),
DynamicConstant::Add(left, right)
| DynamicConstant::Sub(left, right)
| DynamicConstant::Mul(left, right)
| DynamicConstant::Div(left, right) => {
let left = self.compile_dynamic_constant(left, block, partition_idx, manifest);
let right = self.compile_dynamic_constant(right, block, partition_idx, manifest);
let output_virt_reg = self.make_virt_reg(partition_idx);
block.insts.push(SInst::Binary {
left,
right,
op: match self.dynamic_constants[dc.idx()] {
DynamicConstant::Add(_, _) => SBinaryOperator::Add,
DynamicConstant::Sub(_, _) => SBinaryOperator::Sub,
DynamicConstant::Mul(_, _) => SBinaryOperator::Mul,
DynamicConstant::Div(_, _) => SBinaryOperator::Div,
_ => panic!(),
},
});
block
.virt_regs
.push((output_virt_reg, SType::UnsignedInteger64));
SValue::VirtualRegister(output_virt_reg)
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment