Usage of splitting heuristic among LLVM register allocators

Hi All,

As per understanding, only the Greedy register allocator has the splitting heuristic which is implemented using splitkit.cpp. The splitting logic is only present in splitkit.cpp file of llvm codebase.
Whereas one of the Basic register allocator’s comments state that it also performs splitting but I am not able to find any use of api from splitkit.cpp for splitting.

Please clarify in which register allocator splitting heuristic is being used.

Rohit Aggarwal

Disclaimer:- This footer text is to convey that this email is sent by one of the users of IITH. So, do not mark it as SPAM.

Hi Rohit,

The basic allocator splits live-ranges, but it does that in a very boring way.
Essentially, when you spill, you have to split the live-ranges and that’s what the inline spiller, used by the basic allocator, does.

E.g., let say you have:
a = …

= a

= a

And you want to spill a.

What the spiller will do is split a into its stored and reloaded components:
a0 = …
st a0

a1 = ld
= a1

a2 = ld
= a2

As you can see, the split created a0, a1, and a2 from a.

Now, if you’re interested in fancy live-range splitting, then yes, only the greedy allocator does that.