Struct inkwell::types::IntType [−][src]
An IntType
is the type of an integer constant or variable.
Implementations
impl<'ctx> IntType<'ctx>
[src]
pub fn const_int(self, value: u64, sign_extend: bool) -> IntValue<'ctx>
[src]
Creates an IntValue
repesenting a constant value of this IntType
. It will be automatically assigned this IntType
's Context
.
Example
use inkwell::context::Context; // Local Context let context = Context::create(); let i32_type = context.i32_type(); let i32_value = i32_type.const_int(42, false);
pub fn const_int_from_string(
self,
slice: &str,
radix: StringRadix
) -> Option<IntValue<'ctx>>
[src]
self,
slice: &str,
radix: StringRadix
) -> Option<IntValue<'ctx>>
Create an IntValue
from a string and radix. LLVM provides no error handling here,
so this may produce unexpected results and should not be relied upon for validation.
Example
use std::convert::TryFrom; use inkwell::context::Context; use inkwell::types::StringRadix; use inkwell::values::AnyValue; let context = Context::create(); let i8_type = context.i8_type(); let i8_val = i8_type.const_int_from_string("0121", StringRadix::Decimal).unwrap(); assert_eq!(i8_val.print_to_string().to_string(), "i8 121"); let i8_val = i8_type.const_int_from_string("0121", StringRadix::try_from(10).unwrap()).unwrap(); assert_eq!(i8_val.print_to_string().to_string(), "i8 16"); let i8_val = i8_type.const_int_from_string("0121", StringRadix::Binary); assert!(i8_val.is_none()); let i8_val = i8_type.const_int_from_string("ABCD", StringRadix::Binary); assert!(i8_val.is_none());
pub fn const_int_arbitrary_precision(self, words: &[u64]) -> IntValue<'ctx>
[src]
Create a constant IntValue
of arbitrary precision.
Example
use inkwell::context::Context; let context = Context::create(); let i64_type = context.i64_type(); let i64_val = i64_type.const_int_arbitrary_precision(&[1, 2]);
pub fn const_all_ones(self) -> IntValue<'ctx>
[src]
Creates an IntValue
representing a constant value of all one bits of this IntType
. It will be automatically assigned this IntType
's Context
.
Example
use inkwell::context::Context; // Local Context let context = Context::create(); let i32_type = context.i32_type(); let i32_ptr_value = i32_type.const_all_ones();
pub fn const_zero(self) -> IntValue<'ctx>
[src]
Creates a constant zero value of this IntType
.
Example
use inkwell::context::Context; use inkwell::values::AnyValue; let context = Context::create(); let i8_type = context.i8_type(); let i8_zero = i8_type.const_zero(); assert_eq!(i8_zero.print_to_string().to_string(), "i8 0");
pub fn fn_type(
self,
param_types: &[BasicTypeEnum<'ctx>],
is_var_args: bool
) -> FunctionType<'ctx>
[src]
self,
param_types: &[BasicTypeEnum<'ctx>],
is_var_args: bool
) -> FunctionType<'ctx>
Creates a FunctionType
with this IntType
for its return type.
Example
use inkwell::context::Context; let context = Context::create(); let i8_type = context.i8_type(); let fn_type = i8_type.fn_type(&[], false);
pub fn array_type(self, size: u32) -> ArrayType<'ctx>
[src]
Creates an ArrayType
with this IntType
for its element type.
Example
use inkwell::context::Context; let context = Context::create(); let i8_type = context.i8_type(); let i8_array_type = i8_type.array_type(3); assert_eq!(i8_array_type.len(), 3); assert_eq!(i8_array_type.get_element_type().into_int_type(), i8_type);
pub fn vec_type(self, size: u32) -> VectorType<'ctx>
[src]
Creates a VectorType
with this IntType
for its element type.
Example
use inkwell::context::Context; let context = Context::create(); let i8_type = context.i8_type(); let i8_vector_type = i8_type.vec_type(3); assert_eq!(i8_vector_type.get_size(), 3); assert_eq!(i8_vector_type.get_element_type().into_int_type(), i8_type);
pub fn get_context(self) -> ContextRef<'ctx>
[src]
Gets a reference to the Context
this IntType
was created in.
Example
use inkwell::context::Context; let context = Context::create(); let i8_type = context.i8_type(); assert_eq!(*i8_type.get_context(), context);
pub fn size_of(self) -> IntValue<'ctx>
[src]
Gets the size of this IntType
. Value may vary depending on the target architecture.
Example
use inkwell::context::Context; let context = Context::create(); let i8_type = context.i8_type(); let i8_type_size = i8_type.size_of();
pub fn get_alignment(self) -> IntValue<'ctx>
[src]
Gets the alignment of this IntType
. Value may vary depending on the target architecture.
Example
use inkwell::context::Context; let context = Context::create(); let i8_type = context.i8_type(); let i8_type_alignment = i8_type.get_alignment();
pub fn ptr_type(self, address_space: AddressSpace) -> PointerType<'ctx>
[src]
Creates a PointerType
with this IntType
for its element type.
Example
use inkwell::context::Context; use inkwell::AddressSpace; let context = Context::create(); let i8_type = context.i8_type(); let i8_ptr_type = i8_type.ptr_type(AddressSpace::Generic); assert_eq!(i8_ptr_type.get_element_type().into_int_type(), i8_type);
pub fn get_bit_width(self) -> u32
[src]
Gets the bit width of an IntType
.
Example
use inkwell::context::Context; let context = Context::create(); let bool_type = context.bool_type(); assert_eq!(bool_type.get_bit_width(), 1);
pub fn get_undef(self) -> IntValue<'ctx>
[src]
Creates an undefined instance of an IntType
.
Example
use inkwell::context::Context; use inkwell::AddressSpace; let context = Context::create(); let i8_type = context.i8_type(); let i8_undef = i8_type.get_undef(); assert!(i8_undef.is_undef());
pub fn create_generic_value(
self,
value: u64,
is_signed: bool
) -> GenericValue<'ctx>
[src]
self,
value: u64,
is_signed: bool
) -> GenericValue<'ctx>
Creates a GenericValue
for use with ExecutionEngine
s.
pub fn const_array(self, values: &[IntValue<'ctx>]) -> ArrayValue<'ctx>
[src]
Creates a constant ArrayValue
.
Example
use inkwell::context::Context; let context = Context::create(); let i8_type = context.i8_type(); let i8_val = i8_type.const_int(0, false); let i8_val2 = i8_type.const_int(2, false); let i8_array = i8_type.const_array(&[i8_val, i8_val2]); assert!(i8_array.is_const());
Trait Implementations
impl<'ctx> AnyType<'ctx> for IntType<'ctx>
[src]
fn as_any_type_enum(&self) -> AnyTypeEnum<'ctx>
[src]
fn print_to_string(&self) -> LLVMString
[src]
impl<'ctx> BasicType<'ctx> for IntType<'ctx>
[src]
fn as_basic_type_enum(&self) -> BasicTypeEnum<'ctx>
[src]
fn fn_type(
&self,
param_types: &[BasicTypeEnum<'ctx>],
is_var_args: bool
) -> FunctionType<'ctx>
[src]
&self,
param_types: &[BasicTypeEnum<'ctx>],
is_var_args: bool
) -> FunctionType<'ctx>
fn is_sized(&self) -> bool
[src]
fn size_of(&self) -> Option<IntValue<'ctx>>
[src]
fn array_type(&self, size: u32) -> ArrayType<'ctx>
[src]
fn ptr_type(&self, address_space: AddressSpace) -> PointerType<'ctx>
[src]
impl<'ctx> Clone for IntType<'ctx>
[src]
impl<'ctx> Copy for IntType<'ctx>
[src]
impl<'ctx> Debug for IntType<'ctx>
[src]
impl<'ctx> Eq for IntType<'ctx>
[src]
impl<'ctx> From<IntType<'ctx>> for AnyTypeEnum<'ctx>
[src]
fn from(value: IntType<'_>) -> AnyTypeEnum<'_>
[src]
impl<'ctx> From<IntType<'ctx>> for BasicTypeEnum<'ctx>
[src]
fn from(value: IntType<'_>) -> BasicTypeEnum<'_>
[src]
impl<'ctx> IntMathType<'ctx> for IntType<'ctx>
[src]
type ValueType = IntValue<'ctx>
The value instance of an int or int vector type.
type MathConvType = FloatType<'ctx>
The type for int to float or int vector to float vector conversions.
type PtrConvType = PointerType<'ctx>
The type for int to pointer or int vector to pointer vector conversions.
impl<'ctx> PartialEq<IntType<'ctx>> for IntType<'ctx>
[src]
impl<'ctx> StructuralEq for IntType<'ctx>
[src]
impl<'ctx> StructuralPartialEq for IntType<'ctx>
[src]
impl<'ctx> TryFrom<AnyTypeEnum<'ctx>> for IntType<'ctx>
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: AnyTypeEnum<'ctx>) -> Result<Self, Self::Error>
[src]
impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for IntType<'ctx>
[src]
Auto Trait Implementations
impl<'ctx> RefUnwindSafe for IntType<'ctx>
[src]
impl<'ctx> !Send for IntType<'ctx>
[src]
impl<'ctx> !Sync for IntType<'ctx>
[src]
impl<'ctx> Unpin for IntType<'ctx>
[src]
impl<'ctx> UnwindSafe for IntType<'ctx>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,