Exemplo n.º 1
0
        public void Test_NormalInstructions()
        {
            var lst = new[] {
                InstructionFactory.Add(reg1, reg2),
                InstructionFactory.Add(reg1, constant),
                InstructionFactory.Sub(reg1, reg2),
                InstructionFactory.Sub(reg1, constant),
                InstructionFactory.Xor(reg1, reg2),
                InstructionFactory.Xor(reg1, constant),
                InstructionFactory.And(reg1, reg2),
                InstructionFactory.And(reg1, constant),
                InstructionFactory.Or(reg1, reg2),
                InstructionFactory.Or(reg1, constant),
                InstructionFactory.Test(reg1, reg2),
                InstructionFactory.Test(reg1, constant),

                InstructionFactory.Shl(reg1, constant),
                InstructionFactory.Shr(reg1, constant),

                InstructionFactory.Cmp(reg1, reg2),
                InstructionFactory.Cmp(reg1, constant),
                InstructionFactory.Cmp(constant, reg2),

                InstructionFactory.Mul(reg1),
                InstructionFactory.Div(reg1),
                InstructionFactory.Inc(reg1),
                InstructionFactory.Dec(reg1),
                InstructionFactory.Neg(reg1),
                InstructionFactory.Not(reg1),

                InstructionFactory.Call(fun),
                InstructionFactory.Call(reg1),
                InstructionFactory.Ret(),

                InstructionFactory.Pop(reg1),
                InstructionFactory.Push(reg1),

                InstructionFactory.Jmp(reg1),

                InstructionFactory.Cmove(reg1, reg2),
                InstructionFactory.Cmovg(reg1, reg2),
                InstructionFactory.Cmovge(reg1, reg2),
                InstructionFactory.Cmovl(reg1, reg2),
                InstructionFactory.Cmovle(reg1, reg2),
                InstructionFactory.Cmovne(reg1, reg2),

                InstructionFactory.Sete(reg1),
                InstructionFactory.Setg(reg1),
                InstructionFactory.Setge(reg1),
                InstructionFactory.Setl(reg1),
                InstructionFactory.Setle(reg1),
                InstructionFactory.Setne(reg1)
            };

            foreach (var insn in lst)
            {
                Assert.IsFalse(insn.IsCopyInstruction);
                Assert.IsFalse(insn.IsJumpInstruction);
                Assert.IsFalse(insn.IsLabel);
                Assert.IsNull(insn.Label);
            }
        }