<div dir="ltr">Hello,<div>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.</div><div><br></div><div>The Fast RA tries to find a free register using the following code:<br></div><div><div><div> ArrayRef<MCPhysReg> AO = RegClassInfo.getOrder(RC);</div><div><br></div><div>  // First try to find a completely free register.</div></div><div>  for (ArrayRef<MCPhysReg>::iterator I = AO.begin(), E = AO.end(); I != E; ++I){</div><div>    unsigned PhysReg = *I;</div><div>    if (PhysRegState[PhysReg] == regFree && !isRegUsedInInstr(PhysReg)) {</div><div>      assignVirtToPhysReg(*LRI, PhysReg);</div><div>      return LRI;</div><div>    }</div><div>  }</div></div><div><br></div><div>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?</div><div><br></div><div>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?</div><div><br></div><div><br></div><div> </div></div>