[][src]Struct inkwell::types::VectorType

pub struct VectorType<'ctx> { /* fields omitted */ }

A VectorType is the type of a multiple value SIMD constant or variable.

Implementations

impl<'ctx> VectorType<'ctx>[src]

pub fn size_of(self) -> Option<IntValue<'ctx>>[src]

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();

pub fn get_alignment(self) -> IntValue<'ctx>[src]

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();

pub fn get_size(self) -> u32[src]

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);

pub fn const_vector<V: BasicValue<'ctx>>(values: &[V]) -> VectorValue<'ctx>[src]

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());

pub fn const_zero(self) -> VectorValue<'ctx>[src]

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();

pub fn get_undef(self) -> VectorValue<'ctx>[src]

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());

pub fn get_element_type(self) -> BasicTypeEnum<'ctx>[src]

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);

pub fn ptr_type(self, address_space: AddressSpace) -> PointerType<'ctx>[src]

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);

pub fn fn_type(
    self,
    param_types: &[BasicTypeEnum<'ctx>],
    is_var_args: bool
) -> FunctionType<'ctx>
[src]

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);

pub fn array_type(self, size: u32) -> ArrayType<'ctx>[src]

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);

pub fn const_array(self, values: &[VectorValue<'ctx>]) -> ArrayValue<'ctx>[src]

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());

pub fn get_context(self) -> ContextRef<'ctx>[src]

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

impl<'ctx> AnyType<'ctx> for VectorType<'ctx>[src]

impl<'ctx> BasicType<'ctx> for VectorType<'ctx>[src]

impl<'ctx> Clone for VectorType<'ctx>[src]

impl<'ctx> Copy for VectorType<'ctx>[src]

impl<'ctx> Debug for VectorType<'ctx>[src]

impl<'ctx> Eq for VectorType<'ctx>[src]

impl<'ctx> FloatMathType<'ctx> for VectorType<'ctx>[src]

type ValueType = VectorValue<'ctx>

The value instance of a float or float vector type.

type MathConvType = VectorType<'ctx>

The type for float to int or float vector to int vector conversions.

impl<'ctx> From<VectorType<'ctx>> for AnyTypeEnum<'ctx>[src]

impl<'ctx> From<VectorType<'ctx>> for BasicTypeEnum<'ctx>[src]

impl<'ctx> IntMathType<'ctx> for VectorType<'ctx>[src]

type ValueType = VectorValue<'ctx>

The value instance of an int or int vector type.

type MathConvType = VectorType<'ctx>

The type for int to float or int vector to float vector conversions.

type PtrConvType = VectorType<'ctx>

The type for int to pointer or int vector to pointer vector conversions.

impl<'ctx> PartialEq<VectorType<'ctx>> for VectorType<'ctx>[src]

impl<'ctx> PointerMathType<'ctx> for VectorType<'ctx>[src]

type ValueType = VectorValue<'ctx>

The value instance of a pointer type.

type PtrConvType = VectorType<'ctx>

The type for pointer to int or pointer vector to int conversions.

impl<'ctx> StructuralEq for VectorType<'ctx>[src]

impl<'ctx> StructuralPartialEq for VectorType<'ctx>[src]

impl<'ctx> TryFrom<AnyTypeEnum<'ctx>> for VectorType<'ctx>[src]

type Error = ()

The type returned in the event of a conversion error.

impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for VectorType<'ctx>[src]

type Error = ()

The type returned in the event of a conversion error.

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.