[LLVMdev] Patch - Big stacks on SPU, take 2

Kalle Raiskila kalle.raiskila at nokia.com
Wed Mar 31 00:00:29 PDT 2010


Jakob Stoklund Olesen skrev:
> Looks good. You can try running with -verify-machineinstrs to detect more
> issues like that.

Didn't know about that option, thanks for the tip. The output looks useful!


>> -function prologue and epilogue are not emitted, if the stack size is 16.
>> 16 means it is empty - there is only the register scavenger emergency spill
>> slot, which is not used as there is no stack.
> 
> Would it be possible to detect this before allocating the emergency spill
> slot, and not request a scavenger at all?

Initially I thought not, but heeding your previous advice and studying the ARM 
backend closely, I noticed the function estimateStackSize... I copied the 
function to the SPU backend, and enable the scavenger conditionally if stack is 
small enough. Initial tests look promising!

The estimateStackSize looks quite generic (backend ignorant). Is there a reason 
it is in local to the ARM and not in TargetRegisterInfo class? Are there cases 
when the estimation would fail?


> I noticed that CellSPU has a bunch of isS10Constant() functions. These
> already exist in MathExtras.h: isInt<10>(). Also, there is no need for 5
> overloads of those functions, AFAICT.

Hmm, I just mindlessly copied some legacy code. Thanks for the tip.
I noticed that Benjamin Kramer already made the changes to the SPU backend :)


kalle




More information about the llvm-dev mailing list