/// <summary> /// In case of a local variable or parameter, gets its name. /// </summary> string AsVariableName(BoundReferenceExpression r) { var vr = r as BoundVariableRef; if (vr != null && (vr.Variable is BoundLocal || vr.Variable is BoundParameter)) { return vr.Variable.Name; } return null; }
/// <summary> /// In case of a local variable or parameter, sets associated flag determining its value is less than Int64.Max. /// </summary> void LTInt64Max(BoundReferenceExpression r, bool lt) { var varname = AsVariableName(r); if (varname != null) State.LTInt64Max(varname, lt); }
/// <summary> /// Loads temporary local variable as an argument to <paramref name="targetp"/>. /// </summary> /// <param name="cg"></param> /// <param name="targetp">Target parameter.</param> /// <param name="expr">Value to be passed as its argument.</param> /// <returns><see cref="WriteBackInfo"/> which has to be finalized with <see cref="WriteBackAndFree(CodeGenerator)"/> once the routine call ends.</returns> public static WriteBackInfo CreateAndLoad(CodeGenerator cg, ParameterSymbol targetp, BoundReferenceExpression expr) { var writeback = new WriteBackInfo() { TmpLocal = cg.GetTemporaryLocal(targetp.Type), Target = expr, }; // writeback.EmitLoadArgument(cg, targetp); // return writeback; }
/// <summary> /// Determines if given expression represents a variable which value is less than <c>Int64.Max</c> in current state. /// </summary> bool IsLTInt64Max(BoundReferenceExpression r) { var varname = AsVariableName(r); return varname != null && State.IsLTInt64Max(varname); }
public void EmitUnset(BoundReferenceExpression expr) { Debug.Assert(expr != null); if (!expr.Access.IsUnset) throw new ArgumentException(); var place = expr.BindPlace(this); Debug.Assert(place != null); place.EmitStorePrepare(this); place.EmitStore(this, null); }