Esempio n. 1
0
 public virtual void Remove(Register reg)
 {
     registers.Remove(reg);
 }
Esempio n. 2
0
 public virtual bool Contains(Register reg)
 {
     return registers.Contains(reg);
 }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
 public virtual void Add(Register reg)
 {
     registers.Add(reg);
 }
Esempio n. 5
0
        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;
        }