pub fn const_gep2(
ty: &TypeRef,
constant_val: &ValueRef,
constant_indices: &[ValueRef],
) -> ValueRefExpand description
Create a GEP (GetElementPtr) operation on a constant value.
§Details
Creates a constant GetElementPtr (GEP) instruction with an explicit type.
This function wraps the LLVMConstGEP2 function from the LLVM core library. It generates a constant
GEP instruction, which calculates the address of a sub-element of an aggregate data structure (such as
arrays or structs) at compile time. The GEP is calculated using the base pointer constant_val and the
specified constant_indices.
§Parameters
ty: A reference to the type of the base pointer (constant_val). This specifies the type of the data structure from which theGEPis calculated.constant_val: A reference to the base value from which the GEP is calculated. This is typically a pointer to an aggregate data structure.constant_indices: A slice of references to constant values that represent the indices used in the GEP calculation.
§Returns
Returns an instance of ValueRef, which encapsulates the result of the GEP calculation. The result is a constant
value determined at compile time, representing the address of the sub-element within the aggregate data structure.