Store (priority,regnum) pairs in the priority queue instead of providing an
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 8 Dec 2010 22:22:41 +0000 (22:22 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 8 Dec 2010 22:22:41 +0000 (22:22 +0000)
commitd0bec3e62c98b1f0ef3a41db8f95599b2014c131
treef7d59ce492f28ed769151e5e41a1c86255786c62
parentbece04845e6746fd162bc36e79a6cfd095165c23
Store (priority,regnum) pairs in the priority queue instead of providing an
abstract priority queue interface in subclasses that want to override the
priority calculations.

Subclasses must provide a getPriority() implementation instead.

This approach requires less code as long as priorities are expressable as simple
floats, and it avoids the dangers of defining potentially expensive priority
comparison functions.

It also should speed up priority_queue operations since they no longer have to
chase pointers when comparing registers. This is not measurable, though.

Preferably, we shouldn't use floats to guide code generation. The use of floats
here is derived from the use of floats for spill weights. Spill weights have a
dynamic range that doesn't lend itself easily to a fixpoint implementation.

When someone invents a stable spill weight representation, it can be reused for
allocation priorities.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121294 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/RegAllocBase.h
lib/CodeGen/RegAllocBasic.cpp
lib/CodeGen/RegAllocGreedy.cpp