diff options
Diffstat (limited to 'patio-to-cranelift/src/patio/values.rs')
| -rw-r--r-- | patio-to-cranelift/src/patio/values.rs | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/patio-to-cranelift/src/patio/values.rs b/patio-to-cranelift/src/patio/values.rs deleted file mode 100644 index fe511437..00000000 --- a/patio-to-cranelift/src/patio/values.rs +++ /dev/null @@ -1,55 +0,0 @@ -use crate::patio::types::PatioDataLayout; - -pub(crate) enum PatioDataValue { - Array { - element_layout: PatioDataLayout, - elements: Vec<PatioDataValue>, - }, - Bool(bool), - Byte(u8), - DataPtr(PatioDataPtrValue), - Int(PatioIntValue), - Int32(PatioIntValue), - Struct { - elements: Vec<PatioDataValue>, - }, -} - -impl PatioDataValue { - pub(crate) fn layout(&self) -> PatioDataLayout { - match self { - PatioDataValue::Array { - element_layout, - elements, - } => PatioDataLayout::array(element_layout.clone(), elements.len().try_into().unwrap()), - PatioDataValue::Bool(_) => PatioDataLayout::Bool, - PatioDataValue::Byte(_) => PatioDataLayout::Byte, - PatioDataValue::DataPtr(_) => PatioDataLayout::DataPtr, - PatioDataValue::Int(_) => PatioDataLayout::Int, - PatioDataValue::Int32(_) => PatioDataLayout::Int32, - PatioDataValue::Struct { elements } => { - PatioDataLayout::struct_(elements.iter().map(|element| element.layout()).collect()) - } - } - } -} - -#[derive(Debug)] -pub(crate) enum PatioDataPtrValue { - DataElement { name: String }, - Null, -} - -#[derive(Debug)] -pub(crate) enum PatioIntValue { - ByteOffsetOf { - layout: PatioDataLayout, - element_offsets: Vec<u32>, - }, - ByteSizeOf { - layout: PatioDataLayout, - }, - Literal { - value: i32, - }, -} |
