mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 12:30:32 +00:00
51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
using System;
|
|
using System.Reflection;
|
|
using System.Reflection.Metadata;
|
|
|
|
|
|
namespace Cosmos.IL2CPU.ILOpCodes {
|
|
public class OpSingle : ILOpCode {
|
|
public readonly Single Value;
|
|
|
|
public OpSingle(Code aOpCode, int aPos, int aNextPos, Single aValue, _ExceptionRegionInfo aCurrentExceptionRegion)
|
|
: base(aOpCode, aPos, aNextPos, aCurrentExceptionRegion) {
|
|
Value = aValue;
|
|
}
|
|
|
|
public override int GetNumberOfStackPops(MethodBase aMethod)
|
|
{
|
|
switch (OpCode)
|
|
{
|
|
case Code.Ldc_R4:
|
|
return 0;
|
|
default:
|
|
throw new NotImplementedException("OpCode '" + OpCode + "' not implemented!");
|
|
}
|
|
}
|
|
|
|
public override int GetNumberOfStackPushes(MethodBase aMethod)
|
|
{
|
|
switch (OpCode)
|
|
{
|
|
case Code.Ldc_R4:
|
|
return 1;
|
|
default:
|
|
throw new NotImplementedException("OpCode '" + OpCode + "' not implemented!");
|
|
}
|
|
}
|
|
|
|
protected override void DoInitStackAnalysis(MethodBase aMethod)
|
|
{
|
|
base.DoInitStackAnalysis(aMethod);
|
|
|
|
switch (OpCode)
|
|
{
|
|
case Code.Ldc_R4:
|
|
StackPushTypes[0] = typeof (Single);
|
|
return;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|