Remove Type::Pointer (#428)

This commit is contained in:
Violet
2025-07-23 11:22:17 -07:00
committed by GitHub
parent 27cfd50ddd
commit a86ba3d642
3 changed files with 2 additions and 30 deletions

View File

@ -138,10 +138,7 @@ pub(crate) fn default_implicit_conversion(
}
}
if instruction_space != operand_space {
default_implicit_conversion_space(
(operand_space, operand_type),
(instruction_space, instruction_type),
)
default_implicit_conversion_space((operand_space, operand_type), instruction_space)
} else if instruction_type != operand_type {
default_implicit_conversion_type(instruction_space, operand_type, instruction_type)
} else {
@ -167,7 +164,7 @@ fn is_addressable(this: ast::StateSpace) -> bool {
// Space is different
fn default_implicit_conversion_space(
(operand_space, operand_type): (ast::StateSpace, &ast::Type),
(instruction_space, instruction_type): (ast::StateSpace, &ast::Type),
instruction_space: ast::StateSpace,
) -> Result<Option<ConversionKind>, TranslateError> {
if (instruction_space == ast::StateSpace::Generic && coerces_to_generic(operand_space))
|| (operand_space == ast::StateSpace::Generic && coerces_to_generic(instruction_space))
@ -175,15 +172,6 @@ fn default_implicit_conversion_space(
Ok(Some(ConversionKind::PtrToPtr))
} else if operand_space == ast::StateSpace::Reg {
match operand_type {
ast::Type::Pointer(operand_ptr_type, operand_ptr_space)
if *operand_ptr_space == instruction_space =>
{
if instruction_type != &ast::Type::Scalar(*operand_ptr_type) {
Ok(Some(ConversionKind::PtrToPtr))
} else {
Ok(None)
}
}
// TODO: 32 bit
ast::Type::Scalar(ast::ScalarType::B64)
| ast::Type::Scalar(ast::ScalarType::U64)
@ -205,19 +193,6 @@ fn default_implicit_conversion_space(
},
_ => Err(error_mismatched_type()),
}
} else if instruction_space == ast::StateSpace::Reg {
match instruction_type {
ast::Type::Pointer(instruction_ptr_type, instruction_ptr_space)
if operand_space == *instruction_ptr_space =>
{
if operand_type != &ast::Type::Scalar(*instruction_ptr_type) {
Ok(Some(ConversionKind::PtrToPtr))
} else {
Ok(None)
}
}
_ => Err(error_mismatched_type()),
}
} else {
Err(error_mismatched_type())
}

View File

@ -2600,7 +2600,6 @@ fn get_type(context: LLVMContextRef, type_: &ast::Type) -> Result<LLVMTypeRef, T
LLVMArrayType2(result, *dimension as u64)
})
}
ast::Type::Pointer(_, space) => get_pointer_type(context, *space)?,
})
}

View File

@ -831,7 +831,6 @@ pub enum Type {
Vector(u8, ScalarType),
// .param.b32 foo[4];
Array(Option<NonZeroU8>, ScalarType, Vec<u32>),
Pointer(ScalarType, StateSpace),
}
impl Type {
@ -882,7 +881,6 @@ impl Type {
)
}
}
Type::Pointer(..) => Layout::new::<usize>(),
}
}
}