Class Branch
A branch to a particular block that passes a list of values as arguments.
Inheritance
Implements
Inherited Members
Namespace: Flame.Compiler
Assembly: Flame.Compiler.dll
Syntax
public sealed class Branch : IEquatable<Branch>
  Constructors
| Improve this Doc View SourceBranch(BasicBlockTag)
Creates a branch that targets a particular block and passes no arguments.
Declaration
public Branch(BasicBlockTag target)
  Parameters
| Type | Name | Description | 
|---|---|---|
| BasicBlockTag | target | The target block.  | 
      
Branch(BasicBlockTag, IReadOnlyList<BranchArgument>)
Creates a branch that targets a particular block and passes a list of arguments.
Declaration
public Branch(BasicBlockTag target, IReadOnlyList<BranchArgument> arguments)
  Parameters
| Type | Name | Description | 
|---|---|---|
| BasicBlockTag | target | The target block.  | 
      
| System.Collections.Generic.IReadOnlyList<BranchArgument> | arguments | A list of arguments to pass to the target block.  | 
      
Branch(BasicBlockTag, IReadOnlyList<ValueTag>)
Creates a branch that targets a particular block and passes a list of arguments.
Declaration
public Branch(BasicBlockTag target, IReadOnlyList<ValueTag> arguments)
  Parameters
| Type | Name | Description | 
|---|---|---|
| BasicBlockTag | target | The target block.  | 
      
| System.Collections.Generic.IReadOnlyList<ValueTag> | arguments | A list of arguments to pass to the target block.  | 
      
Properties
| Improve this Doc View SourceArguments
Gets the arguments passed to the target block when this branch is taken.
Declaration
public IReadOnlyList<BranchArgument> Arguments { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Collections.Generic.IReadOnlyList<BranchArgument> | A list of arguments.  | 
      
Target
Gets the branch's target block.
Declaration
public BasicBlockTag Target { get; }
  Property Value
| Type | Description | 
|---|---|
| BasicBlockTag | The target block.  | 
      
Methods
| Improve this Doc View SourceAddArgument(BranchArgument)
Creates a branch that is the result of appending an argument at the end of this branch's argument list.
Declaration
public Branch AddArgument(BranchArgument argument)
  Parameters
| Type | Name | Description | 
|---|---|---|
| BranchArgument | argument | The argument to add.  | 
      
Returns
| Type | Description | 
|---|---|
| Branch | A new branch.  | 
      
AddArgument(ValueTag)
Creates a branch that is the result of appending an argument at the end of this branch's argument list.
Declaration
public Branch AddArgument(ValueTag argument)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTag | argument | The argument to add.  | 
      
Returns
| Type | Description | 
|---|---|
| Branch | A new branch.  | 
      
Equals(Branch)
Tests if this branch equals another branch.
Declaration
public bool Equals(Branch other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Branch | other | The branch to compare with.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
  | 
      
Equals(Object)
Declaration
public override bool Equals(object obj)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Object | obj | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
  Returns
| Type | Description | 
|---|---|
| System.Int32 | 
Overrides
MapArguments(Func<BranchArgument, BranchArgument>)
Creates a new branch by applying a mapping to every argument in this branch's argument list.
Declaration
public Branch MapArguments(Func<BranchArgument, BranchArgument> mapping)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Func<BranchArgument, BranchArgument> | mapping | The mapping to apply to every argument in this branch's argument list.  | 
      
Returns
| Type | Description | 
|---|---|
| Branch | A new branch.  | 
      
MapArguments(Func<ValueTag, ValueTag>)
Creates a new branch by applying a mapping to every value in this branch's argument list.
Declaration
public Branch MapArguments(Func<ValueTag, ValueTag> mapping)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Func<ValueTag, ValueTag> | mapping | The mapping to apply to every value in this branch's argument list.  | 
      
Returns
| Type | Description | 
|---|---|
| Branch | A new branch.  | 
      
WithArguments(IReadOnlyList<BranchArgument>)
Replaces this branch's arguments with a particular list of arguments.
Declaration
public Branch WithArguments(IReadOnlyList<BranchArgument> arguments)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IReadOnlyList<BranchArgument> | arguments | The new arguments.  | 
      
Returns
| Type | Description | 
|---|---|
| Branch | A new branch.  | 
      
WithTarget(BasicBlockTag)
Replaces this branch's target with another block.
Declaration
public Branch WithTarget(BasicBlockTag target)
  Parameters
| Type | Name | Description | 
|---|---|---|
| BasicBlockTag | target | The new target block.  | 
      
Returns
| Type | Description | 
|---|---|
| Branch | A new branch.  | 
      
ZipArgumentsWithParameters(FlowGraph)
Zips this branch's arguments with their corresponding parameters.
Declaration
public IEnumerable<KeyValuePair<ValueTag, BranchArgument>> ZipArgumentsWithParameters(FlowGraph graph)
  Parameters
| Type | Name | Description | 
|---|---|---|
| FlowGraph | graph | The graph that defines the branch.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<ValueTag, BranchArgument>> | A sequence of key-value pairs where the keys are basic block parameters and the values are branch arguments.  | 
      
ZipArgumentsWithParameters(FlowGraphBuilder)
Zips this branch's arguments with their corresponding parameters.
Declaration
public IEnumerable<KeyValuePair<ValueTag, BranchArgument>> ZipArgumentsWithParameters(FlowGraphBuilder graph)
  Parameters
| Type | Name | Description | 
|---|---|---|
| FlowGraphBuilder | graph | The graph that defines the branch.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<ValueTag, BranchArgument>> | A sequence of key-value pairs where the keys are basic block parameters and the values are branch arguments.  | 
      
Operators
| Improve this Doc View SourceEquality(Branch, Branch)
Tests if two branches are equal.
Declaration
public static bool operator ==(Branch left, Branch right)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Branch | left | The first branch to compare.  | 
      
| Branch | right | The second branch to compare.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
  | 
      
Inequality(Branch, Branch)
Tests if two branches are not equal.
Declaration
public static bool operator !=(Branch left, Branch right)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Branch | left | The first branch to compare.  | 
      
| Branch | right | The second branch to compare.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
  |