[llvm-dev] Doubts on Fast Register Allocator

fateme Hoseini via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 8 10:22:02 PST 2016


Hello,
I working on a paper and I need to modify the Fast Register Allocator. I
have couple of questions and appreciate if anyone can help me.

The Fast RA tries to find a free register using the following code:
 ArrayRef<MCPhysReg> AO = RegClassInfo.getOrder(RC);

  // First try to find a completely free register.
  for (ArrayRef<MCPhysReg>::iterator I = AO.begin(), E = AO.end(); I != E;
++I){
    unsigned PhysReg = *I;
    if (PhysRegState[PhysReg] == regFree && !isRegUsedInInstr(PhysReg)) {
      assignVirtToPhysReg(*LRI, PhysReg);
      return LRI;
    }
  }

Does this means that it always scan the registers from the beginning and
allocate the free one. I mean if we have allocated R0,R1,R2 and R0 has
become free, for a new allocation ,does the Fast RA choose R0 instead of R3?

Also, In the linear scan algorithm, between two candidate intervals for
spill, the algorithm chooses the one that ends later in the future. Does
the Fast RA do the same?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160208/78fed7f7/attachment-0001.html>


More information about the llvm-dev mailing list