summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <[email protected]>2025-02-06 14:13:52 -0500
committerTakashi Kokubun <[email protected]>2025-04-18 21:52:56 +0900
commit2b9570a24c88bb592760c40fd755d5fb6053c674 (patch)
tree2eab7a4d787b7b9af0029b67c199dbd196a67630
parent4b9455a859fc54dad4c2ad920f664021b2ae035b (diff)
Add BranchEdge
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13131
-rw-r--r--zjit/src/ir.rs17
-rw-r--r--zjit/src/lib.rs1
2 files changed, 14 insertions, 4 deletions
diff --git a/zjit/src/ir.rs b/zjit/src/ir.rs
index 1840663552..1e6154d520 100644
--- a/zjit/src/ir.rs
+++ b/zjit/src/ir.rs
@@ -17,6 +17,12 @@ enum Opnd {
}
#[derive(Debug, PartialEq)]
+struct BranchEdge {
+ target: BlockId,
+ args: Vec<Opnd>,
+}
+
+#[derive(Debug, PartialEq)]
enum Insn {
// SSA block parameter. Also used for function parameters in the function's entry block.
Param { idx: usize },
@@ -25,16 +31,19 @@ enum Insn {
AllocArray { count: usize },
ArraySet { idx: usize, val: Opnd },
+ //NewObject?
+ //SetIvar {},
+ //GetIvar {},
+
// Control flow instructions
Return { val: Opnd },
// Unconditional jump
- // Jump { target: BlockId },
+ Jump(BranchEdge),
- // TODO:
// Conditional branch instructions
- // IfTrue { val: Opnd, target: BlockId, }
- // IfFalse { val: Opnd, target: BlockId, }
+ IfTrue { val: Opnd, branch: BranchEdge },
+ IfFalse { val: Opnd, target: BranchEdge },
}
#[derive(Default, Debug, PartialEq)]
diff --git a/zjit/src/lib.rs b/zjit/src/lib.rs
index 4a602259f8..1210401623 100644
--- a/zjit/src/lib.rs
+++ b/zjit/src/lib.rs
@@ -7,6 +7,7 @@ mod ir;
mod stats;
mod utils;
mod virtualmem;
+mod asm;
use codegen::ZJITState;
use crate::cruby::*;