public Expression GetValue(MemoryAccess access, SegmentMap segmentMap) { if (access.EffectiveAddress is Constant c) { var pc = importResolver.ResolveToImportedProcedureConstant(this.Statement, c); if (pc != null) { return(pc); } } return(access); }
public override Expression VisitMemoryAccess(MemoryAccess access) { if (this.renameFrameAccess && IsFrameAccess(proc, access.EffectiveAddress)) { ssa.Identifiers[proc.Frame.FramePointer].Uses.Remove(stmCur); ssa.Identifiers[access.MemoryId].Uses.Remove(stmCur); var idFrame = EnsureStackVariable(proc, access.EffectiveAddress, access.DataType); var idNew = NewUse(idFrame, stmCur, true); return(idNew); } var ea = access.EffectiveAddress.Accept(this); BinaryExpression bin; Identifier id; Constant c = null; if (ea.As(out bin) && bin.Left.As(out id) && bin.Right.As(out c) && rename.ContainsKey(id)) { var sid = ssa.Identifiers[rename[id]]; var cOther = sid.DefExpression as Constant; if (cOther != null) { c = bin.Operator.ApplyConstants(cOther, c); } } else { c = ea as Constant; } if (c != null) { access.EffectiveAddress = c; var e = importResolver.ResolveToImportedProcedureConstant(stmCur, c); if (e != null) { return(e); } } access.MemoryId = (MemoryIdentifier)access.MemoryId.Accept(this); access.EffectiveAddress = ea; return(access); }