add List.len

This commit is contained in:
Brendan Hansknecht 2022-02-19 16:01:59 -08:00
parent a39f610395
commit cf8d294ec1
3 changed files with 31 additions and 0 deletions

View file

@ -550,6 +550,14 @@ trait Backend<'a> {
arg_layouts,
ret_layout,
),
LowLevel::ListLen => {
debug_assert_eq!(
1,
args.len(),
"ListLen: expected to have exactly one argument"
);
self.build_list_len(sym, &args[0])
}
LowLevel::StrConcat => self.build_fn_call(
sym,
bitcode::STR_CONCAT.to_string(),
@ -685,6 +693,9 @@ trait Backend<'a> {
arg_layout: &Layout<'a>,
);
/// build_list_len returns the length of a list.
fn build_list_len(&mut self, dst: &Symbol, list: &Symbol);
/// build_refcount_getptr loads the pointer to the reference count of src into dst.
fn build_ptr_cast(&mut self, dst: &Symbol, src: &Symbol);