Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
rikhuijzer committed Dec 20, 2024
1 parent caf0a6f commit 9a2d2ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
12 changes: 3 additions & 9 deletions xrcf/src/dialect/cf/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,12 @@ impl Op for BranchOp {
}
fn display(&self, f: &mut Formatter<'_>, _indent: i32) -> std::fmt::Result {
write!(f, "{} ", self.operation.name())?;
let dest = self.dest().expect("Dest not set");
let dest = dest.rd();
write!(f, "{}", dest)?;
let operands = self.operation().operands();
let operands = operands.vec();
let operands = operands.rd();
let operands = operands.iter().skip(1);
write!(f, "{}", self.dest().expect("dest not set").rd())?;
let operands = self.operation().operands().into_iter().skip(1);
if 0 < operands.len() {
write!(f, "(")?;
for operand in operands {
let operand = operand.rd();
operand.display_with_type(f)?;
operand.rd().display_with_type(f)?;
}
write!(f, ")")?;
}
Expand Down
17 changes: 9 additions & 8 deletions xrcf/src/dialect/experimental/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ impl PrintfOp {
pub fn text(&self) -> StringAttr {
let operands = self.operation.operand(0);
let operand = operands.expect("no operand");
let operand = operand.rd();
let value = operand.value();
let value = operand.rd().value();
let value = value.rd();
let text = match &*value {
Value::Constant(constant) => constant,
match &*value {
Value::Constant(constant) => constant
.value()
.as_any()
.downcast_ref::<StringAttr>()
.unwrap()
.clone(),
_ => panic!("expected constant"),
};
let text = text.value();
let text = text.as_any().downcast_ref::<StringAttr>().unwrap();
text.clone()
}
}
/// Set the first operand to `printf`.
pub fn set_text(&mut self, text: StringAttr) {
Expand Down

0 comments on commit 9a2d2ef

Please sign in to comment.