public void StackReturn(DataType dt) { var stg = new StackArgumentStorage(stackOffset, dt); stackOffset += Align(dt.Size, stackAlignment); this.Return = stg; }
public void StackParam(DataType dt) { var stg = new StackArgumentStorage(stackOffset, dt); stackOffset += Align(dt.Size, stackAlignment); Parameters.Add(stg); }
public override bool Equals(object obj) { StackArgumentStorage sas = obj as StackArgumentStorage; if (sas == null) { return(false); } return(StackOffset == sas.StackOffset); }
public Identifier FindStackArgument(int offset, int size) { foreach (Identifier id in identifiers) { StackArgumentStorage s = id.Storage as StackArgumentStorage; if (s != null && s.StackOffset == offset && id.DataType.Size == size) { return(id); } } return(null); }
public Expression VisitStackArgumentStorage(StackArgumentStorage stack) { if (ensureVariables) { return(frame.EnsureStackVariable( stack.StackOffset - (site.StackDepthOnEntry + sigCallee.ReturnAddressOnStack), stack.DataType)); } else { return(arch.CreateStackAccess(frame, stack.StackOffset, stack.DataType)); } }
public override int OffsetOf(Storage stgSub) { StackArgumentStorage arg = stgSub as StackArgumentStorage; if (arg == null) { return(-1); } if (arg.StackOffset >= StackOffset && arg.StackOffset + arg.DataType.Size <= StackOffset + DataType.Size) { return((arg.StackOffset - StackOffset) * DataType.BitsPerByte); } return(-1); }
/// <summary> /// Returns the number of bytes the stack arguments consume on the stack. /// </summary> /// <returns></returns> public int GetStackArgumentSpace() { int cbMax = 0; foreach (Identifier id in identifiers) { StackArgumentStorage sa = id.Storage as StackArgumentStorage; if (sa == null) { continue; } cbMax = Math.Max(cbMax, sa.StackOffset + sa.DataType.Size); } return(cbMax); }
public Expression VisitStackArgumentStorage(StackArgumentStorage stack) { if (ensureVariables) { return(binder.EnsureStackVariable( stack.StackOffset - site.StackDepthOnEntry, stack.DataType)); } else { return(arch.CreateStackAccess( binder, stack.StackOffset - site.SizeOfReturnAddressOnStack, stack.DataType)); } }
/// <summary> /// The offset of a variable from the return address, as seen from a caller. /// </summary> /// <param name="var"></param> /// <returns></returns> public int ExternalOffset(Identifier id) { if (id == null) { return(0); } StackArgumentStorage stVar = id.Storage as StackArgumentStorage; if (stVar != null) { return(stVar.StackOffset); } FpuStackStorage fstVar = id.Storage as FpuStackStorage; if (fstVar != null) { return(fstVar.FpuStackOffset); } throw new ArgumentOutOfRangeException("var", "Variable must be an argument."); }
Identifier StorageVisitor <Identifier> .VisitStackArgumentStorage(StackArgumentStorage stack) { throw new NotImplementedException(); }