Merge remote-tracking branch 'origin/trunk' into layout-builtin-numbers-refactor

This commit is contained in:
Folkert 2021-11-21 19:22:32 +01:00
commit 64869ffb8b
17 changed files with 704 additions and 661 deletions

View file

@ -433,6 +433,23 @@ where
);
self.build_neq(sym, &args[0], &args[1], &arg_layouts[0])
}
LowLevel::NumLt => {
debug_assert_eq!(
2,
args.len(),
"NumLt: expected to have exactly two argument"
);
debug_assert_eq!(
arg_layouts[0], arg_layouts[1],
"NumLt: expected all arguments of to have the same layout"
);
debug_assert_eq!(
Layout::Builtin(Builtin::Int1),
*ret_layout,
"NumLt: expected to have return layout of type I1"
);
self.build_num_lt(sym, &args[0], &args[1], &arg_layouts[0])
}
LowLevel::NumRound => self.build_fn_call(
sym,
bitcode::NUM_ROUND[FloatWidth::F64].to_string(),
@ -523,6 +540,15 @@ where
arg_layout: &Layout<'a>,
) -> Result<(), String>;
/// build_num_lt stores the result of `src1 < src2` into dst.
fn build_num_lt(
&mut self,
dst: &Symbol,
src1: &Symbol,
src2: &Symbol,
arg_layout: &Layout<'a>,
) -> Result<(), String>;
/// literal_map gets the map from symbol to literal, used for lazy loading and literal folding.
fn literal_map(&mut self) -> &mut MutMap<Symbol, Literal<'a>>;