Skip to main content

generate_enzyme_call

Function generate_enzyme_call 

Source
pub(crate) fn generate_enzyme_call<'ll, 'tcx>(
    builder: &mut GenericBuilder<'_, 'll, FullCx<'ll, 'tcx>>,
    cx: &GenericCx<'ll, SCx<'ll>>,
    fn_to_diff: &'ll Value,
    outer_name: &str,
    ret_ty: &'ll Type,
    fn_args: &[&'ll Value],
    attrs: &RustcAutodiff,
    dest_layout: TyAndLayout<'tcx>,
    dest_place: Option<PlaceValue<&'ll Value>>,
    fnc_tree: FncTree,
) -> IntrinsicResult<'tcx, &'ll Value>
Expand description

When differentiating fn_to_diff, take a outer_fn and generate another function with expected naming and calling conventions1 which will be discovered by the enzyme LLVM pass and its body populated with the differentiated fn_to_diff. outer_fn is then modified to have a call to the generated function and handle the differences between the Rust calling convention and Enzyme.