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

Generalize IControlFlowGraph successors #103676

Merged
merged 2 commits into from
Jun 26, 2024
Merged

Conversation

sbomer
Copy link
Member

@sbomer sbomer commented Jun 18, 2024

IControlFlowGraph was modeled after the Roslyn CFG API, where a block can have at most two successors - a fall-through successor, and a conditional successor. Switch statements are represented as a chain of checks for one case at a time.

This doesn't generalize well to CFGs in IL which can have more than two branch targets for a switch instruction. This changes the interface to expose an IEnumerable of successors.

  • Move IsConditional on block to ConditionKind on branch
  • Introduce GetSuccessors to replace GetConditionalSuccessor and GetFallThroughSuccessor

- Move IsConditional on block to ConditionKind on branch
- Introduce GetSuccessors to replace GetConditionalSuccessor
  and GetFallThroughSuccessor
@sbomer sbomer requested a review from marek-safar as a code owner June 18, 2024 23:29
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Jun 18, 2024
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Jun 18, 2024
Copy link
Contributor

Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@jtschuster jtschuster left a comment

Choose a reason for hiding this comment

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

Not familiar with the CFG area, but LGTM.

Add comment about ConditionKind
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers linkable-framework Issues associated with delivering a linker friendly framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants