Skip to content

Commit

Permalink
feat: Extension inference for CFGs (#529)
Browse files Browse the repository at this point in the history
Based off of #527. Add constraints for control flow graphs and their
basic blocks, and a test of a CFG which adds resources in its basic
blocks.
Resolves #497
  • Loading branch information
croyzor authored Oct 3, 2023
1 parent e03a2ed commit 44a64b6
Show file tree
Hide file tree
Showing 2 changed files with 461 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/algorithm/nest_cfgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ pub(crate) mod test {
let mut cfg_builder = CFGBuilder::new(FunctionType::new(type_row![NAT], type_row![NAT]))?;

let pred_const =
cfg_builder.add_constant(Const::simple_predicate(0, 2), ExtensionSet::new())?; // Nothing here cares which
cfg_builder.add_constant(Const::simple_predicate(0, 2), ExtensionSet::new())?; // Nothing here cares which branch
let const_unit =
cfg_builder.add_constant(Const::simple_unary_predicate(), ExtensionSet::new())?;

Expand Down Expand Up @@ -678,7 +678,7 @@ pub(crate) mod test {
) -> Result<(Hugr, BasicBlockID, BasicBlockID), BuildError> {
let mut cfg_builder = CFGBuilder::new(FunctionType::new(type_row![NAT], type_row![NAT]))?;
let pred_const =
cfg_builder.add_constant(Const::simple_predicate(0, 2), ExtensionSet::new())?; // Nothing here cares which
cfg_builder.add_constant(Const::simple_predicate(0, 2), ExtensionSet::new())?; // Nothing here cares which branch
let const_unit =
cfg_builder.add_constant(Const::simple_unary_predicate(), ExtensionSet::new())?;

Expand Down Expand Up @@ -722,7 +722,7 @@ pub(crate) mod test {
separate_headers: bool,
) -> Result<(BasicBlockID, BasicBlockID), BuildError> {
let pred_const =
cfg_builder.add_constant(Const::simple_predicate(0, 2), ExtensionSet::new())?; // Nothing here cares which
cfg_builder.add_constant(Const::simple_predicate(0, 2), ExtensionSet::new())?; // Nothing here cares which branch
let const_unit =
cfg_builder.add_constant(Const::simple_unary_predicate(), ExtensionSet::new())?;

Expand Down
Loading

0 comments on commit 44a64b6

Please sign in to comment.