third_party/mesa/src/src/mesa/drivers/dri/i965/brw_fs.cpp
/**
 * Must be called after calculate_live_intervales() to remove unused
 * writes to registers -- register allocation will fail otherwise
 * because something deffed but not used won't be considered to
 * interfere with other regs.
 */
Must be called after calculate_live_intervales() to remove unused
writes to registers -- register allocation will fail otherwise
because something deffed but not used won't be considered to
interfere with other regs.
Must be called after calculate_live_intervales () to remove unused writes to registers -- register allocation will fail otherwise because something deffed but not used won ' t be considered to interfere with other regs .
bool
fs_visitor::dead_code_eliminate()
{
   bool progress = false;
   int pc = 0;
   calculate_live_intervals();
   foreach_list_safe(node, &this->instructions) {
      fs_inst *inst = (fs_inst *)node;
      if (inst->dst.file == GRF && this->virtual_grf_use[inst->dst.reg] <= pc) {
	 inst->remove();
	 progress = true;
      }
      pc++;
   }
   if (progress)
      live_intervals_valid = false;
   return progress;
}
bool fs_visitor :: dead_code_eliminate ( ) { bool progress = false ; int pc = 0 ; calculate_live_intervals ( ) ; foreach_list_safe ( node , & this -> instructions ) { fs_inst * inst = ( fs_inst * ) node ; if ( inst -> dst . file == GRF && this -> virtual_grf_use [ inst -> dst . reg ] <= pc ) { inst -> remove ( ) ; progress = true ; } pc ++ ; } if ( progress ) live_intervals_valid = false ; return progress ; }
Must be called after calculate_live_intervales() to remove unused
 writes to registers -- register allocation will fail otherwise
 because something deffed but not used won't be considered to
 interfere with other regs.
Must be called after calculate_live_intervales () to remove unused writes to registers -- register allocation will fail otherwise because something deffed but not used won ' t be considered to interfere with other regs .