Table of Contents

Class BinaryNumericInstruction

Namespace
ICSharpCode.Decompiler.IL
Assembly
ICSharpCode.Decompiler.dll

Common instruction for add, sub, mul, div, rem, bit.and, bit.or, bit.xor, shl and shr.

public sealed class BinaryNumericInstruction : BinaryInstruction, ILiftableInstruction
Inheritance
BinaryNumericInstruction
Implements
Inherited Members

Constructors

BinaryNumericInstruction(BinaryNumericOperator, ILInstruction, ILInstruction, StackType, StackType, bool, Sign, bool)

public BinaryNumericInstruction(BinaryNumericOperator op, ILInstruction left, ILInstruction right, StackType leftInputType, StackType rightInputType, bool checkForOverflow, Sign sign, bool isLifted = false)

Parameters

op BinaryNumericOperator
left ILInstruction
right ILInstruction
leftInputType StackType
rightInputType StackType
checkForOverflow bool
sign Sign
isLifted bool

BinaryNumericInstruction(BinaryNumericOperator, ILInstruction, ILInstruction, bool, Sign)

public BinaryNumericInstruction(BinaryNumericOperator op, ILInstruction left, ILInstruction right, bool checkForOverflow, Sign sign)

Parameters

op BinaryNumericOperator
left ILInstruction
right ILInstruction
checkForOverflow bool
sign Sign

Fields

CheckForOverflow

Gets whether the instruction checks for overflow.

public readonly bool CheckForOverflow

Field Value

bool

LeftInputType

public readonly StackType LeftInputType

Field Value

StackType

Operator

The operator used by this binary operator instruction.

public readonly BinaryNumericOperator Operator

Field Value

BinaryNumericOperator

RightInputType

public readonly StackType RightInputType

Field Value

StackType

Sign

For integer operations that depend on the sign, specifies whether the operation is signed or unsigned. For instructions that produce the same result for either sign, returns Sign.None.

public readonly Sign Sign

Field Value

Sign

Properties

DirectFlags

Gets the flags for this instruction only, without considering the child instructions.

public override InstructionFlags DirectFlags { get; }

Property Value

InstructionFlags

IsLifted

Gets whether this is a lifted nullable operation.

public bool IsLifted { get; }

Property Value

bool

Remarks

A lifted binary operation allows its arguments to be a value of type Nullable{T}, where T.GetStackType() == [Left|Right]InputType. If both input values are non-null:

  • they are sign/zero-extended to the corresponding InputType (based on T's sign)
  • the underlying numeric operator is applied
  • the result is wrapped in a Nullable{UnderlyingResultType}. If either input is null, the instruction evaluates to default(UnderlyingResultType?). (this result type is underspecified, since there may be multiple C# types for the stack type)

ResultType

Gets the stack type of the value produced by this instruction.

public override sealed StackType ResultType { get; }

Property Value

StackType

UnderlyingResultType

If the instruction is lifted and returns a nullable result, gets the underlying result type.

Note that not all lifted instructions return a nullable result: C# comparisons always return a bool!

public StackType UnderlyingResultType { get; }

Property Value

StackType

Methods

AcceptVisitor(ILVisitor)

Calls the Visit*-method on the visitor corresponding to the concrete type of this instruction.

public override void AcceptVisitor(ILVisitor visitor)

Parameters

visitor ILVisitor

AcceptVisitor<T>(ILVisitor<T>)

Calls the Visit*-method on the visitor corresponding to the concrete type of this instruction.

public override T AcceptVisitor<T>(ILVisitor<T> visitor)

Parameters

visitor ILVisitor<T>

Returns

T

Type Parameters

T

AcceptVisitor<C, T>(ILVisitor<C, T>, C)

Calls the Visit*-method on the visitor corresponding to the concrete type of this instruction.

public override T AcceptVisitor<C, T>(ILVisitor<C, T> visitor, C context)

Parameters

visitor ILVisitor<C, T>
context C

Returns

T

Type Parameters

C
T

ComputeFlags()

protected override InstructionFlags ComputeFlags()

Returns

InstructionFlags

PerformMatch(ILInstruction?, ref Match)

protected override bool PerformMatch(ILInstruction? other, ref Match match)

Parameters

other ILInstruction
match Match

Returns

bool

WriteTo(ITextOutput, ILAstWritingOptions)

Writes the ILAst to the text output.

public override void WriteTo(ITextOutput output, ILAstWritingOptions options)

Parameters

output ITextOutput
options ILAstWritingOptions