Hi, all, I want to add a new SchedHeuristic to track all the heuristic Scheduler used basing on the follow facts.
- It is hard for target to add new heuristic now, as the Reason and tryCandidate() are maintained by base class.
- It is hard for target to change the priority of each heuristic(i.e. prefer cluster over stall) as it is hard code by tryCandidate.
- We assume the value of the Reason matches the priority in the tryCandidate which is easy to be out of sync. And it is out of sync now in fact. (see Stall and TopDepthReduce, we don't know their priority as it is changed according to input)
- The duplicated heuristic between pre-ra and post-ra scheduler. (There are many duplicate code between these two tryCandidate)
As PowerPC target want to add more and more heuristic, and we are struggling to deal with this, so, this is the motivation of this refactor and welcome for comments.
What I did now:
- Each heuristic is an instance of the SchedHeuristic
- Predefine all the heuristic we have now.
- All the active heuristics are put into a vector and its position in the vector means its priority.
- To add a new heuristic, just need to define a new instance of SchedHeuristic with Name and heuristic call back, then, call registerHeuristic() into any position of the vector.
Typo disbaled.