Stream: cranelift

Topic: LibCall


view this post on Zulip Chris Clark (Sep 21 2023 at 03:49):

I'm getting into cranelift module and object now. Very exciting. I do not know what Libcall means.

        ObjectBuilder::new(isa, "main", cranelift_module::default_libcall_names()).unwrap();

I tried going to the docs, and found this page, https://docs.rs/cranelift-codegen/0.100.0/cranelift_codegen/ir/enum.LibCall.html but still not sure.

view this post on Zulip Afonso Bordado (Sep 21 2023 at 09:56):

:wave: Hey, Libcall's in cranelift are sort of well known library functions that we may have to use when lowering.

An example of this is for example FmaF64, if you try to use fma but don't have that instruction natively available in your CPU we may instead call the FmaF64 library function that performs that computation.

Usually these have well known names, so we provide default_libcall_names with those, but if your environment is weird, you may want to provide a custom translation function that uses a different name.

The actual implementation of those functions will then be provided by whatever runtime library you link with, like glibc or musl.


Last updated: Nov 22 2024 at 16:03 UTC