예제 #1
0
        private AnalysisNet.IInstruction ProcessStoreLocal(Cecil.Cil.Instruction op)
        {
            int localIdx = -1;

            Cecil.Cil.VariableDefinition variable = null;
            switch (op.OpCode.Code)
            {
            case Mono.Cecil.Cil.Code.Stloc_S:
            case Mono.Cecil.Cil.Code.Stloc: variable = (Cecil.Cil.VariableDefinition)op.Operand; break;

            case Mono.Cecil.Cil.Code.Stloc_0: localIdx = 0; break;

            case Mono.Cecil.Cil.Code.Stloc_1: localIdx = 1; break;

            case Mono.Cecil.Cil.Code.Stloc_2: localIdx = 2; break;

            case Mono.Cecil.Cil.Code.Stloc_3: localIdx = 3; break;

            default:
                throw new NotImplementedException();
            }

            AnalysisNetTac.Values.IVariable dest;
            if (variable != null)
            {
                dest = locals[variable.Index];
            }
            else
            {
                dest = locals[localIdx];
            }

            AnalysisNetBytecode.StoreInstruction instruction = new AnalysisNetBytecode.StoreInstruction((uint)op.Offset, dest);
            return(instruction);
        }
예제 #2
0
        private AnalysisNet.IInstruction ProcessStoreArgument(Cecil.Cil.Instruction op)
        {
            AnalysisNetTac.Values.IVariable dest = thisParameter;

            if (op.Operand is Cecil.ParameterDefinition parameter)
            {
                dest = parameters[parameter.Index];
            }

            AnalysisNetBytecode.StoreInstruction instruction = new AnalysisNetBytecode.StoreInstruction((uint)op.Offset, dest);
            return(instruction);
        }