public virtual void Remove(Register reg) { registers.Remove(reg); }
public virtual bool Contains(Register reg) { return registers.Contains(reg); }
protected virtual void InsertTransferInstructionBefore( ValueNode val, Register fromReg, Register toReg, RegisterSet fromSet, RegisterSet toSet) { IList applicableTransferInstr = GetTransferInstructions(fromReg, toReg); ValueNode newVal = new RegisterValueNode(val.Datatype); instructionGraph.AddNode(newVal); if (!val.IsInputValue()) { InstructionNode prodInstr = val.ProducingInstruction; instructionGraph.RemoveEdge(prodInstr, val); instructionGraph.AddEdge(prodInstr, newVal); } Instruction transferInstr = (Instruction) applicableTransferInstr[ GA.Random.Next(applicableTransferInstr.Count)]; InstructionNode transferNode = new InstructionNode(transferInstr); instructionGraph.AddNode(transferNode); instructionGraph.AddEdge(newVal, transferNode); instructionGraph.AddEdge(transferNode, val); instructionGraph.AssignableRegisters[val] = toSet; instructionGraph.AssignableRegisters[newVal] = fromSet; }
public virtual void Add(Register reg) { registers.Add(reg); }
protected virtual IList GetTransferInstructions( Register fromReg, Register toReg) { IList applicableTransferInstr = new ArrayList(); foreach (Instruction ti in TransferInstructions) { RegisterSet tiOutRegs = ti.ResultRegisters; RegisterSet tiInRegs = (RegisterSet) ti.OperandsRegisters[0]; if (tiOutRegs.Contains(toReg) && tiInRegs.Contains(fromReg)) applicableTransferInstr.Add(ti); } return applicableTransferInstr; }