/// <summary> /// Indicates the pattern should match on instances with the provided number of variables on the left hand side. /// </summary> /// <param name="variablesCount">The number of variables the assignment statement should have.</param> /// <returns>The current pattern.</returns> public AssignmentStatementPattern <TInstruction> WithVariables(int variablesCount) { Variables.Clear(); for (int i = 0; i < variablesCount; i++) { Variables.Add(Pattern.Any <IVariable>()); } return(this); }
/// <summary> /// Indicates the pattern should match on instances with the provided number of sources. /// </summary> /// <param name="numberOfSources">The number of sources the phi node should have.</param> /// <returns>The current pattern.</returns> public PhiStatementPattern <TInstruction> WithSources(int numberOfSources) { AnySources = false; Sources.Clear(); for (int i = 0; i < numberOfSources; i++) { Sources.Add(Pattern.Any <VariableExpression <TInstruction> >()); } return(this); }
/// <summary> /// Creates a new expression statement pattern matching on any embedded expression. /// </summary> public ExpressionStatementPattern() { Expression = Pattern.Any <Expression <TInstruction> >(); }
/// <summary> /// Creates a new phi statement that matches on any target and source variables. /// </summary> public PhiStatementPattern() { Target = Pattern.Any <IVariable>(); AnySources = true; }
/// <summary> /// Creates a new variable expression pattern that matches any variable. /// </summary> public VariableExpressionPattern() { Variable = Pattern.Any <IVariable>(); }
/// <summary> /// Creates a new assignment statement pattern that matches on any variable and any value expression. /// </summary> public AssignmentStatementPattern() { Variables.Add(Pattern.Any <IVariable>()); Expression = Pattern.Any <Expression <TInstruction> >(); }
/// <summary> /// Creates a new pattern that matches on instances of <see cref="InstructionExpression{TInstruction}"/>. /// </summary> /// <returns>The pattern.</returns> public static InstructionExpressionPattern <TInstruction> Instruction <TInstruction>() => new InstructionExpressionPattern <TInstruction>(Pattern.Any <TInstruction>());
/// <summary> /// Creates a new pattern that matches on instances of <see cref="AssignmentStatement{TInstruction}"/> with /// a single variable on the left hand side of the equals sign. /// </summary> public static AssignmentStatementPattern <TInstruction> Assignment <TInstruction>() { return(new AssignmentStatementPattern <TInstruction>( Pattern.Any <IVariable>(), Pattern.Any <Expression <TInstruction> >())); }