diff options
Diffstat (limited to 'patio-to-cranelift/src/patio/flatbuffers.rs')
| -rw-r--r-- | patio-to-cranelift/src/patio/flatbuffers.rs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/patio-to-cranelift/src/patio/flatbuffers.rs b/patio-to-cranelift/src/patio/flatbuffers.rs index 7548d35d..c219d823 100644 --- a/patio-to-cranelift/src/patio/flatbuffers.rs +++ b/patio-to-cranelift/src/patio/flatbuffers.rs @@ -6,10 +6,10 @@ use crate::{ PatioLocal, PatioLocalType, PatioVisibility, }, instructions::{ - PatioBlock, PatioBoolToInt, PatioCall, PatioIf, PatioInstruction, PatioIntAdd, - PatioIntEquals, PatioIntNotEqual, PatioIntSub, PatioIntToBool, PatioLocalStore, - PatioMemoryLoad, PatioMemoryStore, PatioResume, PatioReturn, PatioReturnVoid, - PatioVarLoad, PatioVarStore, + PatioBlock, PatioBoolToInt, PatioCall, PatioCallPointer, PatioIf, PatioInstruction, + PatioIntAdd, PatioIntEquals, PatioIntNotEqual, PatioIntSub, PatioIntToBool, + PatioLocalStore, PatioMemoryLoad, PatioMemoryStore, PatioResume, PatioReturn, + PatioReturnVoid, PatioVarLoad, PatioVarStore, }, operands::{PatioLocalRef, PatioOperand}, types::{PatioDataLayout, PatioType}, @@ -164,6 +164,16 @@ impl From<patio_generated::patio::PatioInstruction<'_>> for PatioInstruction { }) } + patio_generated::patio::PatioInstructionValue::PatioCallPointer => { + let call_pointer = value.value_as_patio_call_pointer().unwrap(); + + Self::CallPointer(PatioCallPointer { + destination: call_pointer.destination().into(), + function_pointer: call_pointer.function_pointer().into(), + args: call_pointer.args().iter().map(Into::into).collect(), + }) + } + patio_generated::patio::PatioInstructionValue::PatioIf => { let if_ = value.value_as_patio_if().unwrap(); @@ -332,7 +342,8 @@ impl From<patio_generated::patio::PatioOperand<'_>> for PatioOperand { } patio_generated::patio::PatioOperandValue::PatioFunctionPtrConst => { - Self::FunctionPtrConst + let function_ptr_const = value.value_as_patio_function_ptr_const().unwrap(); + Self::FunctionPtrConst(function_ptr_const.name().to_string()) } patio_generated::patio::PatioOperandValue::PatioIntConst => { |
