Struct llvm_plugin_inkwell::types::VectorType
source · [−]pub struct VectorType<'ctx> { /* private fields */ }Expand description
A VectorType is the type of a multiple value SIMD constant or variable.
Implementations
sourceimpl<'ctx> VectorType<'ctx>
impl<'ctx> VectorType<'ctx>
sourcepub fn size_of(self) -> Option<IntValue<'ctx>>
pub fn size_of(self) -> Option<IntValue<'ctx>>
Gets the size of this VectorType. Value may vary depending on the target architecture.
Example
use inkwell::context::Context;
let context = Context::create();
let f32_type = context.f32_type();
let f32_vec_type = f32_type.vec_type(3);
let f32_vec_type_size = f32_vec_type.size_of();sourcepub fn get_alignment(self) -> IntValue<'ctx>
pub fn get_alignment(self) -> IntValue<'ctx>
Gets the alignment of this VectorType. Value may vary depending on the target architecture.
Example
use inkwell::context::Context;
let context = Context::create();
let f32_type = context.f32_type();
let f32_vec_type = f32_type.vec_type(7);
let f32_type_alignment = f32_vec_type.get_alignment();sourcepub fn get_size(self) -> u32
pub fn get_size(self) -> u32
Gets the size of this VectorType.
Example
use inkwell::context::Context;
let context = Context::create();
let f32_type = context.f32_type();
let f32_vector_type = f32_type.vec_type(3);
assert_eq!(f32_vector_type.get_size(), 3);
assert_eq!(f32_vector_type.get_element_type().into_float_type(), f32_type);sourcepub fn const_vector<V: BasicValue<'ctx>>(values: &[V]) -> VectorValue<'ctx>
pub fn const_vector<V: BasicValue<'ctx>>(values: &[V]) -> VectorValue<'ctx>
Creates a constant VectorValue.
Example
use inkwell::context::Context;
use inkwell::types::VectorType;
let context = Context::create();
let f32_type = context.f32_type();
let f32_val = f32_type.const_float(0.);
let f32_val2 = f32_type.const_float(2.);
let f32_vec_val = VectorType::const_vector(&[f32_val, f32_val2]);
assert!(f32_vec_val.is_constant_vector());sourcepub fn const_zero(self) -> VectorValue<'ctx>
pub fn const_zero(self) -> VectorValue<'ctx>
Creates a constant zero value of this VectorType.
Example
use inkwell::context::Context;
let context = Context::create();
let f32_type = context.f32_type();
let f32_vec_type = f32_type.vec_type(7);
let f32_vec_zero = f32_vec_type.const_zero();sourcepub fn print_to_string(self) -> LLVMString
pub fn print_to_string(self) -> LLVMString
Print the definition of a VectorType to LLVMString.
sourcepub fn get_undef(self) -> VectorValue<'ctx>
pub fn get_undef(self) -> VectorValue<'ctx>
Creates an undefined instance of a VectorType.
Example
use inkwell::context::Context;
use inkwell::AddressSpace;
let context = Context::create();
let f32_type = context.f32_type();
let f32_vec_type = f32_type.vec_type(3);
let f32_vec_undef = f32_vec_type.get_undef();
assert!(f32_vec_undef.is_undef());sourcepub fn get_element_type(self) -> BasicTypeEnum<'ctx>
pub fn get_element_type(self) -> BasicTypeEnum<'ctx>
Gets the element type of this VectorType.
Example
use inkwell::context::Context;
let context = Context::create();
let f32_type = context.f32_type();
let f32_vector_type = f32_type.vec_type(3);
assert_eq!(f32_vector_type.get_size(), 3);
assert_eq!(f32_vector_type.get_element_type().into_float_type(), f32_type);sourcepub fn ptr_type(self, address_space: AddressSpace) -> PointerType<'ctx>
pub fn ptr_type(self, address_space: AddressSpace) -> PointerType<'ctx>
Creates a PointerType with this VectorType for its element type.
Example
use inkwell::context::Context;
use inkwell::AddressSpace;
let context = Context::create();
let f32_type = context.f32_type();
let f32_vec_type = f32_type.vec_type(3);
let f32_vec_ptr_type = f32_vec_type.ptr_type(AddressSpace::Generic);
assert_eq!(f32_vec_ptr_type.get_element_type().into_vector_type(), f32_vec_type);sourcepub fn fn_type(
self,
param_types: &[BasicMetadataTypeEnum<'ctx>],
is_var_args: bool
) -> FunctionType<'ctx>
pub fn fn_type(
self,
param_types: &[BasicMetadataTypeEnum<'ctx>],
is_var_args: bool
) -> FunctionType<'ctx>
Creates a FunctionType with this VectorType for its return type.
Example
use inkwell::context::Context;
let context = Context::create();
let f32_type = context.f32_type();
let f32_vec_type = f32_type.vec_type(3);
let fn_type = f32_vec_type.fn_type(&[], false);sourcepub fn array_type(self, size: u32) -> ArrayType<'ctx>
pub fn array_type(self, size: u32) -> ArrayType<'ctx>
Creates an ArrayType with this VectorType for its element type.
Example
use inkwell::context::Context;
let context = Context::create();
let f32_type = context.f32_type();
let f32_vec_type = f32_type.vec_type(3);
let f32_vec_array_type = f32_vec_type.array_type(3);
assert_eq!(f32_vec_array_type.len(), 3);
assert_eq!(f32_vec_array_type.get_element_type().into_vector_type(), f32_vec_type);sourcepub fn const_array(self, values: &[VectorValue<'ctx>]) -> ArrayValue<'ctx>
pub fn const_array(self, values: &[VectorValue<'ctx>]) -> ArrayValue<'ctx>
Creates a constant ArrayValue.
Example
use inkwell::context::Context;
use inkwell::types::VectorType;
let context = Context::create();
let f32_type = context.f32_type();
let f32_val = f32_type.const_float(0.);
let f32_val2 = f32_type.const_float(2.);
let f32_vec_type = f32_type.vec_type(2);
let f32_vec_val = VectorType::const_vector(&[f32_val, f32_val2]);
let f32_array = f32_vec_type.const_array(&[f32_vec_val, f32_vec_val]);
assert!(f32_array.is_const());sourcepub fn get_context(self) -> ContextRef<'ctx>
pub fn get_context(self) -> ContextRef<'ctx>
Gets a reference to the Context this VectorType was created in.
Example
use inkwell::context::Context;
let context = Context::create();
let f32_type = context.f32_type();
let f32_vec_type = f32_type.vec_type(7);
assert_eq!(*f32_vec_type.get_context(), context);Trait Implementations
sourceimpl<'ctx> AnyType<'ctx> for VectorType<'ctx>
impl<'ctx> AnyType<'ctx> for VectorType<'ctx>
sourcefn as_any_type_enum(&self) -> AnyTypeEnum<'ctx>
fn as_any_type_enum(&self) -> AnyTypeEnum<'ctx>
Returns an AnyTypeEnum that represents the current type.
sourcefn print_to_string(&self) -> LLVMString
fn print_to_string(&self) -> LLVMString
Prints the definition of a Type to a LLVMString.
sourceimpl<'ctx> BasicType<'ctx> for VectorType<'ctx>
impl<'ctx> BasicType<'ctx> for VectorType<'ctx>
sourcefn as_basic_type_enum(&self) -> BasicTypeEnum<'ctx>
fn as_basic_type_enum(&self) -> BasicTypeEnum<'ctx>
Returns a BasicTypeEnum that represents the current type.
sourcefn fn_type(
&self,
param_types: &[BasicMetadataTypeEnum<'ctx>],
is_var_args: bool
) -> FunctionType<'ctx>
fn fn_type(
&self,
param_types: &[BasicMetadataTypeEnum<'ctx>],
is_var_args: bool
) -> FunctionType<'ctx>
Create a FunctionType with this BasicType as its return type. Read more
sourcefn is_sized(&self) -> bool
fn is_sized(&self) -> bool
Determines whether or not this BasicType is sized or not.
For example, opaque structs are unsized. Read more
sourcefn size_of(&self) -> Option<IntValue<'ctx>>
fn size_of(&self) -> Option<IntValue<'ctx>>
Gets the size of this BasicType. Value may vary depending on the target architecture. Read more
sourcefn array_type(&self, size: u32) -> ArrayType<'ctx>
fn array_type(&self, size: u32) -> ArrayType<'ctx>
Create an ArrayType with this BasicType as its elements. Read more
sourcefn ptr_type(&self, address_space: AddressSpace) -> PointerType<'ctx>
fn ptr_type(&self, address_space: AddressSpace) -> PointerType<'ctx>
Create a PointerType that points to this BasicType. Read more
sourceimpl<'ctx> Clone for VectorType<'ctx>
impl<'ctx> Clone for VectorType<'ctx>
sourcefn clone(&self) -> VectorType<'ctx>
fn clone(&self) -> VectorType<'ctx>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<'ctx> Debug for VectorType<'ctx>
impl<'ctx> Debug for VectorType<'ctx>
sourceimpl Display for VectorType<'_>
impl Display for VectorType<'_>
sourceimpl<'ctx> FloatMathType<'ctx> for VectorType<'ctx>
impl<'ctx> FloatMathType<'ctx> for VectorType<'ctx>
type ValueType = VectorValue<'ctx>
type ValueType = VectorValue<'ctx>
The value instance of a float or float vector type.
type MathConvType = VectorType<'ctx>
type MathConvType = VectorType<'ctx>
The type for float to int or float vector to int vector conversions.
sourceimpl<'ctx> From<VectorType<'ctx>> for AnyTypeEnum<'ctx>
impl<'ctx> From<VectorType<'ctx>> for AnyTypeEnum<'ctx>
sourcefn from(value: VectorType<'_>) -> AnyTypeEnum<'_>
fn from(value: VectorType<'_>) -> AnyTypeEnum<'_>
Converts to this type from the input type.
sourceimpl<'ctx> From<VectorType<'ctx>> for BasicMetadataTypeEnum<'ctx>
impl<'ctx> From<VectorType<'ctx>> for BasicMetadataTypeEnum<'ctx>
sourcefn from(value: VectorType<'_>) -> BasicMetadataTypeEnum<'_>
fn from(value: VectorType<'_>) -> BasicMetadataTypeEnum<'_>
Converts to this type from the input type.
sourceimpl<'ctx> From<VectorType<'ctx>> for BasicTypeEnum<'ctx>
impl<'ctx> From<VectorType<'ctx>> for BasicTypeEnum<'ctx>
sourcefn from(value: VectorType<'_>) -> BasicTypeEnum<'_>
fn from(value: VectorType<'_>) -> BasicTypeEnum<'_>
Converts to this type from the input type.
sourceimpl<'ctx> IntMathType<'ctx> for VectorType<'ctx>
impl<'ctx> IntMathType<'ctx> for VectorType<'ctx>
type ValueType = VectorValue<'ctx>
type ValueType = VectorValue<'ctx>
The value instance of an int or int vector type.
type MathConvType = VectorType<'ctx>
type MathConvType = VectorType<'ctx>
The type for int to float or int vector to float vector conversions.
type PtrConvType = VectorType<'ctx>
type PtrConvType = VectorType<'ctx>
The type for int to pointer or int vector to pointer vector conversions.
sourceimpl<'ctx> PartialEq<VectorType<'ctx>> for VectorType<'ctx>
impl<'ctx> PartialEq<VectorType<'ctx>> for VectorType<'ctx>
sourcefn eq(&self, other: &VectorType<'ctx>) -> bool
fn eq(&self, other: &VectorType<'ctx>) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourceimpl<'ctx> PointerMathType<'ctx> for VectorType<'ctx>
impl<'ctx> PointerMathType<'ctx> for VectorType<'ctx>
type ValueType = VectorValue<'ctx>
type ValueType = VectorValue<'ctx>
The value instance of a pointer type.
type PtrConvType = VectorType<'ctx>
type PtrConvType = VectorType<'ctx>
The type for pointer to int or pointer vector to int conversions.
sourceimpl<'ctx> TryFrom<AnyTypeEnum<'ctx>> for VectorType<'ctx>
impl<'ctx> TryFrom<AnyTypeEnum<'ctx>> for VectorType<'ctx>
sourceimpl<'ctx> TryFrom<BasicMetadataTypeEnum<'ctx>> for VectorType<'ctx>
impl<'ctx> TryFrom<BasicMetadataTypeEnum<'ctx>> for VectorType<'ctx>
sourceimpl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for VectorType<'ctx>
impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for VectorType<'ctx>
impl<'ctx> Copy for VectorType<'ctx>
impl<'ctx> Eq for VectorType<'ctx>
impl<'ctx> StructuralEq for VectorType<'ctx>
impl<'ctx> StructuralPartialEq for VectorType<'ctx>
Auto Trait Implementations
impl<'ctx> RefUnwindSafe for VectorType<'ctx>
impl<'ctx> !Send for VectorType<'ctx>
impl<'ctx> !Sync for VectorType<'ctx>
impl<'ctx> Unpin for VectorType<'ctx>
impl<'ctx> UnwindSafe for VectorType<'ctx>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more