|
|
@ -26,6 +26,8 @@ pub enum DataDisp { |
|
|
|
Register(Register), |
|
|
|
Register(Register), |
|
|
|
/// Pointer into memory, stored in a numbered register
|
|
|
|
/// Pointer into memory, stored in a numbered register
|
|
|
|
RegisterPtr(Register), |
|
|
|
RegisterPtr(Register), |
|
|
|
|
|
|
|
/// Discard the written value
|
|
|
|
|
|
|
|
Discard, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Display for DataDisp { |
|
|
|
impl Display for DataDisp { |
|
|
@ -43,6 +45,9 @@ impl Display for DataDisp { |
|
|
|
DataDisp::RegisterPtr(r) => { |
|
|
|
DataDisp::RegisterPtr(r) => { |
|
|
|
write!(f, "@{}", r) |
|
|
|
write!(f, "@{}", r) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
DataDisp::Discard => { |
|
|
|
|
|
|
|
write!(f, "_") |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -64,7 +69,7 @@ impl From<DstDisp> for DataDisp { |
|
|
|
DstDisp::ImmediatePtr(x) => DataDisp::ImmediatePtr(x), |
|
|
|
DstDisp::ImmediatePtr(x) => DataDisp::ImmediatePtr(x), |
|
|
|
DstDisp::Register(x) => DataDisp::Register(x), |
|
|
|
DstDisp::Register(x) => DataDisp::Register(x), |
|
|
|
DstDisp::RegisterPtr(x) => DataDisp::RegisterPtr(x), |
|
|
|
DstDisp::RegisterPtr(x) => DataDisp::RegisterPtr(x), |
|
|
|
DstDisp::Discard => DataDisp::Immediate(0), |
|
|
|
DstDisp::Discard => DataDisp::Discard, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -91,6 +96,7 @@ impl TryFrom<DataDisp> for SrcDisp { |
|
|
|
DataDisp::ImmediatePtr(x) => Ok(SrcDisp::ImmediatePtr(x)), |
|
|
|
DataDisp::ImmediatePtr(x) => Ok(SrcDisp::ImmediatePtr(x)), |
|
|
|
DataDisp::Register(x) => Ok(SrcDisp::Register(x)), |
|
|
|
DataDisp::Register(x) => Ok(SrcDisp::Register(x)), |
|
|
|
DataDisp::RegisterPtr(x) => Ok(SrcDisp::RegisterPtr(x)), |
|
|
|
DataDisp::RegisterPtr(x) => Ok(SrcDisp::RegisterPtr(x)), |
|
|
|
|
|
|
|
DataDisp::Discard => Err(AsmError::DiscardAsValue), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -128,6 +134,7 @@ impl TryFrom<DataDisp> for DstDisp { |
|
|
|
DataDisp::ImmediatePtr(x) => Ok(DstDisp::ImmediatePtr(x)), |
|
|
|
DataDisp::ImmediatePtr(x) => Ok(DstDisp::ImmediatePtr(x)), |
|
|
|
DataDisp::Register(x) => Ok(DstDisp::Register(x)), |
|
|
|
DataDisp::Register(x) => Ok(DstDisp::Register(x)), |
|
|
|
DataDisp::RegisterPtr(x) => Ok(DstDisp::RegisterPtr(x)), |
|
|
|
DataDisp::RegisterPtr(x) => Ok(DstDisp::RegisterPtr(x)), |
|
|
|
|
|
|
|
DataDisp::Discard => Ok(DstDisp::Discard), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|