private AnalysisNet.IInstruction ProcessConversion(Cecil.Cil.Instruction op) { AnalysisNetBytecode.ConvertOperation operation = OperationHelper.ToConvertOperation(op.OpCode.Code); bool overflow = OperationHelper.PerformsOverflowCheck(op.OpCode.Code); bool unsigned = OperationHelper.OperandsAreUnsigned(op.OpCode.Code); Cecil.TypeReference cciType = op.Operand as Cecil.TypeReference; AnalysisNet.Types.IType ourType = OperationHelper.GetOperationType(op.OpCode.Code); if (operation == AnalysisNetBytecode.ConvertOperation.Box) { ourType = typeExtractor.ExtractType(cciType); } else if (operation == AnalysisNetBytecode.ConvertOperation.Conv) { ourType = OperationHelper.GetOperationType(op.OpCode.Code); } else if (operation == AnalysisNetBytecode.ConvertOperation.Cast) { ourType = typeExtractor.ExtractType(op.Operand as Cecil.TypeReference); } AnalysisNetBytecode.ConvertInstruction instruction = new AnalysisNetBytecode.ConvertInstruction((uint)op.Offset, operation, ourType) { OverflowCheck = overflow, UnsignedOperands = unsigned }; return(instruction); }
private AnalysisNet.IInstruction ProcessBinaryConditionalBranch(Cecil.Cil.Instruction op) { AnalysisNetBytecode.BranchOperation operation = OperationHelper.ToBranchOperation(op.OpCode.Code); bool unsigned = OperationHelper.OperandsAreUnsigned(op.OpCode.Code); uint target = (uint)((Cecil.Cil.Instruction)op.Operand).Offset; AnalysisNetBytecode.BranchInstruction instruction = new AnalysisNetBytecode.BranchInstruction((uint)op.Offset, operation, target) { UnsignedOperands = unsigned }; return(instruction); }
private AnalysisNet.IInstruction ProcessBasic(Cecil.Cil.Instruction op) { AnalysisNetBytecode.BasicOperation operation = OperationHelper.ToBasicOperation(op.OpCode.Code); bool overflow = OperationHelper.PerformsOverflowCheck(op.OpCode.Code); bool unsigned = OperationHelper.OperandsAreUnsigned(op.OpCode.Code); AnalysisNetBytecode.BasicInstruction instruction = new AnalysisNetBytecode.BasicInstruction((uint)op.Offset, operation) { OverflowCheck = overflow, UnsignedOperands = unsigned }; return(instruction); }