Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove LLVM typed pointer #336

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 2 additions & 29 deletions melior/src/dialect/llvm/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use crate::{
ir::{Type, TypeLike},
};
use mlir_sys::{
mlirLLVMArrayTypeGet, mlirLLVMFunctionTypeGet, mlirLLVMPointerTypeGet,
mlirLLVMStructTypeLiteralGet, mlirLLVMVoidTypeGet,
mlirLLVMArrayTypeGet, mlirLLVMFunctionTypeGet, mlirLLVMStructTypeLiteralGet,
mlirLLVMVoidTypeGet,
};

// TODO Check if the `llvm` dialect is loaded on use of those functions.
Expand Down Expand Up @@ -37,11 +37,6 @@ pub fn opaque_pointer(context: &Context) -> Type {
Type::parse(context, "!llvm.ptr").unwrap()
}

/// Creates an LLVM pointer type.
pub fn pointer(r#type: Type, address_space: u32) -> Type {
unsafe { Type::from_raw(mlirLLVMPointerTypeGet(r#type.to_raw(), address_space)) }
}

/// Creates an LLVM struct type.
pub fn r#struct<'c>(context: &'c Context, fields: &[Type<'c>], packed: bool) -> Type<'c> {
unsafe {
Expand Down Expand Up @@ -83,28 +78,6 @@ mod tests {
);
}

#[test]
fn pointer() {
let context = create_context();
let i32 = IntegerType::new(&context, 32).into();

assert_eq!(
super::pointer(i32, 0),
Type::parse(&context, "!llvm.ptr<i32>").unwrap()
);
}

#[test]
fn pointer_with_address_space() {
let context = create_context();
let i32 = IntegerType::new(&context, 32).into();

assert_eq!(
super::pointer(i32, 4),
Type::parse(&context, "!llvm.ptr<i32, 4>").unwrap()
);
}

#[test]
fn void() {
let context = create_context();
Expand Down