The Basic Register allocator

I was studying the basic register allocator, and I am wondering why
"LessSpillWeightPriority" priority was used over the greater weight.

- Thanks
Jeff Kunkel

Because the front of std::priority_queue is the largest element given the ordering.

I understand the mechanics. I don't know why a lesser weight is better
than a greater weight.

Let me rephrase my question. The live intervals have a weight
associated with them. What does this weight exactly represent?

Jeff Kunkel

Approximately: spill cost / live range area, see CalcSpillWeights.cpp

A higher spill weight is more desirable to keep in a register, so those registers are allocated first.