コード例 #1
0
        public void Rl_CallToProcedureWithValidSignature()
        {
            Procedure callee = new Procedure(program.Architecture, "callee", null);

            callee.Signature = new FunctionType(
                f.EnsureRegister(Registers.eax),
                new Identifier[] {
                f.EnsureRegister(Registers.ebx),
                f.EnsureRegister(Registers.ecx),
                f.EnsureOutArgument(f.EnsureRegister(Registers.edi), PrimitiveType.Ptr32)
            });

            rl.IdentifierLiveness.Identifiers.Add(Registers.eax);
            rl.IdentifierLiveness.Identifiers.Add(Registers.esi);
            rl.IdentifierLiveness.Identifiers.Add(Registers.edi);
            CallInstruction ci = new CallInstruction(new ProcedureConstant(PrimitiveType.Ptr32, callee), new CallSite(4, 0));

            rl.VisitCallInstruction(ci);
            Assert.AreEqual(" ebx ecx esi", Dump(rl.IdentifierLiveness));
        }
コード例 #2
0
        public void Rl_CallToProcedureWithValidSignature()
        {
            Procedure callee = new Procedure("callee", null);

            callee.Signature = new ProcedureSignature(
                f.EnsureRegister(Registers.eax),
                new Identifier[] {
                f.EnsureRegister(Registers.ebx),
                f.EnsureRegister(Registers.ecx),
                f.EnsureOutArgument(f.EnsureRegister(Registers.edi), PrimitiveType.Pointer32)
            });

            rl.IdentifierLiveness.BitSet[Registers.eax.Number] = true;
            rl.IdentifierLiveness.BitSet[Registers.esi.Number] = true;
            rl.IdentifierLiveness.BitSet[Registers.edi.Number] = true;
            CallInstruction ci = new CallInstruction(new ProcedureConstant(PrimitiveType.Pointer32, callee), new CallSite(4, 0));

            rl.VisitCallInstruction(ci);
            Assert.AreEqual(" ecx ebx esi", Dump(rl.IdentifierLiveness));
        }