Struct ValueRef

Source
pub struct ValueRef(/* private fields */);
Expand description

LLVM Value wrapper

Implementations§

Source§

impl ValueRef

That implementations related to LLVM Modules MemoryDef.

Source

pub fn get_inline_asm_asm_string(&self) -> Option<String>

Get the template string used for an inline assembly snippet.

§Details

Retrieves the assembly code string from the inline assembly block in LLVM IR.

This function wraps the LLVMGetInlineAsmAsmString function from the LLVM core library. It returns the assembly code string used by the inline assembly block associated with self. This string contains the actual assembly instructions that will be executed as part of the inline assembly.

If the assembly string cannot be retrieved, the function returns None.

§Returns

Returns an Option<String>:

  • Some(String) containing the assembly code string if successful.
  • None if the assembly string cannot be retrieved.
Source

pub fn get_inline_asm_constraint_string(&self) -> Option<String>

Get the raw constraint string for an inline assembly snippet.

§Details

Retrieves the constraint string associated with the inline assembly block in LLVM IR.

This function wraps the LLVMGetInlineAsmConstraintString function from the LLVM core library. It returns the constraint string used by the inline assembly block associated with self. The constraint string specifies the constraints on the operands used in the inline assembly, such as register classes or memory addressing modes.

If the constraint string cannot be retrieved, the function returns None.

§Returns

Returns an Option<String>:

  • Some(String) containing the constraint string if successful.
  • None if the constraint string cannot be retrieved.
Source

pub fn get_inline_asm_dialect(&self) -> InlineAsmDialect

Get the dialect used by the inline asm snippet.

§Details

Retrieves the dialect of the inline assembly block in LLVM IR.

This function wraps the LLVMGetInlineAsmDialect function from the LLVM core library. It returns the InlineAsmDialect representing the dialect used by the inline assembly block associated with self. The dialect determines the syntax and conventions used in the inline assembly, which may vary between different assemblers (e.g., AT&T vs. Intel syntax).

§Returns

Returns an InlineAsmDialect that represents the dialect of the inline assembly block.

Source

pub fn get_inline_asm_function_type(&self) -> TypeRef

Get the function type of the inline assembly snippet.

This is the same type that was passed into LLVMGetInlineAsm originally.

§Returns

Retrieves the function type of the inline assembly block in LLVM IR.

This function wraps the LLVMGetInlineAsmFunctionType function from the LLVM core library. It returns the TypeRef representing the function type of the inline assembly block associated with self. The function type defines the signature of the inline assembly, including the types of its arguments and return value.

§Returns

Returns a TypeRef that represents the function type of the inline assembly block.

Source

pub fn get_inline_asm_has_side_effects(&self) -> bool

Get if the inline asm snippet has side effects

§Details

Checks whether an inline assembly block has side effects in LLVM IR.

This function wraps the LLVMGetInlineAsmHasSideEffects function from the LLVM core library. It determines whether the inline assembly represented by self has side effects, meaning that it may alter state or interact with external systems in ways that are not visible within the LLVM IR. This flag is important for optimizations, as it indicates that the inline assembly cannot be removed or reordered without potentially affecting program behavior.

§Returns

Returns true if the inline assembly block has side effects, otherwise returns false.

Source

pub fn get_inline_asm_needs_aligned_stack(&self) -> bool

Get if the inline asm snippet needs an aligned stack

§Details

Checks whether an inline assembly block requires an aligned stack in LLVM IR.

This function wraps the LLVMGetInlineAsmNeedsAlignedStack function from the LLVM core library. It determines whether the inline assembly represented by self requires the stack to be aligned. Proper stack alignment may be necessary for certain instructions or calling conventions, and this flag indicates whether such alignment is needed.

§Returns

Returns true if the inline assembly block requires an aligned stack, otherwise returns false.

Source

pub fn get_inline_asm_can_unwind(&self) -> bool

Get if the inline asm snippet may unwind the stack

§Details

Checks whether an inline assembly block can unwind in LLVM IR.

