pub struct IntValue<'ctx> { /* private fields */ }
Implementations§
source§impl<'ctx> IntValue<'ctx>
impl<'ctx> IntValue<'ctx>
sourcepub unsafe fn new(value: LLVMValueRef) -> Self
pub unsafe fn new(value: LLVMValueRef) -> Self
sourcepub fn get_name(&self) -> &CStr
pub fn get_name(&self) -> &CStr
Gets the name of an IntValue
. If the value is a constant, this will
return an empty string.
pub fn get_type(self) -> IntType<'ctx>
pub fn is_null(self) -> bool
pub fn is_undef(self) -> bool
pub fn print_to_stderr(self)
pub fn as_instruction(self) -> Option<InstructionValue<'ctx>>
pub fn const_not(self) -> Self
pub fn const_neg(self) -> Self
pub fn const_nsw_neg(self) -> Self
pub fn const_nuw_neg(self) -> Self
pub fn const_add(self, rhs: IntValue<'ctx>) -> Self
pub fn const_nsw_add(self, rhs: IntValue<'ctx>) -> Self
pub fn const_nuw_add(self, rhs: IntValue<'ctx>) -> Self
pub fn const_sub(self, rhs: IntValue<'ctx>) -> Self
pub fn const_nsw_sub(self, rhs: IntValue<'ctx>) -> Self
pub fn const_nuw_sub(self, rhs: IntValue<'ctx>) -> Self
pub fn const_mul(self, rhs: IntValue<'ctx>) -> Self
pub fn const_nsw_mul(self, rhs: IntValue<'ctx>) -> Self
pub fn const_nuw_mul(self, rhs: IntValue<'ctx>) -> Self
pub fn const_and(self, rhs: IntValue<'ctx>) -> Self
pub fn const_or(self, rhs: IntValue<'ctx>) -> Self
pub fn const_xor(self, rhs: IntValue<'ctx>) -> Self
pub fn const_cast(self, int_type: IntType<'ctx>, is_signed: bool) -> Self
pub fn const_shl(self, rhs: IntValue<'ctx>) -> Self
pub fn const_rshr(self, rhs: IntValue<'ctx>) -> Self
pub fn const_ashr(self, rhs: IntValue<'ctx>) -> Self
pub fn const_unsigned_to_float( self, float_type: FloatType<'ctx> ) -> FloatValue<'ctx>
pub fn const_signed_to_float( self, float_type: FloatType<'ctx> ) -> FloatValue<'ctx>
pub fn const_to_pointer(self, ptr_type: PointerType<'ctx>) -> PointerValue<'ctx>
pub fn const_truncate(self, int_type: IntType<'ctx>) -> IntValue<'ctx>
pub fn const_s_extend(self, int_type: IntType<'ctx>) -> IntValue<'ctx>
pub fn const_z_ext(self, int_type: IntType<'ctx>) -> IntValue<'ctx>
pub fn const_truncate_or_bit_cast( self, int_type: IntType<'ctx> ) -> IntValue<'ctx>
pub fn const_s_extend_or_bit_cast( self, int_type: IntType<'ctx> ) -> IntValue<'ctx>
pub fn const_z_ext_or_bit_cast(self, int_type: IntType<'ctx>) -> IntValue<'ctx>
pub fn const_bit_cast(self, int_type: IntType<'_>) -> IntValue<'ctx>
pub fn const_int_compare( self, op: IntPredicate, rhs: IntValue<'ctx> ) -> IntValue<'ctx>
sourcepub fn is_const(self) -> bool
pub fn is_const(self) -> bool
Determines whether or not an IntValue
is an llvm::Constant
.
Constants includes values that are not known at compile time, for example the address of a function casted to an integer.
Example
use inkwell::context::Context;
let context = Context::create();
let i64_type = context.i64_type();
let i64_val = i64_type.const_int(12, false);
assert!(i64_val.is_const());
sourcepub fn is_constant_int(self) -> bool
pub fn is_constant_int(self) -> bool
Determines whether or not an IntValue
is an llvm::ConstantInt
.
ConstantInt only includes values that are known at compile time.
Example
use inkwell::context::Context;
let context = Context::create();
let i64_type = context.i64_type();
let i64_val = i64_type.const_int(12, false);
assert!(i64_val.is_constant_int());
sourcepub fn get_zero_extended_constant(self) -> Option<u64>
pub fn get_zero_extended_constant(self) -> Option<u64>
Obtains a constant IntValue
’s zero extended value.
Example
use inkwell::context::Context;
let context = Context::create();
let i8_type = context.i8_type();
let i8_all_ones = i8_type.const_all_ones();
assert_eq!(i8_all_ones.get_zero_extended_constant(), Some(255));
sourcepub fn get_sign_extended_constant(self) -> Option<i64>
pub fn get_sign_extended_constant(self) -> Option<i64>
Obtains a constant IntValue
’s sign extended value.
Example
use inkwell::context::Context;
let context = Context::create();
let i8_type = context.i8_type();
let i8_all_ones = i8_type.const_all_ones();
assert_eq!(i8_all_ones.get_sign_extended_constant(), Some(-1));
pub fn replace_all_uses_with(self, other: IntValue<'ctx>)
Trait Implementations§
source§impl<'ctx> AnyValue<'ctx> for IntValue<'ctx>
impl<'ctx> AnyValue<'ctx> for IntValue<'ctx>
source§fn as_any_value_enum(&self) -> AnyValueEnum<'ctx>
fn as_any_value_enum(&self) -> AnyValueEnum<'ctx>
Returns an enum containing a typed version of
AnyValue
.source§fn print_to_string(&self) -> LLVMString
fn print_to_string(&self) -> LLVMString
Prints a value to a
LLVMString
source§impl AsValueRef for IntValue<'_>
impl AsValueRef for IntValue<'_>
fn as_value_ref(&self) -> LLVMValueRef
source§impl<'ctx> BasicValue<'ctx> for IntValue<'ctx>
impl<'ctx> BasicValue<'ctx> for IntValue<'ctx>
source§fn as_basic_value_enum(&self) -> BasicValueEnum<'ctx>
fn as_basic_value_enum(&self) -> BasicValueEnum<'ctx>
Returns an enum containing a typed version of the
BasicValue
.source§fn as_instruction_value(&self) -> Option<InstructionValue<'ctx>>
fn as_instruction_value(&self) -> Option<InstructionValue<'ctx>>
Most
BasicValue
s are the byproduct of an instruction
and so are convertible into an InstructionValue
fn get_first_use(&self) -> Option<BasicValueUse<'_>>
source§impl<'ctx> From<IntValue<'ctx>> for AnyValueEnum<'ctx>
impl<'ctx> From<IntValue<'ctx>> for AnyValueEnum<'ctx>
source§fn from(value: IntValue<'_>) -> AnyValueEnum<'_>
fn from(value: IntValue<'_>) -> AnyValueEnum<'_>
Converts to this type from the input type.
source§impl<'ctx> From<IntValue<'ctx>> for BasicMetadataValueEnum<'ctx>
impl<'ctx> From<IntValue<'ctx>> for BasicMetadataValueEnum<'ctx>
source§fn from(value: IntValue<'_>) -> BasicMetadataValueEnum<'_>
fn from(value: IntValue<'_>) -> BasicMetadataValueEnum<'_>
Converts to this type from the input type.
source§impl<'ctx> From<IntValue<'ctx>> for BasicValueEnum<'ctx>
impl<'ctx> From<IntValue<'ctx>> for BasicValueEnum<'ctx>
source§fn from(value: IntValue<'_>) -> BasicValueEnum<'_>
fn from(value: IntValue<'_>) -> BasicValueEnum<'_>
Converts to this type from the input type.
source§impl<'ctx> IntMathValue<'ctx> for IntValue<'ctx>
impl<'ctx> IntMathValue<'ctx> for IntValue<'ctx>
source§impl<'ctx> PartialEq<AnyValueEnum<'ctx>> for IntValue<'ctx>
impl<'ctx> PartialEq<AnyValueEnum<'ctx>> for IntValue<'ctx>
source§fn eq(&self, other: &AnyValueEnum<'ctx>) -> bool
fn eq(&self, other: &AnyValueEnum<'ctx>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'ctx> PartialEq<BasicMetadataValueEnum<'ctx>> for IntValue<'ctx>
impl<'ctx> PartialEq<BasicMetadataValueEnum<'ctx>> for IntValue<'ctx>
source§fn eq(&self, other: &BasicMetadataValueEnum<'ctx>) -> bool
fn eq(&self, other: &BasicMetadataValueEnum<'ctx>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'ctx> PartialEq<BasicValueEnum<'ctx>> for IntValue<'ctx>
impl<'ctx> PartialEq<BasicValueEnum<'ctx>> for IntValue<'ctx>
source§fn eq(&self, other: &BasicValueEnum<'ctx>) -> bool
fn eq(&self, other: &BasicValueEnum<'ctx>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'ctx> PartialEq<IntValue<'ctx>> for AnyValueEnum<'ctx>
impl<'ctx> PartialEq<IntValue<'ctx>> for AnyValueEnum<'ctx>
source§impl<'ctx> PartialEq<IntValue<'ctx>> for BasicMetadataValueEnum<'ctx>
impl<'ctx> PartialEq<IntValue<'ctx>> for BasicMetadataValueEnum<'ctx>
source§impl<'ctx> PartialEq<IntValue<'ctx>> for BasicValueEnum<'ctx>
impl<'ctx> PartialEq<IntValue<'ctx>> for BasicValueEnum<'ctx>
source§impl<'ctx> PartialEq for IntValue<'ctx>
impl<'ctx> PartialEq for IntValue<'ctx>
source§impl<'ctx> TryFrom<AnyValueEnum<'ctx>> for IntValue<'ctx>
impl<'ctx> TryFrom<AnyValueEnum<'ctx>> for IntValue<'ctx>
source§impl<'ctx> TryFrom<BasicMetadataValueEnum<'ctx>> for IntValue<'ctx>
impl<'ctx> TryFrom<BasicMetadataValueEnum<'ctx>> for IntValue<'ctx>
source§impl<'ctx> TryFrom<BasicValueEnum<'ctx>> for IntValue<'ctx>
impl<'ctx> TryFrom<BasicValueEnum<'ctx>> for IntValue<'ctx>
source§impl<'ctx> TryFrom<InstructionValue<'ctx>> for IntValue<'ctx>
impl<'ctx> TryFrom<InstructionValue<'ctx>> for IntValue<'ctx>
impl<'ctx> Copy for IntValue<'ctx>
impl<'ctx> Eq for IntValue<'ctx>
impl<'ctx> StructuralEq for IntValue<'ctx>
impl<'ctx> StructuralPartialEq for IntValue<'ctx>
Auto Trait Implementations§
impl<'ctx> RefUnwindSafe for IntValue<'ctx>
impl<'ctx> !Send for IntValue<'ctx>
impl<'ctx> !Sync for IntValue<'ctx>
impl<'ctx> Unpin for IntValue<'ctx>
impl<'ctx> UnwindSafe for IntValue<'ctx>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more