Function get_intrinsic_declaration

Source
pub fn get_intrinsic_declaration(
    m: &ModuleRef,
    id: u32,
    param_types: &[TypeRef],
) -> ValueRef
Expand description

Creates or inserts the declaration of an intrinsic function within the module.

This function wraps the LLVMGetIntrinsicDeclaration function from the LLVM core library. It either retrieves an existing declaration of the specified intrinsic or creates a new one if it does not already exist. For overloaded intrinsics, parameter types must be provided to uniquely identify the desired overload.

§Parameters

  • m: The ModuleRef representing the LLVM module.
  • id: The intrinsic ID (u32) corresponding to the desired intrinsic function.
  • param_types: A slice of LLVM type references (&[LLVMTypeRef]) representing the parameter types of the intrinsic. This is necessary for overloaded intrinsics to uniquely identify the correct version.

§Returns

Returns a ValueRef representing the intrinsic function declaration within the module. If the declaration cannot be created or retrieved, the returned ValueRef may be null, so users should ensure that the declaration was successfully obtained.