Cosmos/source/Cosmos.IL2CPU/ILOpCodes/OpInt.cs
2015-01-02 13:56:52 +01:00

52 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Cosmos.IL2CPU.ILOpCodes {
public class OpInt : ILOpCode {
public readonly Int32 Value;
public OpInt(Code aOpCode, int aPos, int aNextPos, Int32 aValue, ExceptionHandlingClause aCurrentExceptionHandler)
: base(aOpCode, aPos, aNextPos, aCurrentExceptionHandler) {
Value = aValue;
}
public override int GetNumberOfStackPops(MethodBase aMethod)
{
switch (OpCode)
{
case Code.Ldc_I4:
return 0;
default:
throw new NotImplementedException("OpCode '" + OpCode + "' not implemented!");
}
}
public override int GetNumberOfStackPushes(MethodBase aMethod)
{
switch (OpCode)
{
case Code.Ldc_I4:
return 1;
default:
throw new NotImplementedException("OpCode '" + OpCode + "' not implemented!");
}
}
protected override void DoInitStackAnalysis(MethodBase aMethod)
{
base.DoInitStackAnalysis(aMethod);
switch (OpCode)
{
case Code.Ldc_I4:
StackPushTypes[0] = typeof (int);
return;
default:
break;
}
}
}
}