Function get_first_use

Source
pub fn get_first_use(val: &ValueRef) -> Option<UseRef>
Expand description

Obtain the first use of a value.

Uses are obtained in an iterator fashion. First, call this function to obtain a reference to the first use. Then, call get_next_use on that instance and all subsequently obtained instances until get_next_use returns NULL.

§Details

Obtains the first use of a value in the LLVM IR.

This function wraps the LLVMGetFirstUse function from the LLVM core library. It retrieves the first use of the value represented by ValueRef. In LLVM IR, a “use” represents an instance where a value is used by an instruction or another value. The use can be iterated over to find all instances where this value is used.

After obtaining the first use with this function, you can call get_next_use on the resulting UseRef to iterate over all uses of the value. Continue calling get_next_use on each subsequent UseRef until it returns None.

§Returns

Returns an Option<UseRef>:

  • Some(UseRef) if there is a use associated with the value.
  • None if there are no uses associated with the value.