[LLVMdev] request for help writing a register allocator

Susan Horwitz horwitz at cs.wisc.edu
Thu Oct 22 10:47:37 PDT 2009


I was NOT using addSpillPoint and addRestorePoint.  I will add those, 
THANK YOU!

I've also found that RegAllocSimple.cpp is a good model for me if I decide 
to give up on using the spiller and instead add the spill/reload code 
myself.

So I'm currently feeling much more optimistic about this project.

Thanks for all the (very quick!) help!!

Susan


On Thu, 22 Oct 2009, Lang Hames wrote:

> Hi Susan,
>
>
>> But this doesn't seem to be happening; the stores to memory are there but
>> the loads are not.
>>
>> Any ideas what's going wrong?
>
>
> Are you using VirtRegMap::addSpillPoint and VirtRegMap::addRestorePoint ? If
> not you may need to add calls to them to let the rewriter know where to
> insert the loads/stores.
>
>
>> If not, any advice on how to generate the loads myself??
>
>
> The TargetInstrInfo class has methods storeRegToStackSlot and
> loadRegFromStackSlot, however I'd avoid mixing direct calls to these with
> calls to the spiller.
>
> Regarding Török's suggestion - make sure you #define the DEBUG_TYPE macro
> (e.g. #define DEBUG_TYPE "foo") if you want your debugging output to be
> available using the -debug-only=foo option.
>
> If you're running llc under a debugger you can also call
> MachineFunction::dump (actually _many_ of the objects have a dump method) at
> any time to print out the state of your machine function. I've found this to
> be quite handy.
>
> Cheers,
> Lang.
>


More information about the llvm-dev mailing list