Remove LdStType

This commit is contained in:
Andrzej Janik
2021-04-15 19:53:54 +02:00
parent 4d04fe251d
commit 8cd3db6648
3 changed files with 8 additions and 30 deletions

View File

@ -595,32 +595,10 @@ pub struct LdDetails {
pub qualifier: LdStQualifier, pub qualifier: LdStQualifier,
pub state_space: LdStateSpace, pub state_space: LdStateSpace,
pub caching: LdCacheOperator, pub caching: LdCacheOperator,
pub typ: LdStType, pub typ: PointerType,
pub non_coherent: bool, pub non_coherent: bool,
} }
sub_type! {
LdStType {
Scalar(ScalarType),
Vector(ScalarType, u8),
// Used in generated code
Pointer(PointerType, LdStateSpace),
}
}
impl From<LdStType> for PointerType {
fn from(t: LdStType) -> Self {
match t {
LdStType::Scalar(t) => PointerType::Scalar(t.into()),
LdStType::Vector(t, len) => PointerType::Vector(t.into(), len),
LdStType::Pointer(PointerType::Scalar(scalar_type), space) => {
PointerType::Pointer(scalar_type, space)
}
LdStType::Pointer(..) => unreachable!(),
}
}
}
#[derive(Copy, Clone, PartialEq, Eq)] #[derive(Copy, Clone, PartialEq, Eq)]
pub enum LdStQualifier { pub enum LdStQualifier {
Weak, Weak,
@ -853,7 +831,7 @@ pub struct StData {
pub qualifier: LdStQualifier, pub qualifier: LdStQualifier,
pub state_space: StStateSpace, pub state_space: StStateSpace,
pub caching: StCacheOperator, pub caching: StCacheOperator,
pub typ: LdStType, pub typ: PointerType,
} }
#[derive(PartialEq, Eq, Copy, Clone)] #[derive(PartialEq, Eq, Copy, Clone)]

View File

@ -789,9 +789,9 @@ InstLd: ast::Instruction<ast::ParsedArgParams<'input>> = {
} }
}; };
LdStType: ast::LdStType = { LdStType: ast::PointerType = {
<v:VectorPrefix> <t:LdStScalarType> => ast::LdStType::Vector(t, v), <v:VectorPrefix> <t:LdStScalarType> => ast::PointerType::Vector(t, v),
<t:LdStScalarType> => ast::LdStType::Scalar(t), <t:LdStScalarType> => ast::PointerType::Scalar(t),
} }
LdStQualifier: ast::LdStQualifier = { LdStQualifier: ast::LdStQualifier = {

View File

@ -4553,7 +4553,7 @@ fn convert_to_stateful_memory_access<'a>(
Statement::Instruction(ast::Instruction::Ld( Statement::Instruction(ast::Instruction::Ld(
ast::LdDetails { ast::LdDetails {
state_space: ast::LdStateSpace::Param, state_space: ast::LdStateSpace::Param,
typ: ast::LdStType::Scalar(ast::ScalarType::U64), typ: ast::PointerType::Scalar(ast::ScalarType::U64),
.. ..
}, },
arg, arg,
@ -4561,7 +4561,7 @@ fn convert_to_stateful_memory_access<'a>(
| Statement::Instruction(ast::Instruction::Ld( | Statement::Instruction(ast::Instruction::Ld(
ast::LdDetails { ast::LdDetails {
state_space: ast::LdStateSpace::Param, state_space: ast::LdStateSpace::Param,
typ: ast::LdStType::Scalar(ast::ScalarType::S64), typ: ast::PointerType::Scalar(ast::ScalarType::S64),
.. ..
}, },
arg, arg,
@ -4569,7 +4569,7 @@ fn convert_to_stateful_memory_access<'a>(
| Statement::Instruction(ast::Instruction::Ld( | Statement::Instruction(ast::Instruction::Ld(
ast::LdDetails { ast::LdDetails {
state_space: ast::LdStateSpace::Param, state_space: ast::LdStateSpace::Param,
typ: ast::LdStType::Scalar(ast::ScalarType::B64), typ: ast::PointerType::Scalar(ast::ScalarType::B64),
.. ..
}, },
arg, arg,