I want to write a new scheduler for llvm. I am a beginner and I will appreciate your ideas and opinions on how to write it.
This scheduler should find the last store instruction in each basic block and tries to schedule as many instruction as possible before that specific instruction.It means, some instructions have data dependency with store and they have to be scheduled before store or after it . But there are some instructions that can be scheduled either before or after the store instruction. I need my scheduler to schedule them before the store instruction. In other words, it’s a greedy scheduler which tries to schedule as many instruction as possible before the last store instruction in a basic block.
I am trying to understand how LLVM scheduler works by reading through the ScheduleDAG, ScheduleDAGNodes, and ScheduleDAGFast codes, but they are very complicated and I don’t seem to find any document on the scheduler details. Is the path that I’m taking a good way to understand how to write a scheduler?Do I have to write a scheduler from scratch or is it better to modify an existing scheduler?
Thanks for your help,