[LLVMdev] request for help writing a register allocator

Lang Hames lhames at gmail.com
Thu Oct 22 10:33:41 PDT 2009


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091022/1f849dcd/attachment.html>


More information about the llvm-dev mailing list