-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ScopeRegion::ScopeType and DominatorTree extension class
- Loading branch information
Showing
8 changed files
with
102 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/Core/Echo.ControlFlow/Regions/IScopeControlFlowRegion.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Collections.Generic; | ||
using Echo.ControlFlow.Collections; | ||
|
||
namespace Echo.ControlFlow.Regions; | ||
|
||
/// <summary> | ||
/// Represents a scope of nodes and regions. | ||
/// </summary> | ||
/// <typeparam name="TInstruction">The type of data that each node in the graph stores.</typeparam> | ||
public interface IScopeControlFlowRegion<TInstruction> : IControlFlowRegion<TInstruction> | ||
where TInstruction : notnull | ||
{ | ||
/// <summary> | ||
/// Gets a collection of top-level nodes stored in this region. | ||
/// </summary> | ||
public ICollection<ControlFlowNode<TInstruction>> Nodes { get; } | ||
|
||
/// <summary> | ||
/// Gets a collection of nested subregions that this region defines. | ||
/// </summary> | ||
public RegionCollection<TInstruction, ControlFlowRegion<TInstruction>> Regions { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace Echo.ControlFlow.Regions; | ||
|
||
/// <summary> | ||
/// Provides members describing all possible types a scope region can be. | ||
/// </summary> | ||
public enum ScopeRegionType | ||
{ | ||
/// <summary> | ||
/// Indicates no special semantics. | ||
/// </summary> | ||
None, | ||
|
||
/// <summary> | ||
/// Indicates the scope was introduced as a result of a conditional branch (e.g., if-else or switch). | ||
/// The entry point node of the scope implements the condition and the true/false branches. | ||
/// </summary> | ||
Conditional, | ||
|
||
/// <summary> | ||
/// Indicates the scope was introduced as a result of one or more back-edges and forms a loop. | ||
/// The entry point node of the scope is the loop header, and all incoming edges originating from within the scope | ||
/// define all back-edges. | ||
/// </summary> | ||
Loop, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters