diff options
| author | Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> | 2025-02-06 14:42:54 -0500 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2025-04-18 21:52:56 +0900 |
| commit | e0f1bc86b9fd3f82200d2651e578c4120cd975cf (patch) | |
| tree | 9ce1b9e4ba2410ad1be389aec9fb0dba489c1bae | |
| parent | d7dbaf04fab43d75d6e77ee45a77567cfdc831ed (diff) | |
Sketch opt_plus
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
| -rw-r--r-- | zjit/src/ir.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/zjit/src/ir.rs b/zjit/src/ir.rs index 620dc6bda9..b64fe24716 100644 --- a/zjit/src/ir.rs +++ b/zjit/src/ir.rs @@ -43,6 +43,9 @@ enum Insn { // Unconditional jump Jump(BranchEdge), + // Operators + Add { v0: Opnd, v1: Opnd }, + // Conditional branch instructions IfTrue { val: Opnd, branch: BranchEdge }, IfFalse { val: Opnd, target: BranchEdge }, @@ -61,6 +64,7 @@ impl Block { struct Function { // TODO: // ISEQ this function refers to + //iseq: *const iseqptr_t, entry_block: BlockId, insns: Vec<Insn>, @@ -233,6 +237,15 @@ pub fn iseq_to_ssa(iseq: *const rb_iseq_t) { state.push(right); state.push(left); } + + YARVINSN_opt_plus => { + // TODO: we need to add a BOP not redefined check here + let v0 = state.pop(); + let v1 = state.pop(); + let add_id = result.push_insn(block, Insn::Add { v0, v1 }); + state.push(Opnd::Insn(add_id)); + } + YARVINSN_leave => { result.push_insn(block, Insn::Return { val: state.pop() }); } |
