Function const_insert_element

Source
pub fn const_insert_element(
    val: &ValueRef,
    element_value: &ValueRef,
    index: &ValueRef,
) -> ValueRef
Expand description

Insert an element into a vector constant at the specified index.

§Details

Inserts a constant element into a constant vector at a specified index.

This function wraps the LLVMConstInsertElement function from the LLVM core library. It generates a constant insert element instruction, which inserts the value represented by element_value into the vector value represented by ValueRef at the position specified by index. This is typically used to create or modify constant vectors by inserting elements at specific positions at compile time.

§Parameters

  • element_value: A reference to the constant value that should be inserted into the vector. This value must be of the same type as the elements of the vector.
  • index: A reference to a constant value that specifies the index at which the element should be inserted. The index should be an integer value and within the bounds of the vector.

§Returns

Returns an instance of ValueRef, which encapsulates the resulting vector after the insertion, as a constant value determined at compile time.