From 003119b9f285e5610f56186bce845441409265ae Mon Sep 17 00:00:00 2001 From: nodist Date: Sat, 18 Jul 2026 14:01:26 -0400 Subject: op and ir matching definitions --- docs/lifecycle/jit.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'docs/lifecycle/jit.md') diff --git a/docs/lifecycle/jit.md b/docs/lifecycle/jit.md index 3ff7079..3ef73e0 100644 --- a/docs/lifecycle/jit.md +++ b/docs/lifecycle/jit.md @@ -53,3 +53,28 @@ kpl_x64_inst(INSTRUCTION, [TYPE, VALUE]..., END) kpl_x64_inst_pfx(PREFIX, INSTRUCTION, [TYPE, VALUE]..., END) ``` + +# Ir Matching + +Use tree with sub trees to match Ir operations to JIT functions + +1. Match Name +2. Match Args until None or End +3. Run JIT Fn + +## Object Definitions + +```c +typedef struct _kpl_ir_match { + int32_t tree_weight; + union { + kpl_ir_name ir_name; + kpl_type_header type_header; + } match; + union { + struct _kpl_ir_match *children; + void *jit_fn; // TODO + } next; + struct _kpl_ir_match *tree_left *tree_right; +} kpl_ir_match; +``` -- cgit v1.2.3