Cosmos/source/Indy.IL2CPU.IL.X86/Ldarg.cs

31 lines
No EOL
808 B
C#

using System;
using System.IO;
using Mono.Cecil;
using Mono.Cecil.Cil;
using CPU = Indy.IL2CPU.Assembler.X86;
namespace Indy.IL2CPU.IL.X86 {
[OpCode(Code.Ldarg)]
public class Ldarg: Op {
private string mAddress;
protected void SetArgIndex(int aIndex, MethodInformation aMethodInfo) {
mAddress = aMethodInfo.Arguments[aIndex].VirtualAddress;
}
public Ldarg(Mono.Cecil.Cil.Instruction aInstruction, MethodInformation aMethodInfo)
: base(aInstruction, aMethodInfo) {
int xArgIndex;
if (Int32.TryParse((aInstruction.Operand ?? "").ToString(), out xArgIndex)) {
SetArgIndex(xArgIndex, aMethodInfo);
}
}
public string Address {
get {
return mAddress;
}
}
public sealed override void Assemble() {
Ldarg(Assembler, mAddress);
}
}
}