Transform() public méthode

public Transform ( Reko.Core.Statement stm, CallInstruction call ) : void
stm Reko.Core.Statement
call CallInstruction
Résultat void
Exemple #1
0
        private void RewriteCall(Statement stm, CallInstruction call)
        {
            var e  = expander.Expand(call.Callee);
            var pt = e.Accept(asc) as Pointer;

            if (pt == null)
            {
                return;
            }
            var ft = pt.Pointee as FunctionType;

            if (ft == null)
            {
                return;
            }
            var returnId = ft.ReturnValue.DataType is VoidType ?
                           null : ft.ReturnValue;
            var sigCallee = new ProcedureSignature(returnId, ft.Parameters);
            var ab        = new ApplicationBuilder(
                program.Architecture, proc.Frame, call.CallSite,
                call.Callee, sigCallee, true);

            stm.Instruction = ab.CreateInstruction();
            ssaIdTransformer.Transform(stm, call);
        }
Exemple #2
0
        private void RewriteCall(Statement stm, CallInstruction call)
        {
            var e  = expander.Expand(call.Callee);
            var pt = e.Accept(asc).ResolveAs <Pointer>();

            if (pt == null)
            {
                return;
            }
            var ft = pt.Pointee as FunctionType;

            if (ft == null)
            {
                return;
            }
            ssam.AdjustRegisterAfterCall(
                stm,
                call,
                ssa.Procedure.Architecture.StackRegister,
                ft.StackDelta - call.CallSite.SizeOfReturnAddressOnStack);
            var ab = new ApplicationBuilder(
                ssa.Procedure.Architecture, proc.Frame, call.CallSite,
                call.Callee, ft, false);

            stm.Instruction = ab.CreateInstruction();
            ssaIdTransformer.Transform(stm, call);
            DefineUninitializedIdentifiers(stm, call);
            changed = true;
        }
Exemple #3
0
        public Instruction VisitCallInstruction(CallInstruction ci)
        {
            var oldCallee = ci.Callee;

            ci.Callee = ci.Callee.Accept(eval);
            if (ci.Callee is ProcedureConstant pc)
            {
                if (pc.Procedure.Signature.ParametersValid)
                {
                    var ab = new ApplicationBuilder(
                        arch, ssa.Procedure.Frame, ci.CallSite,
                        ci.Callee, pc.Procedure.Signature, false);
                    evalCtx.Statement.Instruction = ab.CreateInstruction();
                    ssaIdTransformer.Transform(evalCtx.Statement, ci);
                    return(evalCtx.Statement.Instruction);
                }
                if (oldCallee != pc && pc.Procedure is Procedure procCallee)
                {
                    // This was an indirect call, but is now a direct call.
                    // Make sure the call graph knows about the link between
                    // this statement and the callee.
                    callGraph.AddEdge(stmCur, procCallee);
                }
            }
            return(ci);
        }
        public void RewriteCall(Statement stm, CallInstruction call, FunctionType ft)
        {
            ssam.AdjustRegisterAfterCall(
                stm,
                call,
                ssa.Procedure.Architecture.StackRegister,
                ft.StackDelta - call.CallSite.SizeOfReturnAddressOnStack);
            var ab = new ApplicationBuilder(
                ssa.Procedure.Architecture, proc.Frame, call.CallSite,
                call.Callee, ft, false);

            stm.Instruction = ab.CreateInstruction();
            ssaIdTransformer.Transform(stm, call);
            DefineUninitializedIdentifiers(stm, call);
        }
Exemple #5
0
 public Instruction VisitCallInstruction(CallInstruction ci)
 {
     ci.Callee = ci.Callee.Accept(eval);
     if (ci.Callee is ProcedureConstant pc &&
         pc.Procedure.Signature.ParametersValid)
     {
         var ab = new ApplicationBuilder(
             arch, ssa.Procedure.Frame, ci.CallSite,
             ci.Callee, pc.Procedure.Signature, false);
         evalCtx.Statement.Instruction = ab.CreateInstruction();
         ssaIdTransformer.Transform(evalCtx.Statement, ci);
         return(evalCtx.Statement.Instruction);
     }
     return(ci);
 }
Exemple #6
0
        private void RewriteCall(
            Statement stm,
            CallInstruction ci,
            FunctionType sig,
            ProcedureCharacteristics chr)
        {
            ssam.AdjustRegisterAfterCall(
                stm,
                ci,
                this.arch.StackRegister,
                sig.StackDelta - ci.CallSite.SizeOfReturnAddressOnStack);
            var ab = new ApplicationBuilder(
                arch, ssa.Procedure.Frame, ci.CallSite,
                ci.Callee, sig, false);

            stm.Instruction = ab.CreateInstruction();
            ssaIdTransformer.Transform(stm, ci);
        }
Exemple #7
0
        public void RewriteCall(Statement stm, CallInstruction call, FunctionType ft)
        {
            ssam.AdjustRegisterAfterCall(
                stm,
                call,
                ssa.Procedure.Architecture.StackRegister,
                ft.StackDelta - call.CallSite.SizeOfReturnAddressOnStack);
            ssam.AdjustRegisterAfterCall(
                stm,
                call,
                program.Architecture.FpuStackRegister,
                -ft.FpuStackDelta);
            var ab = program.Architecture.CreateFrameApplicationBuilder(
                proc.Frame, call.CallSite, call.Callee);

            ssa.RemoveUses(stm);
            stm.Instruction = ab.CreateInstruction(ft, null);
            ssaIdTransformer.Transform(stm, call);
            ssam.DefineUninitializedIdentifiers(stm, call);
        }
        private void RewriteCall(Statement stm, CallInstruction call)
        {
            var e  = expander.Expand(call.Callee);
            var pt = e.Accept(asc).ResolveAs <Pointer>();

            if (pt == null)
            {
                return;
            }
            var ft = pt.Pointee as FunctionType;

            if (ft == null)
            {
                return;
            }
            AdjustStackPointerAfterCall(stm, call, ft.StackDelta);
            var ab = new ApplicationBuilder(
                program.Architecture, proc.Frame, call.CallSite,
                call.Callee, ft, false);

            stm.Instruction = ab.CreateInstruction();
            ssaIdTransformer.Transform(stm, call);
            changed = true;
        }