extsrc/mesa/src/gallium/drivers/nv50/codegen/nv50_ir_ra.cpp
// Build the set of live-in variables of bb.
Build the set of live-in variables of bb.
Build the set of live - in variables of bb .
bool
RegAlloc::buildLiveSets(BasicBlock *bb)
{
   BasicBlock *bn;
   Instruction *i;
   unsigned int s, d;
   INFO_DBG(prog->dbgFlags, REG_ALLOC, "buildLiveSets(BB:%i)\n", bb->getId());
   bb->liveSet.allocate(func->allLValues.getSize(), false);
   int n = 0;
   for (Graph::EdgeIterator ei = bb->cfg.outgoing(); !ei.end(); ei.next()) {
      bn = BasicBlock::get(ei.getNode());
      if (bn == bb)
         continue;
      if (bn->cfg.visit(sequence))
         if (!buildLiveSets(bn))
            return false;
      if (n++ == 0)
         bb->liveSet = bn->liveSet;
      else
         bb->liveSet |= bn->liveSet;
   }
   if (!n && !bb->liveSet.marker)
      bb->liveSet.fill(0);
   bb->liveSet.marker = true;
   if (prog->dbgFlags & NV50_IR_DEBUG_REG_ALLOC) {
      INFO("BB:%i live set of out blocks:\n", bb->getId());
      bb->liveSet.print();
   }
   for (i = bb->getExit(); i && i != bb->getEntry()->prev; i = i->prev) {
      for (d = 0; i->defExists(d); ++d)
         bb->liveSet.clr(i->getDef(d)->id);
      for (s = 0; i->srcExists(s); ++s)
         if (i->getSrc(s)->asLValue())
            bb->liveSet.set(i->getSrc(s)->id);
   }
   for (i = bb->getPhi(); i && i->op == OP_PHI; i = i->next)
      bb->liveSet.clr(i->getDef(0)->id);
   if (prog->dbgFlags & NV50_IR_DEBUG_REG_ALLOC) {
      INFO("BB:%i live set after propagation:\n", bb->getId());
      bb->liveSet.print();
   }
   return true;
}
bool RegAlloc :: buildLiveSets ( BasicBlock * bb ) { BasicBlock * bn ; Instruction * i ; unsigned int s , d ; INFO_DBG ( prog -> dbgFlags , REG_ALLOC , " \n " , bb -> getId ( ) ) ; bb -> liveSet . allocate ( func -> allLValues . getSize ( ) , false ) ; int n = 0 ; for ( Graph :: EdgeIterator ei = bb -> cfg . outgoing ( ) ; ! ei . end ( ) ; ei . next ( ) ) { bn = BasicBlock :: get ( ei . getNode ( ) ) ; if ( bn == bb ) continue ; if ( bn -> cfg . visit ( sequence ) ) if ( ! buildLiveSets ( bn ) ) return false ; if ( n ++ == 0 ) bb -> liveSet = bn -> liveSet ; else bb -> liveSet |= bn -> liveSet ; } if ( ! n && ! bb -> liveSet . marker ) bb -> liveSet . fill ( 0 ) ; bb -> liveSet . marker = true ; if ( prog -> dbgFlags & NV50_IR_DEBUG_REG_ALLOC ) { INFO ( " \n " , bb -> getId ( ) ) ; bb -> liveSet . print ( ) ; } for ( i = bb -> getExit ( ) ; i && i != bb -> getEntry ( ) -> prev ; i = i -> prev ) { for ( d = 0 ; i -> defExists ( d ) ; ++ d ) bb -> liveSet . clr ( i -> getDef ( d ) -> id ) ; for ( s = 0 ; i -> srcExists ( s ) ; ++ s ) if ( i -> getSrc ( s ) -> asLValue ( ) ) bb -> liveSet . set ( i -> getSrc ( s ) -> id ) ; } for ( i = bb -> getPhi ( ) ; i && i -> op == OP_PHI ; i = i -> next ) bb -> liveSet . clr ( i -> getDef ( 0 ) -> id ) ; if ( prog -> dbgFlags & NV50_IR_DEBUG_REG_ALLOC ) { INFO ( " \n " , bb -> getId ( ) ) ; bb -> liveSet . print ( ) ; } return true ; }
Build the set of live-in variables of bb.
Build the set of live - in variables of bb .
// if (!bb->getEntry()) //   return true;