public override void SubstituteUse(IRVariable variable, IRExpression expression) { if (ReferenceEquals(Address, variable)) { Address = expression.CloneComplete(); } else { Address.Substitute(variable, expression); } Uses.Clear(); Uses.UnionWith(Address.GetAllVariables()); if (ReferenceEquals(Operand, variable)) { Operand = expression.CloneComplete(); } else { Operand.Substitute(variable, expression); } Uses.UnionWith(Operand.GetAllVariables()); }
public IRReturn(IRBasicBlock parentBlock, IRExpression returnValue) : base(parentBlock) { ReturnValue = returnValue; if (!(ReturnValue is null)) { Uses.UnionWith(ReturnValue.GetAllVariables()); } }
public IRAssignment(IRBasicBlock parentBlock, IRExpression destination, IRExpression source) : base(parentBlock) { Destination = destination; Source = source; if (Destination is IRVariable v) { Defs.Add(v); } Uses.UnionWith(Source.GetAllVariables()); }
public IRStore(IRBasicBlock parentBlock, IRType type, IRExpression address, IRExpression operand) : base(parentBlock) { if (type == IRPrimitive.Void || type == IRPrimitive.Bool) { throw new IRTypeException(); } Type = type; Address = address; Operand = operand; Uses.UnionWith(Address.GetAllVariables()); Uses.UnionWith(Operand.GetAllVariables()); }
public override void SubstituteUse(IRVariable variable, IRExpression expression) { if (ReferenceEquals(ReturnValue, variable)) { ReturnValue = expression.CloneComplete(); } else { ReturnValue.Substitute(variable, expression); } Uses.Clear(); Uses.UnionWith(ReturnValue.GetAllVariables()); }