mirror of https://github.com/icsharpcode/ILSpy.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.1 KiB
89 lines
2.1 KiB
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Text; |
|
using System.Threading.Tasks; |
|
|
|
namespace ICSharpCode.Decompiler.IL |
|
{ |
|
/// <summary> |
|
/// A simple instruction that does not have any arguments. |
|
/// </summary> |
|
abstract class SimpleInstruction(OpCode opCode) : ILInstruction(opCode) |
|
{ |
|
public override bool IsPeeking { get { return false; } } |
|
|
|
public override void TransformChildren(Func<ILInstruction, ILInstruction> transformFunc) |
|
{ |
|
} |
|
} |
|
|
|
class Nop() : SimpleInstruction(OpCode.Nop) |
|
{ |
|
public override bool NoResult { get { return true; } } |
|
} |
|
|
|
class Pop() : SimpleInstruction(OpCode.Pop) |
|
{ |
|
} |
|
|
|
class Peek() : SimpleInstruction(OpCode.Peek) |
|
{ |
|
public override bool IsPeeking { get { return true; } } |
|
} |
|
|
|
class Ckfinite() : SimpleInstruction(OpCode.Ckfinite) |
|
{ |
|
public override bool IsPeeking { get { return true; } } |
|
public override bool NoResult { get { return true; } } |
|
} |
|
|
|
class Arglist() : SimpleInstruction(OpCode.Arglist) |
|
{ |
|
} |
|
|
|
class DebugBreak() : SimpleInstruction(OpCode.DebugBreak) |
|
{ |
|
public override bool NoResult { get { return true; } } |
|
} |
|
|
|
class ConstantString(public readonly string Value) : SimpleInstruction(OpCode.LdStr) |
|
{ |
|
public override void WriteTo(ITextOutput output) |
|
{ |
|
output.Write("ldstr "); |
|
Disassembler.DisassemblerHelpers.WriteOperand(output, Value); |
|
} |
|
} |
|
|
|
class ConstantI4(public readonly int Value) : SimpleInstruction(OpCode.LdcI4) |
|
{ |
|
public override void WriteTo(ITextOutput output) |
|
{ |
|
output.Write("ldc.i4 "); |
|
Disassembler.DisassemblerHelpers.WriteOperand(output, Value); |
|
} |
|
} |
|
|
|
class ConstantI8(public readonly long Value) : SimpleInstruction(OpCode.LdcI8) |
|
{ |
|
public override void WriteTo(ITextOutput output) |
|
{ |
|
output.Write("ldc.i8 "); |
|
Disassembler.DisassemblerHelpers.WriteOperand(output, Value); |
|
} |
|
} |
|
|
|
class ConstantFloat(public readonly double Value) : SimpleInstruction(OpCode.LdcF) |
|
{ |
|
public override void WriteTo(ITextOutput output) |
|
{ |
|
output.Write("ldc.f "); |
|
Disassembler.DisassemblerHelpers.WriteOperand(output, Value); |
|
} |
|
} |
|
|
|
class ConstantNull() : SimpleInstruction(OpCode.LdNull) |
|
{ |
|
} |
|
}
|
|
|