This function wraps the LLVMGetInlineAsmCanUnwind function from the LLVM core library. It determines whether the inline assembly represented by self is capable of unwinding, which can affect how exceptions and other control flows are handled during execution.

§Returns

Returns true if the inline assembly block can unwind, otherwise returns false.

Source

pub fn get_debug_loc_directory(&self) -> Option<String>

Return the directory of the debug location for this value, which must be an LLVM Instruction, GlobalVariable, or Function.

§Details

Retrieves the directory from the debug location associated with this value in LLVM IR.

This function wraps the LLVMGetDebugLocDirectory function from the LLVM core library. It returns the directory of the source code location associated with the debug information for the value represented by self. If the directory cannot be retrieved, the function returns None.

§Returns

Returns an Option<String>:

  • Some(String) containing the directory associated with the value’s debug location if successful.
  • None if the directory cannot be retrieved.
Source

pub fn get_debug_loc_filename(&self) -> Option<String>

Return the filename of the debug location for this value, which must be an LLVM Instruction, lGlobalVariable, or Function.

§Details

Retrieves the filename from the debug location associated with this value in LLVM IR.

This function wraps the LLVMGetDebugLocFilename function from the LLVM core library. It returns the filename of the source code location associated with the debug information for the value represented by self. If the filename cannot be retrieved, the function returns None.

§Returns

Returns an Option<String>:

  • Some(String) containing the filename associated with the value’s debug location if successful.
  • None if the filename cannot be retrieved.
Source

pub fn get_debug_loc_line(&self) -> u32

Return the line number of the debug location for this value, which must be an LLVM Instruction, GlobalVariable, or Function.

§Details

Retrieves the line number from the debug location associated with this value in LLVM IR.

This function wraps the LLVMGetDebugLocLine function from the LLVM core library. It returns the line number of the source code location associated with the debug information for the value represented by self. This is useful for debugging and for tools that need to report precise source locations.

§Returns

Returns a u32 representing the line number in the source code associated with this value’s debug location.

Source

pub fn get_debug_loc_column(&self) -> u32

Return the column number of the debug location for this value, which must be an LLVM Instruction.

§Details

Retrieves the column number from the debug location associated with this value in LLVM IR.

This function wraps the LLVMGetDebugLocColumn function from the LLVM core library. It returns the column number of the source code location associated with the debug information for the value represented by self. This is useful for debugging and for tools that need to report precise source locations.

§Returns

Returns a u32 representing the column number in the source code associated with this value’s debug location.

Source

pub fn get_next_function(&self) -> Option<Self>

Advance a Function iterator to the next Function.

Returns None if the iterator was already at the end and there are no more functions.

§Details

Retrieves the next function in the module relative to this function, if it exists.

This function wraps the LLVMGetNextFunction function from the LLVM core library. It returns the next function in the module relative to the function represented by self. If there is no next function, the function returns None. This is useful for iterating over functions within a module in LLVM IR.

§Returns

Returns an Option<ValueRef>:

  • Some(ValueRef) containing the next function if it exists.
  • None if there is no next function in the module.
Source

pub fn get_previous_function(&self) -> Option<Self>

Decrement a Function iterator to the previous Function.

Returns None if the iterator was already at the beginning and there are no previous functions.

§Details

Retrieves the previous function in the module relative to this function, if it exists.

This function wraps the LLVMGetPreviousFunction function from the LLVM core library. It returns the previous function in the module relative to the function represented by self. If there is no previous function, the function returns None. This is useful for iterating over functions within a module in LLVM IR.

§Returns

Returns an Option<ValueRef>:

  • Some(ValueRef) containing the previous function if it exists.
  • None if there is no previous function in the module.

Trait Implementations§

Source§

impl Debug for ValueRef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for ValueRef

Source§

type Target = *mut LLVMValue

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl From<*mut LLVMValue> for ValueRef

Source§

fn from(value_ref: LLVMValueRef) -> Self

Converts to this type from the input type.
Source§

impl GetRef for ValueRef

Source§

type RawRef = *mut LLVMValue

Raw LLVM reference type
Source§

fn get_ref(&self) -> Self::RawRef

Get LLVM raw reference

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.