[llvm-dev] PreRewrite Machine Pass

Fabio Pagani via llvm-dev llvm-dev at lists.llvm.org
Thu Sep 17 06:18:47 PDT 2015


Hello everybody,

as the title says i'm writing a MachinePass that's runs just before the
register rewriter.
What this pass should do is to replace (when a specific condition holds)
the physical register assigned to a virtual register with a new physical
register.
This condition doesn't hold "too many times", and usually changing the
mapping once is enough.
After reading some of the register allocators code i've been able to write
this (c++ish):
for NewPhysReg in AllocationOrder:
        if (NewPhysReg == PrevPhysReg)
          continue;

        if(Matrix->checkInterference(VirtRegInterval, NewPhysReg) ==
LiveRegMatrix::IK_Free)
           VRM->clearVirt(VirtReg);
           Matrix->assign(VirtRegInterval, NewPhysReg);


The problem now is: what should i do when all the "new" physical register
have some interference?

Any help is very appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150917/d5356cc5/attachment.html>


More information about the llvm-dev mailing list