refactor(mir): phase260 p0 edge-args plumbing (strangler) + ssot api + docs
This commit is contained in:
@ -233,12 +233,15 @@ pub fn try_parse_v1_to_module(json: &str) -> Result<Option<MirModule>, String> {
|
||||
condition: ValueId::new(cond),
|
||||
then_bb: BasicBlockId::new(then_bb),
|
||||
else_bb: BasicBlockId::new(else_bb),
|
||||
then_edge_args: None,
|
||||
else_edge_args: None,
|
||||
});
|
||||
}
|
||||
"jump" => {
|
||||
let target = require_u64(inst, "target", "jump target")? as u32;
|
||||
block_ref.add_instruction(MirInstruction::Jump {
|
||||
target: BasicBlockId::new(target),
|
||||
edge_args: None,
|
||||
});
|
||||
}
|
||||
"phi" => {
|
||||
|
||||
@ -512,10 +512,11 @@ pub fn emit_mir_json_for_harness(
|
||||
condition,
|
||||
then_bb,
|
||||
else_bb,
|
||||
..
|
||||
} => {
|
||||
insts.push(json!({"op":"branch","cond": condition.as_u32(), "then": then_bb.as_u32(), "else": else_bb.as_u32()}));
|
||||
}
|
||||
I::Jump { target } => {
|
||||
I::Jump { target, .. } => {
|
||||
insts.push(json!({"op":"jump","target": target.as_u32()}));
|
||||
}
|
||||
I::Return { value } => {
|
||||
@ -528,8 +529,8 @@ pub fn emit_mir_json_for_harness(
|
||||
if let Some(term) = &bb.terminator {
|
||||
match term {
|
||||
I::Return { value } => insts.push(json!({"op":"ret","value": value.map(|v| v.as_u32())})),
|
||||
I::Jump { target } => insts.push(json!({"op":"jump","target": target.as_u32()})),
|
||||
I::Branch { condition, then_bb, else_bb } => insts.push(json!({"op":"branch","cond": condition.as_u32(), "then": then_bb.as_u32(), "else": else_bb.as_u32()})),
|
||||
I::Jump { target, .. } => insts.push(json!({"op":"jump","target": target.as_u32()})),
|
||||
I::Branch { condition, then_bb, else_bb, .. } => insts.push(json!({"op":"branch","cond": condition.as_u32(), "then": then_bb.as_u32(), "else": else_bb.as_u32()})),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@ -874,10 +875,11 @@ pub fn emit_mir_json_for_harness_bin(
|
||||
condition,
|
||||
then_bb,
|
||||
else_bb,
|
||||
..
|
||||
} => {
|
||||
insts.push(json!({"op":"branch","cond": condition.as_u32(), "then": then_bb.as_u32(), "else": else_bb.as_u32()}));
|
||||
}
|
||||
I::Jump { target } => {
|
||||
I::Jump { target, .. } => {
|
||||
insts.push(json!({"op":"jump","target": target.as_u32()}));
|
||||
}
|
||||
I::Return { value } => {
|
||||
@ -890,8 +892,8 @@ pub fn emit_mir_json_for_harness_bin(
|
||||
if let Some(term) = &bb.terminator {
|
||||
match term {
|
||||
I::Return { value } => insts.push(json!({"op":"ret","value": value.map(|v| v.as_u32())})),
|
||||
I::Jump { target } => insts.push(json!({"op":"jump","target": target.as_u32()})),
|
||||
I::Branch { condition, then_bb, else_bb } => insts.push(json!({"op":"branch","cond": condition.as_u32(), "then": then_bb.as_u32(), "else": else_bb.as_u32()})),
|
||||
I::Jump { target, .. } => insts.push(json!({"op":"jump","target": target.as_u32()})),
|
||||
I::Branch { condition, then_bb, else_bb, .. } => insts.push(json!({"op":"branch","cond": condition.as_u32(), "then": then_bb.as_u32(), "else": else_bb.as_u32()})),
|
||||
_ => {} }
|
||||
}
|
||||
blocks.push(json!({"id": bid.as_u32(), "instructions": insts}));
|
||||
|
||||
@ -144,12 +144,15 @@ pub fn parse_mir_v0_to_module(json: &str) -> Result<MirModule, String> {
|
||||
condition: ValueId::new(cond),
|
||||
then_bb: BasicBlockId::new(then_bb),
|
||||
else_bb: BasicBlockId::new(else_bb),
|
||||
then_edge_args: None,
|
||||
else_edge_args: None,
|
||||
});
|
||||
}
|
||||
"jump" => {
|
||||
let target = require_u64(inst, "target", "jump target")? as u32;
|
||||
block_ref.add_instruction(MirInstruction::Jump {
|
||||
target: BasicBlockId::new(target),
|
||||
edge_args: None,
|
||||
});
|
||||
}
|
||||
"phi" => {
|
||||
|
||||
Reference in New Issue
Block a user