예제 #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;
 }
예제 #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);
        }
예제 #3
0
 public bool Match(RtlInstruction instr)
 {
     matcher.Clear();
     return(instr.Accept(this));
 }
예제 #4
0
 public RtlInstructionMatcher(RtlInstruction pattern)
 {
     this.pattern = pattern;
     this.matcher = new ExpressionMatcher(null !);
 }
예제 #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;
 }
예제 #6
0
 public RtlEmitter If(Expression test, RtlInstruction rtl)
 {
     instrs.Add(new RtlIf(test, rtl));
     return(this);
 }
예제 #7
0
 public void Emit(RtlInstruction instr)
 {
     instrs.Add(instr);
 }