[llvm-dev] What is register scavenging?
Tim Northover via llvm-dev
llvm-dev at lists.llvm.org
Sun Apr 2 08:12:26 PDT 2017
On 2 April 2017 at 07:21, 陳韋任 via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> I would like to know what register scavenging is, but reading
> RegisterScavenging.h  and googling don't help too much. Could someone explain it a little
> bit (what it is and when we need it), or point me to some nice link, I will be very appreciated. :-)
It's a helper for passes that run after register allocation but still
need a new register they can use without breaking anything. It looks
around nearby instructions[*] to see if there's anything it can prove
is unused at the moment, and as a last ditch effort can spill
registers to the stack.
It's not commonly used (better to arrange to have a register allocated
for you if possible), but occasionally helpful in things like frame
[*] This is where the "scavenger" name comes from: hunting around for
discarded registers sort of like the animals.
More information about the llvm-dev