mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-17 01:05:02 +00:00
missing functions for dev backend for glue
This commit is contained in:
parent
e2dac4f022
commit
1e744dca7c
9 changed files with 113 additions and 17 deletions
|
@ -2019,6 +2019,24 @@ trait Backend<'a> {
|
|||
self.build_num_cmp(sym, &args[0], &args[1], &arg_layouts[0]);
|
||||
}
|
||||
|
||||
LowLevel::NumToFloatCast => {
|
||||
let float_width = match *ret_layout {
|
||||
Layout::F64 => FloatWidth::F64,
|
||||
Layout::F32 => FloatWidth::F32,
|
||||
_ => unreachable!("invalid return layout for NumToFloatCast"),
|
||||
};
|
||||
|
||||
match arg_layouts[0].try_to_int_width() {
|
||||
Some(int_width) => {
|
||||
self.build_int_to_float_cast(sym, &args[0], int_width, float_width);
|
||||
}
|
||||
None => {
|
||||
//
|
||||
todo!("other NumToFloatCast cases");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x => todo!("low level, {:?}", x),
|
||||
}
|
||||
}
|
||||
|
@ -2135,6 +2153,14 @@ trait Backend<'a> {
|
|||
target: IntWidth,
|
||||
);
|
||||
|
||||
fn build_int_to_float_cast(
|
||||
&mut self,
|
||||
dst: &Symbol,
|
||||
src: &Symbol,
|
||||
int_width: IntWidth,
|
||||
float_width: FloatWidth,
|
||||
);
|
||||
|
||||
/// build_num_abs stores the absolute value of src into dst.
|
||||
fn build_num_abs(&mut self, dst: &Symbol, src: &Symbol, layout: &InLayout<'a>);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue