Register allocation questions

Hello,

I am currently working another register allocator for LLVM, and I have a few questions.

I have a list of LiveIntervals that interfere with each other, and once I figure out that I need to spill one of these, I'm using LiveIntervals::addIntervalsForSpills to generate spill code. I'm not sure I'm using this function correctly (or if it's even the right thing to use). Here are a few questions:

- What exactly is the SpillIs parameter for this function?

- The return value is a vector of LiveIntervals, but it looks like they have all been added to the LiveIntervals object already. Is this correct?

- Is the Spiller class functional? Using the -new-spill-framework option with the linearscan allocator is giving me crashes.

I'm using LLVM 2.6 (it's a project-wide requirement). It doesn't look like much of what I'm using has been changed for 2.7 anyway, but let me know if I'm wrong on this.

Thanks,
Sam

Hi Sam,

  • What exactly is the SpillIs parameter for this function?

My understanding is that it tells addIntervalsForSpills not to attempt to rematerialize instructions which use the registers for those intervals (since they’re about to be spilled themselves).

I’ve been passing in an empty set in the PBQP allocator with no correctness issues (that I’ve seen). I’m not sure what omitting it does to the quality of the generated code though.

  • The return value is a vector of LiveIntervals, but it looks like they
    have all been added to the LiveIntervals object already. Is this correct?

Yes - that’s correct.

  • Is the Spiller class functional? Using the -new-spill-framework option
    with the linearscan allocator is giving me crashes.

Spiller is just an interface. TrivialSpiller, the default implementation for LLVM 2.6, was experimental.
These days the default implementation just forwards spilling calls to addIntervalsForSpills anyway.

Cheers,
Lang.