Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
rikhuijzer committed Dec 18, 2024
1 parent 033605a commit 9cbaa9d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions xrcf/src/convert/mlir_to_llvmir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ fn determine_argument_pairs(
return vec![];
}
let callers = callers.unwrap();
println!("callers: {:?}", callers.len());
let mut argument_pairs = vec![];
for caller in callers.iter() {
let caller = caller.try_read().unwrap();
Expand Down
30 changes: 17 additions & 13 deletions xrcf/src/ir/block.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::ir::BlockArgumentName;
use crate::ir::GuardedOp;
use crate::ir::GuardedOpOperand;
use crate::ir::GuardedOperation;
use crate::ir::Op;
use crate::ir::Operation;
Expand Down Expand Up @@ -126,23 +127,26 @@ impl Block {
let ops = predecessor.ops();
let ops = ops.try_read().unwrap();
for op in ops.iter() {
if let Some(label) = label {
let operation = op.operation();
let operands = operation.operands().vec();
let operands = operands.try_read().unwrap();
for operand in operands.iter() {
let operand = operand.try_read().unwrap();
let value = operand.value();
let value = value.try_read().unwrap();
if let Value::BlockLabel(block_label) = &*value {
if canonicalize_label(&block_label.name()) == canonicalize_label(&label)
{
let operation = op.operation();
let operands = operation.operands().vec();
let operands = operands.try_read().unwrap();
for operand in operands.iter() {
let value = operand.value();
let value = value.try_read().unwrap();
if let Value::BlockPtr(block_ptr) = &*value {
let current = block_ptr.block();
let current = &*current.try_read().unwrap();
if std::ptr::eq(current, self) {
callers.push(op.clone());
}
} else if let Value::BlockLabel(block_label) = &*value {
if let Some(label) = label {
let current = canonicalize_label(&block_label.name());
if current == canonicalize_label(label) {
callers.push(op.clone());
}
}
}
} else {
todo!("find via blockptr for this case but also previous case");
}
}
}
Expand Down

0 comments on commit 9cbaa9d

Please sign in to comment.