From 4615b760d308705f524bc20d009b171b585d9231 Mon Sep 17 00:00:00 2001 From: "Guillem L. Jara" <4lon3ly0@tutanota.com> Date: Wed, 27 May 2026 08:13:03 +0200 Subject: [PATCH] interpreter: Instruction fmt --- interpreter/src/ir.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/interpreter/src/ir.rs b/interpreter/src/ir.rs index 5f583f3..dc94fee 100644 --- a/interpreter/src/ir.rs +++ b/interpreter/src/ir.rs @@ -148,7 +148,15 @@ impl Display for Instruction { Self::Jump(label) => { write!(f, "{op} {label}") } - _ => todo!(), + Self::Return(src) => { + write!(f, "{op} {src}") + } + Self::IntrinsicCall((dest, code, args)) | Self::IndirectCall((dest, code, args)) => { + write!(f, "{dest} <- {op} {code}, {args}") + } + Self::UserCall((dest, src, args)) => { + write!(f, "{dest} <- {op} {src}, {args}") + } } } } @@ -207,6 +215,12 @@ impl Display for Reg { impl Display for NonLocal { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.0) + <_ as Display>::fmt(&self.0, f) + } +} + +impl Display for ArgCount { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + <_ as Display>::fmt(&self.0, f) } }