Machine Scheduler in LLVM – Part I(myhsu.xyz)
myhsu.xyz
Machine Scheduler in LLVM – Part I
https://myhsu.xyz/llvm-machine-scheduler/
2 comments
yes, the short answer is LLVM uses RegPressureTracker (https://llvm.org/doxygen/classllvm_1_1RegPressureTracker.htm...) to do all those calculations. Slightly longer answer: I should probably be a little more specific that in most cases, Machine Scheduler cares more about register pressure _delta_ caused by a single instruction, either traverses from bottom-up or top-down. In which case it's easier to make an estimation when some of other instructions are not scheduled yet.
For example, if an instruction defines a value which has 8 uses, then the "register pressure of the instruction" depends on when those 8 uses will be scheduled.
I guess there is a heuristic to compute the register pressure of an instruction based on a guess of when successors will be scheduled?