Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutlineCfg use insert_hugr; remove CfgBuilder::from_existing #298

Merged
merged 5 commits into from
Jul 27, 2023

Conversation

acl-cqc
Copy link
Contributor

@acl-cqc acl-cqc commented Jul 26, 2023

This requires copying the created nodes, but there are, like, 6 of them, and means we can drop CfgBuilder::from_existing, easing the path to #282.

Also merge identical-signature impl Blocks and add BlockBuilder::finish_hugr_with_outputs, but no other Builder refactoring was required :)

@acl-cqc
Copy link
Contributor Author

acl-cqc commented Jul 26, 2023

There is another option/possibility that I thought about: adding to HugrMut new methods block_builder, dfg_builder, cfg_builder etc. (taking a parent node, and whatever inputs/Signature/etc. as per the corresponding methods in DfgBuilder/CfgBuilder) that return a BlockBuilder/DfgBuilder/CfgBuilder/whatever<&mut Hugr>.

At present the implementations of these builder methods in Dataflow depend upon Container so would need reworking, but since the impl of HugrMut knows it has an &mut Hugr it could be done - at least until we impl HugrMut for FlatRegionView whereupon we need the builder classes to work on a FlatRegionView, so I didn't think this would work out in the longer term.

Copy link
Member

@ss2165 ss2165 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

src/hugr/rewrite/outline_cfg.rs Outdated Show resolved Hide resolved
@acl-cqc acl-cqc enabled auto-merge July 27, 2023 14:24
@acl-cqc acl-cqc added this pull request to the merge queue Jul 27, 2023
Merged via the queue into main with commit 5f63cf6 Jul 27, 2023
6 checks passed
@acl-cqc acl-cqc deleted the refactor/outline_cfg_insert_hugr branch July 27, 2023 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants