示例#1
0
 protected virtual IReference DeclareHelper(string name, IReference variable, Expression optionalInitialValue)
 {
     FuncBuilder.Instance.BindLocalVariableToRepresentation(variable, name);
       if(!ReferenceEquals(optionalInitialValue, null)) {
     Assignment.AssignAny(variable, optionalInitialValue);
       }
       return variable;
 }
示例#2
0
 public static void AssignAny(IReference lhs, Expression rhs)
 {
     var f=FuncBuilder.Instance;
       using(f.OpenScope("assign")) {
     if(f.CanProveIsNeverRead(lhs)) {
       rhs.EvaluateForItsSideEffects();
     } else {
       SpecialAssignAny(lhs, rhs);
     }
       }
 }
示例#3
0
 public static void SpecialAssignAny(IReference lhs, Expression rhs)
 {
     var f=FuncBuilder.Instance;
       var lhsWasLivePriorToThisAssignment=f.IsLive(lhs);
       var rhsReadable=rhs.EvaluateTo(lhs);
       if(!ReferenceEquals(lhs, rhsReadable)) {
     var lhsReg=lhs.ProposeRegisterOrScratch0();
     var rhsReg=rhsReadable.ToRegister(lhsReg);
     lhs.FromRegister(rhsReg);
       }
       //Don't decide that a variable is live just because it was referenced (or it was used as temporary storage)
       //in its very-own assignment.
       if(!lhsWasLivePriorToThisAssignment) {
     f.UndoNoteRead(new[] {lhs});
       }
 }
 public IntPointerCast(Expression inner)
 {
     this.inner=inner;
 }
 public ArrayElement(string name, ExpressionType expressionType, Expression array, Expression index)
     : base(name, expressionType)
 {
     this.array=array;
       this.index=index;
 }
示例#6
0
 public IntCast(Expression inner)
 {
     this.inner=inner;
 }
 public FuncPointerCast(Expression inner)
 {
     this.inner=inner;
 }
示例#8
0
 public FuncPointerCast(Expression inner)
 {
     this.inner = inner;
 }
 public IReference ForLhs(Expression rhs)
 {
     return rhs.HasConflictWith(storage) ? temp : storage;
 }