Example #1
0
 public bool VisitIf(RtlIf rtlIf)
 {
     var pIf = pattern as RtlIf;
     if (pIf == null)
         return false;
     var p = pattern;
     pattern = pIf.Instruction;
     var ret = rtlIf.Instruction.Accept(this);
     pattern = p;
     return ret;
 }
Example #2
0
        public bool VisitIf(RtlIf rtlIf)
        {
            if (!(pattern is RtlIf pIf))
            {
                return(false);
            }
            var p = pattern;

            pattern = pIf.Instruction;
            var ret = rtlIf.Instruction.Accept(this);

            pattern = p;
            return(ret);
        }
Example #3
0
 public bool Match(RtlInstruction instr)
 {
     matcher.Clear();
     return(instr.Accept(this));
 }
Example #4
0
 public RtlInstructionMatcher(RtlInstruction pattern)
 {
     this.pattern = pattern;
     this.matcher = new ExpressionMatcher(null !);
 }
Example #5
0
 /// <summary>
 /// Builds an RTL If instruction, which executes the specified statement
 /// only if the condition is satisfied. The annulled flag is used to model
 /// processor architectures like SPARC, where there is a delay slot after a
 /// branch, and annullment allows the delay slot to not be executed if the
 /// branch is not taken.
 /// </summary>
 /// <param name="condition"></param>
 /// <param name="instr"></param>
 /// <param name="annulled"></param>
 public RtlIf(Expression condition, RtlInstruction instr)
 {
     this.Condition   = condition;
     this.Instruction = instr;
     this.Class       = instr.Class | InstrClass.Conditional;
 }
Example #6
0
 public RtlEmitter If(Expression test, RtlInstruction rtl)
 {
     instrs.Add(new RtlIf(test, rtl));
     return(this);
 }
Example #7
0
 public void Emit(RtlInstruction instr)
 {
     instrs.Add(instr);
 }