Compare commits
2 Commits
c3214191ff
...
9cc7d29143
Author | SHA1 | Date |
---|---|---|
wangfiox | 9cc7d29143 | |
wangfiox | afed4d2856 |
|
@ -1 +1,2 @@
|
||||||
/target
|
/target
|
||||||
|
.idea
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
pub mod tests {
|
||||||
|
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(), (-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()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
mod quicksort;
|
mod quicksort;
|
||||||
|
mod linkedlist;
|
||||||
|
|
||||||
pub use quicksort::*;
|
pub use quicksort::*;
|
||||||
|
pub use linkedlist::*;
|
||||||
|
|
Loading…
Reference in New Issue