fixing compiler errors
This commit is contained in:
parent
0e9f4402cb
commit
338e3f1519
10
Cargo.lock
generated
10
Cargo.lock
generated
|
@ -170,10 +170,12 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regalloc2"
|
name = "regalloc2"
|
||||||
version = "0.10.2"
|
version = "0.10.2"
|
||||||
source = "git+https://github.com/jakubDoka/regalloc2#52b2bbe908e78af1715de88f562f62a83e36ca96"
|
source = "git+https://github.com/jakubDoka/regalloc2?branch=reuse-allocations#c1c7614b3a06d38113feaac11b4e4c9ab9e8f0c8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
|
"log",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
|
"slice-group-by",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -212,6 +214,12 @@ version = "2.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152"
|
checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slice-group-by"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.13.2"
|
version = "1.13.2"
|
||||||
|
|
47
fooll-orig.txt
Normal file
47
fooll-orig.txt
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
sb0[]-[]:
|
||||||
|
0: iCall { func: 1 }:[Def: v3i fixed(p1i)]
|
||||||
|
1: iCInt { value: 0 }:[Def: v6i reg]
|
||||||
|
2: iCInt { value: 30 }:[Def: v5i reg]
|
||||||
|
3: iCInt { value: 100 }:[Def: v4i reg]
|
||||||
|
4: iLoop:[]
|
||||||
|
eb0[VReg(vreg = 6, class = Int), VReg(vreg = 6, class = Int), VReg(vreg = 6, class = Int)]-[Block(1)]:
|
||||||
|
sb1[VReg(vreg = 18, class = Int), VReg(vreg = 8, class = Int), VReg(vreg = 15, class = Int)]-[Block(0), Block(11)]:
|
||||||
|
5: iIf:[Use: v8i reg, Use: v5i reg]
|
||||||
|
eb1[]-[Block(2), Block(10)]:
|
||||||
|
sb2[]-[Block(1)]:
|
||||||
|
6: iBinOp { op: Add }:[Def: v19i reg, Use: v18i reg]
|
||||||
|
7: iCall { func: 2 }:[Def: v20i fixed(p1i), Use: v6i fixed(p2i), Use: v19i fixed(p3i), Use: v5i fixed(p4i)]
|
||||||
|
8: iIf:[Use: v20i reg, Use: v15i reg]
|
||||||
|
eb2[]-[Block(3), Block(4)]:
|
||||||
|
sb3[]-[Block(2)]:
|
||||||
|
9: iReturn:[Use: v6i fixed(p1i)]
|
||||||
|
eb3[]-[]:
|
||||||
|
sb4[]-[Block(2)]:
|
||||||
|
10: iIf:[Use: v19i reg, Use: v4i reg]
|
||||||
|
eb4[]-[Block(5), Block(9)]:
|
||||||
|
sb5[]-[Block(4)]:
|
||||||
|
11: iLoop:[]
|
||||||
|
eb5[VReg(vreg = 19, class = Int)]-[Block(6)]:
|
||||||
|
sb6[VReg(vreg = 36, class = Int)]-[Block(5), Block(7)]:
|
||||||
|
12: iIf:[Use: v4i reg, Use: v36i reg]
|
||||||
|
eb6[]-[Block(7), Block(8)]:
|
||||||
|
sb7[]-[Block(6)]:
|
||||||
|
13: iBinOp { op: Add }:[Def: v41i reg, Use: v36i reg]
|
||||||
|
14: iLoop:[]
|
||||||
|
eb7[VReg(vreg = 41, class = Int)]-[Block(6)]:
|
||||||
|
sb8[]-[Block(6)]:
|
||||||
|
15: iReturn:[Use: v15i fixed(p1i)]
|
||||||
|
eb8[]-[]:
|
||||||
|
sb9[]-[Block(4)]:
|
||||||
|
16: iRegion:[]
|
||||||
|
eb9[VReg(vreg = 6, class = Int), VReg(vreg = 19, class = Int), VReg(vreg = 15, class = Int)]-[Block(11)]:
|
||||||
|
sb10[]-[Block(1)]:
|
||||||
|
17: iBinOp { op: Add }:[Def: v16i reg, Use: v15i reg]
|
||||||
|
18: iBinOp { op: Add }:[Def: v14i reg, Use: v8i reg]
|
||||||
|
19: iRegion:[]
|
||||||
|
eb10[VReg(vreg = 14, class = Int), VReg(vreg = 18, class = Int), VReg(vreg = 16, class = Int)]-[Block(11)]:
|
||||||
|
sb11[VReg(vreg = 32, class = Int), VReg(vreg = 33, class = Int), VReg(vreg = 34, class = Int)]-[Block(10), Block(9)]:
|
||||||
|
20: iLoop:[]
|
||||||
|
eb11[VReg(vreg = 33, class = Int), VReg(vreg = 32, class = Int), VReg(vreg = 34, class = Int)]-[Block(1)]:
|
||||||
|
|
||||||
|
|
48
fooll.txt
Normal file
48
fooll.txt
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
sb0[]-[]:
|
||||||
|
0: iCall { func: 1 }:[Def: v3i fixed(p1i)]
|
||||||
|
1: iCInt { value: 0 }:[Def: v6i reg]
|
||||||
|
2: iCInt { value: 30 }:[Def: v5i reg]
|
||||||
|
3: iCInt { value: 100 }:[Def: v4i reg]
|
||||||
|
4: iLoop:[]
|
||||||
|
eb0[VReg(vreg = 4, class = Int), VReg(vreg = 6, class = Int), VReg(vreg = 6, class = Int), VReg(vreg = 6, class = Int)]-[Block(1)]:
|
||||||
|
sb1[VReg(vreg = 26, class = Int), VReg(vreg = 8, class = Int), VReg(vreg = 15, class = Int), VReg(vreg = 18, class = Int)]-[Block(0), Block(11)]:
|
||||||
|
5: iIf:[Use: v8i reg, Use: v5i reg]
|
||||||
|
eb1[]-[Block(2), Block(10)]:
|
||||||
|
sb2[]-[Block(1)]:
|
||||||
|
6: iBinOp { op: Add }:[Def: v19i reg, Use: v18i reg]
|
||||||
|
7: iCall { func: 2 }:[Def: v20i fixed(p1i), Use: v6i fixed(p2i), Use: v19i fixed(p3i), Use: v5i fixed(p4i)]
|
||||||
|
8: iIf:[Use: v20i reg, Use: v15i reg]
|
||||||
|
eb2[]-[Block(3), Block(4)]:
|
||||||
|
sb3[]-[Block(2)]:
|
||||||
|
9: iReturn:[Use: v6i fixed(p1i)]
|
||||||
|
eb3[]-[]:
|
||||||
|
sb4[]-[Block(2)]:
|
||||||
|
10: iIf:[Use: v19i reg, Use: v4i reg]
|
||||||
|
eb4[]-[Block(5), Block(9)]:
|
||||||
|
sb5[]-[Block(4)]:
|
||||||
|
11: iBinOp { op: Add }:[Def: v35i reg, Use: v26i reg]
|
||||||
|
12: iLoop:[]
|
||||||
|
eb5[VReg(vreg = 19, class = Int)]-[Block(6)]:
|
||||||
|
sb6[VReg(vreg = 38, class = Int)]-[Block(5), Block(7)]:
|
||||||
|
13: iIf:[Use: v35i reg, Use: v38i reg]
|
||||||
|
eb6[]-[Block(7), Block(8)]:
|
||||||
|
sb7[]-[Block(6)]:
|
||||||
|
14: iBinOp { op: Add }:[Def: v43i reg, Use: v38i reg]
|
||||||
|
15: iLoop:[]
|
||||||
|
eb7[VReg(vreg = 43, class = Int)]-[Block(6)]:
|
||||||
|
sb8[]-[Block(6)]:
|
||||||
|
16: iReturn:[Use: v15i fixed(p1i)]
|
||||||
|
eb8[]-[]:
|
||||||
|
sb9[]-[Block(4)]:
|
||||||
|
17: iRegion:[]
|
||||||
|
eb9[VReg(vreg = 6, class = Int), VReg(vreg = 19, class = Int), VReg(vreg = 15, class = Int)]-[Block(11)]:
|
||||||
|
sb10[]-[Block(1)]:
|
||||||
|
18: iBinOp { op: Add }:[Def: v16i reg, Use: v15i reg]
|
||||||
|
19: iBinOp { op: Add }:[Def: v14i reg, Use: v8i reg]
|
||||||
|
20: iRegion:[]
|
||||||
|
eb10[VReg(vreg = 14, class = Int), VReg(vreg = 18, class = Int), VReg(vreg = 16, class = Int)]-[Block(11)]:
|
||||||
|
sb11[VReg(vreg = 32, class = Int), VReg(vreg = 33, class = Int), VReg(vreg = 34, class = Int)]-[Block(10), Block(9)]:
|
||||||
|
21: iLoop:[]
|
||||||
|
eb11[VReg(vreg = 0, class = Int), VReg(vreg = 32, class = Int), VReg(vreg = 34, class = Int), VReg(vreg = 33, class = Int)]-[Block(1)]:
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ path = "src/main.rs"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
hbbytecode = { version = "0.1.0", path = "../hbbytecode" }
|
hbbytecode = { version = "0.1.0", path = "../hbbytecode" }
|
||||||
hbvm = { path = "../hbvm", features = ["nightly"] }
|
hbvm = { path = "../hbvm", features = ["nightly"] }
|
||||||
regalloc2 = { git = "https://github.com/jakubDoka/regalloc2", features = [] }
|
regalloc2 = { git = "https://github.com/jakubDoka/regalloc2", branch = "reuse-allocations", features = ["trace-log"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.11.5"
|
env_logger = "0.11.5"
|
||||||
|
|
|
@ -505,7 +505,7 @@ main := fn(): int {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
width += 1
|
//width += 1
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if width < y break
|
if width < y break
|
||||||
|
|
|
@ -25,7 +25,6 @@ use {
|
||||||
mem::{self, MaybeUninit},
|
mem::{self, MaybeUninit},
|
||||||
ops::{self, Deref, DerefMut, Not},
|
ops::{self, Deref, DerefMut, Not},
|
||||||
ptr::Unique,
|
ptr::Unique,
|
||||||
u32,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1800,6 +1799,7 @@ impl Codegen {
|
||||||
let mut nodes = std::mem::take(&mut self.ci.nodes);
|
let mut nodes = std::mem::take(&mut self.ci.nodes);
|
||||||
|
|
||||||
let func = Function::new(&mut nodes, &self.tys, sig);
|
let func = Function::new(&mut nodes, &self.tys, sig);
|
||||||
|
dbg!(&func);
|
||||||
let mut env = regalloc2::MachineEnv {
|
let mut env = regalloc2::MachineEnv {
|
||||||
preferred_regs_by_class: [
|
preferred_regs_by_class: [
|
||||||
(1..12).map(|i| regalloc2::PReg::new(i, regalloc2::RegClass::Int)).collect(),
|
(1..12).map(|i| regalloc2::PReg::new(i, regalloc2::RegClass::Int)).collect(),
|
||||||
|
@ -2349,7 +2349,6 @@ impl<'a> Function<'a> {
|
||||||
}
|
}
|
||||||
Kind::Ctrl { index: u32::MAX } => {
|
Kind::Ctrl { index: u32::MAX } => {
|
||||||
self.nodes[nid].ralloc_backref = self.add_block(nid);
|
self.nodes[nid].ralloc_backref = self.add_block(nid);
|
||||||
self.bridge(prev, nid);
|
|
||||||
|
|
||||||
let mut parama = self.tys.parama(self.sig.ret);
|
let mut parama = self.tys.parama(self.sig.ret);
|
||||||
for (arg, ti) in
|
for (arg, ti) in
|
||||||
|
@ -2475,16 +2474,16 @@ impl<'a> regalloc2::Function for Function<'a> {
|
||||||
self.blocks[block.index()].instrs
|
self.blocks[block.index()].instrs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn block_succs(&self, block: regalloc2::Block) -> impl Iterator<Item = regalloc2::Block> {
|
fn block_succs(&self, block: regalloc2::Block) -> &[regalloc2::Block] {
|
||||||
self.blocks[block.index()].succs.iter().copied()
|
&self.blocks[block.index()].succs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn block_preds(&self, block: regalloc2::Block) -> impl Iterator<Item = regalloc2::Block> {
|
fn block_preds(&self, block: regalloc2::Block) -> &[regalloc2::Block] {
|
||||||
self.blocks[block.index()].preds.iter().copied()
|
&self.blocks[block.index()].preds
|
||||||
}
|
}
|
||||||
|
|
||||||
fn block_params(&self, block: regalloc2::Block) -> impl Iterator<Item = regalloc2::VReg> {
|
fn block_params(&self, block: regalloc2::Block) -> &[regalloc2::VReg] {
|
||||||
self.blocks[block.index()].params.iter().copied()
|
&self.blocks[block.index()].params
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_ret(&self, insn: regalloc2::Inst) -> bool {
|
fn is_ret(&self, insn: regalloc2::Inst) -> bool {
|
||||||
|
@ -2503,17 +2502,17 @@ impl<'a> regalloc2::Function for Function<'a> {
|
||||||
block: regalloc2::Block,
|
block: regalloc2::Block,
|
||||||
_insn: regalloc2::Inst,
|
_insn: regalloc2::Inst,
|
||||||
_succ_idx: usize,
|
_succ_idx: usize,
|
||||||
) -> impl Iterator<Item = regalloc2::VReg> {
|
) -> &[regalloc2::VReg] {
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
self.blocks[block.index()].succs.len() == 1
|
self.blocks[block.index()].succs.len() == 1
|
||||||
|| self.blocks[block.index()].branch_blockparams.is_empty()
|
|| self.blocks[block.index()].branch_blockparams.is_empty()
|
||||||
);
|
);
|
||||||
|
|
||||||
self.blocks[block.index()].branch_blockparams.iter().copied()
|
&self.blocks[block.index()].branch_blockparams
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inst_operands(&self, insn: regalloc2::Inst) -> impl Iterator<Item = regalloc2::Operand> {
|
fn inst_operands(&self, insn: regalloc2::Inst) -> &[regalloc2::Operand] {
|
||||||
self.instrs[insn.index()].ops.iter().copied()
|
&self.instrs[insn.index()].ops
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inst_clobbers(&self, insn: regalloc2::Inst) -> regalloc2::PRegSet {
|
fn inst_clobbers(&self, insn: regalloc2::Inst) -> regalloc2::PRegSet {
|
||||||
|
|
Loading…
Reference in a new issue