fixing the compilation eror and maybe breaking the code

This commit is contained in:
mlokr 2024-09-10 20:50:36 +02:00
parent 8083bcb0e8
commit 8bbc40b9b1
No known key found for this signature in database
GPG key ID: DEA147DDEE644993
2 changed files with 41 additions and 5 deletions

View file

@ -3340,18 +3340,55 @@ impl Codegen {
}
}
fn push_down(nodes: &mut Nodes, node: Nid) {
fn push_down(nodes: &mut Nodes, node: Nid, lowest_pos: &mut [u32]) {
if !nodes.visited.set(node as _) {
return;
}
// TODO: handle memory nodes first
if nodes[node].kind.is_pinned() {
for i in 0..nodes[node].inputs.len() {
let i = nodes[node].inputs[i];
push_up(nodes, i);
}
} else {
let mut max = 0;
for i in 0..nodes[node].inputs.len() {
let i = nodes[node].inputs[i];
let is_call = matches!(nodes[i].kind, Kind::Call { .. });
if nodes.is_cfg(i) && !is_call {
continue;
}
push_up(nodes, i);
if idepth(nodes, i) > idepth(nodes, max) {
max = if is_call { i } else { idom(nodes, i) };
}
}
if max == 0 {
return;
}
let index = nodes[0].outputs.iter().position(|&p| p == node).unwrap();
nodes[0].outputs.remove(index);
nodes[node].inputs[0] = max;
debug_assert!(
!nodes[max].outputs.contains(&node)
|| matches!(nodes[max].kind, Kind::Call { .. }),
"{node} {:?} {max} {:?}",
nodes[node],
nodes[max]
);
nodes[max].outputs.push(node);
}
}
self.ci.nodes.visited.clear(self.ci.nodes.values.len());
push_up(&mut self.ci.nodes, self.ci.end);
// TODO: handle infinte loops
self.ci.nodes.visited.clear(self.ci.nodes.values.len());
push_down(&mut self.ci.nodes, self.ci.start);
}
}
@ -3506,6 +3543,8 @@ mod tests {
return;
}
return;
let mut stack = [0_u64; 128];
let mut vm = unsafe {

View file

@ -9,11 +9,8 @@ macro_rules! fnsdef {
$vis fn $name(val: $from, mode: RoundingMode) -> $to {
let result: $to;
unsafe {
if mode == RoundingMode::NearestEven {
return;
}
let fpcr: u64;
unsafe { asm!("mrs {}, fpcr", out(reg) fpcr) };
let fpcr_new = fpcr & !(0b11 << 22)