use super::*;
use super::c_api::*;
pub fn create_named_struct<S>(name: S) -> Type where S: AsRef<str> {
Type {
ty: unsafe {
LLVMStructCreateNamed(context(), into_c(name).as_ptr())
}
}
}
pub fn ty_array(ty: Type, count: u32) -> Type {
Type {
ty: unsafe {
LLVMArrayType(ty.ty, count)
}
}
}
pub fn ty_struct(elements: Vec<Type>, packed: bool) -> Type {
Type {
ty: unsafe {
LLVMStructTypeInContext(context(), ty_vec(&elements).as_mut_ptr(), elements.len() as u32, packed as i32)
}
}
}
pub fn ty_void() -> Type {
Type {
ty: unsafe {
LLVMVoidTypeInContext(context())
}
}
}
pub fn ty_i1() -> Type {
Type {
ty: unsafe {
LLVMInt1TypeInContext(context())
}
}
}
pub fn ty_i8() -> Type {
Type {
ty: unsafe {
LLVMInt8TypeInContext(context())
}
}
}
pub fn ty_i16() -> Type {
Type {
ty: unsafe {
LLVMInt16TypeInContext(context())
}
}
}
pub fn ty_i32() -> Type {
Type {
ty: unsafe {
LLVMInt32TypeInContext(context())
}
}
}
pub fn ty_i64() -> Type {
Type {
ty: unsafe {
LLVMInt64TypeInContext(context())
}
}
}
pub fn ty_i128() -> Type {
Type {
ty: unsafe {
LLVMInt128TypeInContext(context())
}
}
}
pub fn ty_isize(data: &target::TargetData) -> Type {
Type {
ty: unsafe {
llvm_sys::target::LLVMIntPtrTypeInContext(context(), data.data)
}
}
}
pub fn ty_i(bits: u32) -> Type {
Type {
ty: unsafe {
LLVMIntTypeInContext(context(), bits)
}
}
}
pub fn ty_half() -> Type {
Type {
ty: unsafe {
LLVMHalfTypeInContext(context())
}
}
}
pub fn ty_float() -> Type {
Type {
ty: unsafe {
LLVMFloatTypeInContext(context())
}
}
}
pub fn ty_double() -> Type {
Type {
ty: unsafe {
LLVMDoubleTypeInContext(context())
}
}
}
pub fn ty_fp128() -> Type {
Type {
ty: unsafe {
LLVMFP128TypeInContext(context())
}
}
}