Пример #1
0
 public virtual bool Optimize(
     out InstructionGraph instructionGraph,
     out RegisterAssignment registerAssignment,
     out InstructionSchedule instructionSchedule)
 {
     return selector.Optimize(out instructionGraph,
                              out registerAssignment,
                              out instructionSchedule);
 }
Пример #2
0
        public virtual object Clone()
        {
            RegisterAssignment clone = new RegisterAssignment();

            foreach (ValueNode val in registers.Keys)
                clone.registers[val] = registers[val];

            return clone;
        }
Пример #3
0
        public virtual RegisterAssignment Clone(IDictionary valueMap)
        {
            RegisterAssignment clone = new RegisterAssignment();

            foreach (ValueNode val in registers.Keys) {
                ValueNode cloneVal = (ValueNode) valueMap[val];
                clone.registers[cloneVal] = registers[val];
            }

            return clone;
        }
Пример #4
0
        public virtual bool Optimize(
            out InstructionGraph instructionGraph,
            out RegisterAssignment registerAssignment,
            out InstructionSchedule instructionSchedule)
        {
            Run();

            if (Done != null)
                Done(this);

            if (BestGenome.IsValid) {
                instructionGraph    = BestGenome.InstructionGraph;
                registerAssignment  = BestGenome.RegisterAssignment;
                instructionSchedule = BestGenome.InstructionSchedule;
                return true;

            } else {
                instructionGraph    = null;
                instructionSchedule = null;
                registerAssignment  = null;
                return false;
            }
        }
Пример #5
0
 public AssemblyGenerator(RegisterAssignment registerAssignment)
 {
     this.registerAssignment = registerAssignment;
 }
Пример #6
0
        public virtual bool Optimize(
            out RegisterAssignment registerAssignment,
            out InstructionSchedule instructionSchedule)
        {
            Run();

            if (Done != null)
                Done(this);

            registerAssignment = BestGenome.GetRegisterAssignment();
            instructionSchedule = BestGenome.GetInstructionSchedule();

            return BestGenome.IsValid;
        }
Пример #7
0
        public virtual void Initialize()
        {
            IDictionary valueInitialized = new Hashtable();

            foreach (ValueNode val in ValueNodes)
                valueInitialized[val] = false;

            foreach (ValueNode val in ProgramGraph.OutputValues)
                InitializeValue(val, valueInitialized);

            instructionSchedule = null;
            registerAssignment = null;
            instructionGraph = null;

            /*
            bestSchedulingGenome = null;
            */
        }
Пример #8
0
        public virtual void Copy(IGenome otherGenome)
        {
            SelectionGenome other = (SelectionGenome) otherGenome;

            population = other.population;
            isValid = other.isValid;
            modified = other.modified;
            objective = other.objective;

            if (other.instructionGraph != null) {

                IDictionary instructionMap;
                IDictionary valueMap;

                instructionGraph =
                    other.instructionGraph.Clone(
                        out instructionMap, out valueMap);

                if (other.registerAssignment != null &&
                    other.instructionSchedule != null) {

                    registerAssignment =
                        other.registerAssignment.Clone(valueMap);

                    instructionSchedule =
                        other.instructionSchedule.Clone(instructionMap);

                    /*
                    bestSchedulingGenome =
                        other.bestSchedulingGenome.Clone(
                            instructionMap, valueMap);
                    */

                } else {
                    registerAssignment = null;
                    instructionSchedule = null;

                    /*
                    bestSchedulingGenome = null;
                    */
                }

            } else {
                instructionGraph = null;
            }

            foreach (OperationNode op in OperationNodes)
                selection[op] = other.selection[op];
        }
Пример #9
0
        public virtual RegisterAssignment GetRegisterAssignment()
        {
            RegisterAssignment registerAssignment =
                new RegisterAssignment();

            foreach (ValueNode rValue in RegisterValues)
                registerAssignment[rValue] = GetValueInfo(rValue).Register;

            return registerAssignment;
        }