modified: src/ch2/linkedlist.rs
This commit is contained in:
parent
0dd21eca39
commit
3cb60c9922
|
@ -241,15 +241,34 @@ pub mod tests {
|
||||||
sdzero8a0,
|
sdzero8a0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//.L11:
|
let mut l11 = Block::new("L11".into());
|
||||||
// mv a4,a5
|
let mva4a5 = Inst::Mv(MvInst::new(REG_A4.into(), REG_A5.into()));
|
||||||
// ld a5,8(a5)
|
let lda58a5 = Inst::Ld(LdInst::new(REG_A5.into(), (8).into(), REG_A5.into()));
|
||||||
// bne a5,zero,.L11
|
let bnea5zeroL11 = Inst::Branch(BranchInst::new(
|
||||||
// ld ra,24(sp)
|
BranchOp::Bne,
|
||||||
// ld s0,16(sp)
|
REG_A5.into(),
|
||||||
// sd a0,8(a4)
|
REG_ZERO.into(),
|
||||||
// ld s1,8(sp)
|
"L11".into(),
|
||||||
// addi sp,sp,32
|
));
|
||||||
// jr ra
|
let ldra24sp = Inst::Ld(LdInst::new(REG_RA.into(), (24).into(), REG_SP.into()));
|
||||||
|
let lds016sp = Inst::Ld(LdInst::new(REG_S0.into(), (16).into(), REG_SP.into()));
|
||||||
|
let sds08sp = Inst::Sd(SdInst::new(REG_S0.into(), (8).into(), REG_A4.into()));
|
||||||
|
let lds18sp = Inst::Ld(LdInst::new(REG_S1.into(), (8).into(), REG_SP.into()));
|
||||||
|
let addispsp32 = Inst::Add(AddInst::new(REG_SP.into(), REG_SP.into(), (32).into()));
|
||||||
|
let ret = Inst::Ret;
|
||||||
|
l11.extend_insts(vec![
|
||||||
|
mva4a5,
|
||||||
|
lda58a5,
|
||||||
|
bnea5zeroL11,
|
||||||
|
ldra24sp,
|
||||||
|
lds016sp,
|
||||||
|
sds08sp,
|
||||||
|
lds18sp,
|
||||||
|
addispsp32,
|
||||||
|
ret,
|
||||||
|
]);
|
||||||
|
|
||||||
|
let mut insertNode = Func::new("insertNode".into(), Vec::new(), entry);
|
||||||
|
insertNode.push_bb(l11);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue