示例#1
0
文件: Register.cs 项目: harnold/cobe
 public virtual void Remove(Register reg)
 {
     registers.Remove(reg);
 }
示例#2
0
文件: Register.cs 项目: harnold/cobe
 public virtual bool Contains(Register reg)
 {
     return registers.Contains(reg);
 }
示例#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;
        }
示例#4
0
文件: Register.cs 项目: harnold/cobe
 public virtual void Add(Register reg)
 {
     registers.Add(reg);
 }
示例#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;
        }