Skip to content
Snippets Groups Projects

Misc. preparations for multi-core support.

Merged rarbore2 requested to merge multicore into main
Files
16
+ 72
0
@@ -407,6 +407,78 @@ impl<'a> RTContext<'a> {
write!(block, ");\n")?;
}
}
Node::Unary { op, input } => {
let block = &mut blocks.get_mut(&self.bbs.0[id.idx()]).unwrap();
match op {
UnaryOperator::Not => write!(
block,
" {} = !{};\n",
self.get_value(id),
self.get_value(input)
)?,
UnaryOperator::Neg => write!(
block,
" {} = -{};\n",
self.get_value(id),
self.get_value(input)
)?,
UnaryOperator::Cast(ty) => write!(
block,
" {} = {} as {};\n",
self.get_value(id),
self.get_value(input),
self.get_type(ty)
)?,
};
}
Node::Binary { op, left, right } => {
let block = &mut blocks.get_mut(&self.bbs.0[id.idx()]).unwrap();
let op = match op {
BinaryOperator::Add => "+",
BinaryOperator::Sub => "-",
BinaryOperator::Mul => "*",
BinaryOperator::Div => "/",
BinaryOperator::Rem => "%",
BinaryOperator::LT => "<",
BinaryOperator::LTE => "<=",
BinaryOperator::GT => ">",
BinaryOperator::GTE => ">=",
BinaryOperator::EQ => "==",
BinaryOperator::NE => "!=",
BinaryOperator::Or => "|",
BinaryOperator::And => "&",
BinaryOperator::Xor => "^",
BinaryOperator::LSh => "<<",
BinaryOperator::RSh => ">>",
};
write!(
block,
" {} = {} {} {};\n",
self.get_value(id),
self.get_value(left),
op,
self.get_value(right)
)?;
}
Node::Ternary {
op,
first,
second,
third,
} => {
let block = &mut blocks.get_mut(&self.bbs.0[id.idx()]).unwrap();
match op {
TernaryOperator::Select => write!(
block,
" {} = if {} {{ {} }} else {{ {} }};\n",
self.get_value(id),
self.get_value(first),
self.get_value(second),
self.get_value(third),
)?,
};
}
Node::Read {
collect,
ref indices,
Loading