unsafe fn populate_defaults(&mut self) {
        use super::llvm_exts::LLVMExtAttribute::*;

        let int8p = LLVMPointerType(self.i8_type(), 0);

        // Defines the default intrinsics used by the Weld runtime.
        let mut params = vec![self.i32_type(), self.i64_type()];
        let name = CString::new("weld_runst_init").unwrap();
        let fn_type = LLVMFunctionType(
            self.run_handle_type(),
            params.as_mut_ptr(),
            params.len() as u32,
            0,
        );
        let function = LLVMAddFunction(self.module, name.as_ptr(), fn_type);
        self.intrinsics.insert(
            name.into_string().unwrap(),
            Intrinsic::FunctionPointer(function, ffi::weld_runst_init as *mut c_void),
        );

        let mut params = vec![self.run_handle_type()];
        let name = CString::new("weld_runst_get_result").unwrap();
        let fn_type = LLVMFunctionType(int8p, params.as_mut_ptr(), params.len() as u32, 0);
        let function = LLVMAddFunction(self.module, name.as_ptr(), fn_type);
        LLVMExtAddAttrsOnFunction(self.context, function, &[NoUnwind]);
        LLVMExtAddAttrsOnParameter(
            self.context,
            function,
            &[NoCapture, NoAlias, NonNull, ReadOnly],
            0,
        );
        self.intrinsics.insert(
            name.into_string().unwrap(),
            Intrinsic::FunctionPointer(function, ffi::weld_runst_get_result as *mut c_void),
        );

        let mut params = vec![self.run_handle_type(), int8p];
        let name = CString::new("weld_runst_set_result").unwrap();
        let fn_type = LLVMFunctionType(
            self.void_type(),
            params.as_mut_ptr(),
            params.len() as u32,
            0,
        );
        let function = LLVMAddFunction(self.module, name.as_ptr(), fn_type);
        LLVMExtAddAttrsOnFunction(self.context, function, &[NoUnwind]);
        LLVMExtAddAttrsOnParameter(self.context, function, &[NoCapture, NoAlias, NonNull], 0);
        self.intrinsics.insert(
            name.into_string().unwrap(),
            Intrinsic::FunctionPointer(function, ffi::weld_runst_set_result as *mut c_void),
        );

        let mut params = vec![self.run_handle_type(), self.i64_type()];
        let name = CString::new("weld_runst_malloc").unwrap();
        let fn_type = LLVMFunctionType(int8p, params.as_mut_ptr(), params.len() as u32, 0);
        let function = LLVMAddFunction(self.module, name.as_ptr(), fn_type);
        LLVMExtAddAttrsOnParameter(self.context, function, &[NoCapture, NoAlias, NonNull], 0);
        LLVMExtAddAttrsOnReturn(self.context, function, &[NoAlias]);
        self.intrinsics.insert(
            name.into_string().unwrap(),
            Intrinsic::FunctionPointer(function, ffi::weld_runst_malloc as *mut c_void),
        );

        let mut params = vec![self.run_handle_type(), int8p, self.i64_type()];
        let name = CString::new("weld_runst_realloc").unwrap();
        let fn_type = LLVMFunctionType(int8p, params.as_mut_ptr(), params.len() as u32, 0);
        let function = LLVMAddFunction(self.module, name.as_ptr(), fn_type);
        LLVMExtAddAttrsOnParameter(self.context, function, &[NoCapture, NoAlias, NonNull], 0);
        LLVMExtAddAttrsOnReturn(self.context, function, &[NoAlias]);
        self.intrinsics.insert(
            name.into_string().unwrap(),
            Intrinsic::FunctionPointer(function, ffi::weld_runst_realloc as *mut c_void),
        );

        let mut params = vec![self.run_handle_type(), int8p];
        let name = CString::new("weld_runst_free").unwrap();
        let fn_type = LLVMFunctionType(
            self.void_type(),
            params.as_mut_ptr(),
            params.len() as u32,
            0,
        );
        let function = LLVMAddFunction(self.module, name.as_ptr(), fn_type);
        LLVMExtAddAttrsOnParameter(self.context, function, &[NoCapture, NoAlias, NonNull], 0);
        self.intrinsics.insert(
            name.into_string().unwrap(),
            Intrinsic::FunctionPointer(function, ffi::weld_runst_free as *mut c_void),
        );

        let mut params = vec![self.run_handle_type()];
        let name = CString::new("weld_runst_get_errno").unwrap();
        let fn_type =
            LLVMFunctionType(self.i64_type(), params.as_mut_ptr(), params.len() as u32, 0);
        let function = LLVMAddFunction(self.module, name.as_ptr(), fn_type);
        LLVMExtAddAttrsOnFunction(self.context, function, &[NoUnwind]);
        LLVMExtAddAttrsOnParameter(
            self.context,
            function,
            &[NoCapture, NoAlias, NonNull, ReadOnly],
            0,
        );
        self.intrinsics.insert(
            name.into_string().unwrap(),
            Intrinsic::FunctionPointer(function, ffi::weld_runst_get_errno as *mut c_void),
        );

        let mut params = vec![self.run_handle_type(), self.i64_type()];
        let name = CString::new("weld_runst_set_errno").unwrap();
        let fn_type = LLVMFunctionType(
            self.void_type(),
            params.as_mut_ptr(),
            params.len() as u32,
            0,
        );
        let function = LLVMAddFunction(self.module, name.as_ptr(), fn_type);
        LLVMExtAddAttrsOnFunction(self.context, function, &[NoReturn]);
        LLVMExtAddAttrsOnParameter(self.context, function, &[NoCapture, NoAlias, NonNull], 0);
        self.intrinsics.insert(
            name.into_string().unwrap(),
            Intrinsic::FunctionPointer(function, ffi::weld_runst_set_errno as *mut c_void),
        );

        let mut params = vec![self.run_handle_type(), self.bool_type()];
        let name = CString::new("weld_runst_assert").unwrap();
        let fn_type = LLVMFunctionType(
            self.bool_type(),
            params.as_mut_ptr(),
            params.len() as u32,
            0,
        );
        let function = LLVMAddFunction(self.module, name.as_ptr(), fn_type);
        LLVMExtAddAttrsOnParameter(self.context, function, &[NoCapture, NoAlias, NonNull], 0);
        self.intrinsics.insert(
            name.into_string().unwrap(),
            Intrinsic::FunctionPointer(function, ffi::weld_runst_assert as *mut c_void),
        );

        let mut params = vec![self.run_handle_type(), int8p];
        let name = CString::new("weld_runst_print").unwrap();
        let fn_type = LLVMFunctionType(
            self.void_type(),
            params.as_mut_ptr(),
            params.len() as u32,
            0,
        );
        let function = LLVMAddFunction(self.module, name.as_ptr(), fn_type);
        LLVMExtAddAttrsOnParameter(
            self.context,
            function,
            &[NoCapture, NoAlias, NonNull, ReadOnly],
            0,
        );
        LLVMExtAddAttrsOnParameter(
            self.context,
            function,
            &[NoCapture, NoAlias, NonNull, ReadOnly],
            1,
        );
        self.intrinsics.insert(
            name.into_string().unwrap(),
            Intrinsic::FunctionPointer(function, ffi::weld_runst_print as *mut c_void),
        );

        let mut params = vec![
            int8p,
            int8p,
            self.i64_type(),
            self.i32_type(),
            self.i1_type(),
        ];
        let name = CString::new("llvm.memcpy.p0i8.p0i8.i64").unwrap();
        let fn_type = LLVMFunctionType(
            self.void_type(),
            params.as_mut_ptr(),
            params.len() as u32,
            0,
        );
        let function = LLVMAddFunction(self.module, name.as_ptr(), fn_type);
        // LLVM sets attributes on `memcpy` automatically.
        self.intrinsics
            .insert(name.into_string().unwrap(), Intrinsic::Builtin(function));

        let mut params = vec![
            int8p,
            self.i8_type(),
            self.i64_type(),
            self.i32_type(),
            self.i1_type(),
        ];
        let name = CString::new("llvm.memset.p0i8.i64").unwrap();
        let fn_type = LLVMFunctionType(
            self.void_type(),
            params.as_mut_ptr(),
            params.len() as u32,
            0,
        );
        let function = LLVMAddFunction(self.module, name.as_ptr(), fn_type);
        // LLVM sets attributes on `memset` automatically.
        self.intrinsics
            .insert(name.into_string().unwrap(), Intrinsic::Builtin(function));
    }
Populate the default intrinsics.

By default, the code generator adds the Weld Run API (functions prefixed with `weld_run`)
and a few other utility functions, such as `memcpy`.
weld/src/codegen/llvm2/intrinsic.rs