modified: .gitignore

modified:   src/ch2/linkedlist.rs
	modified:   src/ch2/mod.rs
This commit is contained in:
wangfiox 2024-06-11 18:50:51 +08:00
parent afed4d2856
commit 9cc7d29143
3 changed files with 23 additions and 2 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/target
.idea

View File

@ -1,10 +1,28 @@
pub mod tests {
use compiler::backend::{AddInst, Block, BranchInst, BranchOp, Inst, JmpInst, MvInst, REG_A0, REG_A1, REG_A2, REG_RA, REG_S0, REG_S1, REG_S2, REG_SP, SdInst};
use compiler::backend::{AddInst, Block, BranchInst, BranchOp, CallInst, Inst, JmpInst, MvInst, REG_A0, REG_A1, REG_A2, REG_RA, REG_S0, REG_S1, REG_S2, REG_SP, REG_ZERO, SdInst};
use compiler::backend::Inst::Call;
#[test]
pub fn linked() {
// createLinkedList
let mut entry = Block::new("entry".into());
let addispsp_16 = Inst::Add(AddInst::new(REG_SP.into(), REG_SP.into()))
let addispsp_16 = Inst::Add(AddInst::new(REG_SP.into(), REG_SP.into(), (-16).into()));
let lia08 = Inst::Add(AddInst::new(REG_A0.into(), REG_ZERO.into(), (-16).into()));
let sdra8sp = Inst::Sd(SdInst::new(REG_RA.into(), (8).into(), REG_SP.into()));
let sds00sp = Inst::Sd(SdInst::new(REG_S0.into(), (0).into(), REG_SP.into()));
let callmalloc = Inst::Call(CallInst::new("malloc@plt".into()));
let beqa0zerol2 = Inst::Branch(BranchInst::new(BranchOp::Beq, REG_A0.into(), REG_ZERO.into(), "L2".into()));
let mvs0a0 = Inst::Mv(MvInst::new(REG_S0.into(), REG_A0.into()));
let lia016 = Inst::Add(AddInst::new(REG_A0.into(), REG_ZERO.into(), (16).into()));
let callmalloc = Inst::Call(CallInst::new("malloc@plt".into()));
let sda00s0 = Inst::Sd(SdInst::new(REG_A0.into(), (0).into(), REG_S0.into()));
let beqa0zerol3 = Inst::Branch(BranchInst::new(BranchOp::Beq, REG_A0.into(), REG_ZERO.into(), "L3".into()));
}
}

View File

@ -1,3 +1,5 @@
mod quicksort;
mod linkedlist;
pub use quicksort::*;
pub use linkedlist::*;