Lib/Target/instr/Instr.cpp
/**
 * Return index of accumulator which is free for the given
 * range in the instruction list.
 *
 * If none can be found, return -1.
 */
Return index of accumulator which is free for the given
range in the instruction list.

If none can be found, return -1.
Return index of accumulator which is free for the given range in the instruction list . If none can be found return - 1 .
int Instr::List::get_free_acc(int first, int last) const {
  assert(first <= last);
  assert(first >= 0);
  assert(last  < size());
  uint32_t acc_use = 0xffffffff;  
  for (int i = first; i <= last; ++i) {
    acc_use = acc_use & ~(*this)[i].get_acc_usage();  
  }
  if (Platform::compiling_for_vc4()) {
    acc_use = acc_use & 0xf;   
  } else {
    acc_use = acc_use & 0x1f;  
  }
  int ret = -1;
  for (int i = 0; i < 5; ++i) {
    if ((acc_use & (1 << i)) != 0) {
      ret = i;
      break;
    }
  }
  return ret;
}
int Instr :: List :: get_free_acc ( int first , int last ) const { assert ( first <= last ) ; assert ( first >= 0 ) ; assert ( last < size ( ) ) ; uint32_t acc_use = 0xffffffff ; for ( int i = first ; i <= last ; ++ i ) { acc_use = acc_use & ~ ( * this ) [ i ] . get_acc_usage ( ) ; } if ( Platform :: compiling_for_vc4 ( ) ) { acc_use = acc_use & 0xf ; } else { acc_use = acc_use & 0x1f ; } int ret = -1 ; for ( int i = 0 ; i < 5 ; ++ i ) { if ( ( acc_use & ( 1 << i ) ) != 0 ) { ret = i ; break ; } } return ret ; }
Return index of accumulator which is free for the given
 range in the instruction list.
Return index of accumulator which is free for the given range in the instruction list .
// Keeps track of free acc's, default all free // Remember, get_acc_usage() returns *used* acc's // Mask out unused bits and also r5, because it has special usage. // NOTE, r3 (sfu) and r4 (tmu read) have special usages as well,  // It appears to be required for vc4 to not use r4 (unit test [cond] fails) // Translation: // Target     : LI ACC4 <- 0 // vc4 opcodes: load_imm tmu_noswap, nop, 0x00000000 (0.000000) // r0-r3 // r0-r4 // Determine first non-zero bit