I have some problems with spill/reload and register scavenging
which result in illegal code. As our apps, compiled by LLVM and
our backend, become more and more complex we have the following
problem with our backend:
In most cases registers are spilled on function entry to stack
slots and reloaded on function exit. At some points registers are
spilled and reloaded via register scavenging. There is just one
register (r26) to which a register is written and read from. I
had the impression that such a register as an emergency spill
slot is enough.
But in combination with function calls this fails quite often:
registers are not spilled to stack slots but ALL registers are
written to the emergency spill slot (register r26) and are
reloaded from this register. Obviously this is illegal.
Which problem is solved by register scavenging? Having a free
register during spill/reload? Can some point me to some
There seems to be a connection with the calling conventions. We
have several calling conventions which differ in the callee saved
registers only. R26 should be saved by the callee with every
calling convention. But the generated code seems to be correct
for some conventions but not the preferred one.
Can someone give me a hint to solve this?