[llvm-commits] [PATCH] Scavenging callee-saved registers

Evan Cheng evan.cheng at apple.com
Sun Aug 2 11:50:06 PDT 2009


On Aug 2, 2009, at 7:31 AM, Jakob Stoklund Olesen wrote:

> Hi,
>
> I found an issue with the regscavenger when trying to scavenge a
> callee-saved register.
>
> 1. You need a Goldilocks-sized function: Big enough to use all the
> scratch registers, but not big enough to use all the callee-saved
> registers.
> 2. Wait until insertCSRSpillsAndRestores() has run.
> 3. Call RegScavenger::FindUnusedReg(..., ExCalleeSaved=true), get a 0
> 3. Call RegScavenger::scavengeRegister(). It finds one of the unused
> CSRs
>
> This is all good, scavengeRegister() has saved the CSR to the
> emergency spill slot. The problem is that it still considers the CSR
> unused, so it asserts when forward() reaches the emergency spill
> store. "Using an undefined register!".
>
> I have attached a patch that fixes this problem. I mark the scavenged
> register as used to fix the assertion. I also mark the register as
> live-in to MBB. That keeps the machine code verifier quiet, but it is
> a bit of a hack.

Ok. Can you attach the patch? :-)

Evan

>
> A test case is part of the blackfin patch (addsub-i128.ll).
>
> /jakob
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list