Skip to content

Generalize IControlFlowGraph successors - #103676

Merged
sbomer merged 2 commits into
dotnet:mainfrom
sbomer:getSuccessors
Jun 26, 2024
Merged

Generalize IControlFlowGraph successors#103676
sbomer merged 2 commits into
dotnet:mainfrom
sbomer:getSuccessors

Conversation

@sbomer

@sbomer sbomer commented Jun 18, 2024

Copy link
Copy Markdown
Member

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 review from jkurdek and jtschuster June 18, 2024 23:29
@sbomer
sbomer requested a review from marek-safar as a code owner June 18, 2024 23:29
@ghost ghost 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
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@jtschuster jtschuster left a comment

Copy link
Copy Markdown
Member

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.

Comment thread src/tools/illink/src/ILLink.RoslynAnalyzer/DataFlow/ControlFlowGraphProxy.cs Outdated
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