public static InstructionChain FromInstructions(IInstruction instruction) { var chain = new InstructionChain(); while (instruction != null) { chain.AssignAndIncrement(instruction); instruction = instruction.Next; } chain.Reset(); return chain; }
public virtual bool Compile(IMethodContext context, InstructionChain chain) { var ins = chain.Instruction; Simplifier simplifier; if (Simplifiers.TryGetValue(ins.Code, out simplifier)) simplifier(context, ins); else { // default operation } //remove jumping branches that go to the next instruction if (ins.Code == InstructionCode.CilBr && ins.Operand0 == ins.Next) { chain.Remove(); return false; } return true; }