aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-04-04 09:02:19 +0100
committerMichael Williamson <mike@zwobble.org>2026-04-04 09:02:19 +0100
commit3f14376778a3ddab715e56e58fa5d9d0a39cd21b (patch)
tree47aff0bc428226520dfdd7bcb82508f2cd8ce96c
parent2dc2b5624be8e4c51cd50bc77de6687c410e55bc (diff)
Implement resume in patio-to-cranelift
-rw-r--r--patio-to-cranelift/src/lib.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/patio-to-cranelift/src/lib.rs b/patio-to-cranelift/src/lib.rs
index 430df6ff..128fd459 100644
--- a/patio-to-cranelift/src/lib.rs
+++ b/patio-to-cranelift/src/lib.rs
@@ -11,7 +11,7 @@ use crate::{
PatioCompilationUnitElementValue, PatioFunctionDefinition, PatioIf, PatioInstruction,
PatioInstructionValue, PatioIntAdd, PatioIntEquals, PatioIntNotEqual, PatioIntSub,
PatioIntToBool, PatioIntValue, PatioIntValueValue, PatioLocal, PatioLocalRef,
- PatioLocalStore, PatioLocalType, PatioOperand, PatioOperandValue, PatioReturn,
+ PatioLocalStore, PatioLocalType, PatioOperand, PatioOperandValue, PatioResume, PatioReturn,
PatioReturnVoid, PatioVarLoad, PatioVarStore, PatioVisibility,
},
};
@@ -244,6 +244,11 @@ fn compile_instruction(
compile_local_store(local_store, context);
}
+ PatioInstructionValue::PatioResume => {
+ let resume = instruction.value_as_patio_resume().unwrap();
+ compile_resume(resume, context);
+ }
+
PatioInstructionValue::PatioReturn => {
let return_ = instruction.value_as_patio_return().unwrap();
compile_return(return_, context);
@@ -434,6 +439,12 @@ fn compile_local_store(
def_destination(local_store.destination(), cranelift_value, context);
}
+fn compile_resume(resume: PatioResume<'_>, context: &mut CompilerFunctionContext<'_>) {
+ let cranelift_value = compile_operand(resume.value(), context);
+
+ context.function_builder.ins().return_(&[cranelift_value]);
+}
+
fn compile_return(return_: PatioReturn<'_>, context: &mut CompilerFunctionContext<'_>) {
let cranelift_value = compile_operand(return_.value(), context);