示例#1
0
        /// <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);
        }
示例#2
0
        /// <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> >();
 }
示例#4
0
 /// <summary>
 /// Creates a new phi statement that matches on any target and source variables.
 /// </summary>
 public PhiStatementPattern()
 {
     Target     = Pattern.Any <IVariable>();
     AnySources = true;
 }
示例#5
0
 /// <summary>
 /// Creates a new variable expression pattern that matches any variable.
 /// </summary>
 public VariableExpressionPattern()
 {
     Variable = Pattern.Any <IVariable>();
 }
示例#6
0
 /// <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> >();
 }
示例#7
0
 /// <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>());
示例#8
0
 /// <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> >()));
 }