/// <summary> /// Applies a mapping to all branch arguments in this flow. /// </summary> /// <param name="mapping"> /// A argument-to-argument mapping to apply. /// </param> /// <returns>Block flow.</returns> public BlockFlow MapArguments( Func <BranchArgument, BranchArgument> mapping) { return(this .WithBranches( Branches.EagerSelect(branch => branch.MapArguments(mapping)))); }
/// <summary> /// Applies a mapping to all basic blocks referenced by /// branches in this block flow. /// </summary> /// <param name="mapping">A block-to-block mapping to apply.</param> /// <returns>Block flow.</returns> public BlockFlow MapBlocks( Func <BasicBlockTag, BasicBlockTag> mapping) { return(this .WithBranches( Branches.EagerSelect(branch => branch.WithTarget(mapping(branch.Target))))); }
/// <summary> /// Applies a mapping to all values referenced by instructions /// and branches in this block flow. /// </summary> /// <param name="mapping">A value-to-value mapping to apply.</param> /// <returns>Block flow.</returns> public BlockFlow MapValues( Func <ValueTag, ValueTag> mapping) { return(this .WithInstructions( Instructions.EagerSelect(insn => insn.MapArguments(mapping))) .WithBranches( Branches.EagerSelect(branch => branch.MapArguments(mapping)))); }
/// <summary> /// Applies a mapping to all branches in this basic block. /// </summary> /// <param name="mapping">The mapping to apply.</param> /// <returns>Block flow.</returns> public BlockFlow MapBranches(Func <Branch, Branch> mapping) { return(WithBranches(Branches.EagerSelect(mapping))); }