LLVM-gcc scheduler

I'm a taking a compiler course and I'm supposed to implement a scheduler for the LLVM compiler and comapre its persformance to the existing one used by LLVM-gcc. I need some help understanding what is really happening in LLVM-gcc. In CodeGen/SelectionDAG/ I can see four different Schedulers, which one is used by LLVM? Can you give a hint on where/how to add a new scheduler and test it? or a hint on something that you need to be tried/improved in your scheduler?

Hello,

I'm a taking a compiler course and I'm supposed to implement a scheduler for the LLVM compiler and comapre its persformance to the existing one used by LLVM-gcc. I need some help understanding what is really happening in LLVM-gcc. In CodeGen/SelectionDAG/ I can see four different Schedulers, which one is used by LLVM? Can you give a hint on where/how to add a new scheduler and test it? or a hint on something that you need to be tried/improved in your scheduler?

Best,

Samah

Currently the default scheduler for ARM / X86 is the bottom up register pressure reduction list scheduler. For others it's top down list scheduler (optimize for latency). See X86ISelLowering.cpp: the setSchedulingPreference() call changes the default. The other schedulers probably have suffered from bit rot but you can still choose them explicitly from llc with -sched=<> options. See llc --help.

Take a look at ScheduleDAGSimple.cpp as an example to register a scheduler. Look for RegisterScheduler.

If you are ambitious, you can think about a post-register allocation scheduler. :slight_smile: It's something on my todo list for a while. There are tons of different scheduling techniques / heurisitics out there. If you find something you would like to attempt, please point us to it. I am sure you will receive lots of feedbacks from the community.

Evan