Lib/Liveness/Liveness.cpp
/**
 * Removes all SKIP instructions from the list
 *
 * Creating a new list is MUCH faster than inline removal using Instr::remove().
 * i.e.  Remove 1857 SKIPs from kernel final size 140828
 *        - remove() -> 28.557023s
 *        - new list -> 0.170661s
 */
Removes all SKIP instructions from the list
Creating a new list is MUCH faster than inline removal using Instr::remove().
Removes all SKIP instructions from the list Creating a new list is MUCH faster than inline removal using Instr :: remove () .
Instr::List  remove_replaced_instructions(Instr::List &instrs) {
  Instr::List ret;
  int cur   = 0;
  int count = 0;
  while (cur < instrs.size()) {
    if (instrs[cur].tag == InstrTag::SKIP) {
      count++;
    } else {
      ret << instrs[cur];
    }
    cur++;
  }
  return ret;
}
Instr :: List remove_replaced_instructions ( Instr :: List & instrs ) { Instr :: List ret ; int cur = 0 ; int count = 0 ; while ( cur < instrs . size ( ) ) { if ( instrs [ cur ] . tag == InstrTag :: SKIP ) { count ++ ; } else { ret << instrs [ cur ] ; } cur ++ ; } return ret ; }
Removes all SKIP instructions from the list
 Creating a new list is MUCH faster than inline removal using Instr::remove().
Removes all SKIP instructions from the list Creating a new list is MUCH faster than inline removal using Instr :: remove () .
/*
  if (count > 0) {
    std::string msg;
    msg << "remove_replaced_instructions() removed " << count << " SKIPs";
    debug(msg);
  }
*/