Lib/Liveness/Liveness.cpp
/**
 * Introduce optimizations where possible in the instruction list
 *
 * This is done before the actual liveness analysis.
 * The idea is to minimize beforehand the number of variables considered
 * in the liveness analysis.
 */
Introduce optimizations where possible in the instruction list
This is done before the actual liveness analysis.
The idea is to minimize beforehand the number of variables considered
in the liveness analysis.
Introduce optimizations where possible in the instruction list This is done before the actual liveness analysis . The idea is to minimize beforehand the number of variables considered in the liveness analysis .
void Liveness::optimize(Instr::List &instrs, int numVars) {
  assertq(count_skips(instrs) == 0, "optimize(): SKIPs detected in instruction list");
  compile_data.target_code_before_optimization = instrs.dump();
  Liveness live(numVars);
  live.compute(instrs);
  if (combineImmediates(live, instrs)) {
    live.compute(instrs);  
  }
  int prev_count_skips = count_skips(instrs);
  compile_data.num_accs_introduced = introduceAccum(live, instrs);
  assertq(prev_count_skips == count_skips(instrs), "SKIP count changed after introduceAccum()");
  instrs = remove_replaced_instructions(instrs);
  assertq(count_skips(instrs) == 0, "optimize(): SKIPs detected in instruction list after cleanup");
  compile_data.target_code_before_liveness = instrs.dump();
}
void Liveness :: optimize ( Instr :: List & instrs , int numVars ) { assertq ( count_skips ( instrs ) == 0 , " " ) ; compile_data . target_code_before_optimization = instrs . dump ( ) ; Liveness live ( numVars ) ; live . compute ( instrs ) ; if ( combineImmediates ( live , instrs ) ) { live . compute ( instrs ) ; } int prev_count_skips = count_skips ( instrs ) ; compile_data . num_accs_introduced = introduceAccum ( live , instrs ) ; assertq ( prev_count_skips == count_skips ( instrs ) , " " ) ; instrs = remove_replaced_instructions ( instrs ) ; assertq ( count_skips ( instrs ) == 0 , " " ) ; compile_data . target_code_before_liveness = instrs . dump ( ) ; }
Introduce optimizations where possible in the instruction list
 This is done before the actual liveness analysis.
Introduce optimizations where possible in the instruction list This is done before the actual liveness analysis .
//Timer t1("live compute"); //std::cout << live.dump() << std::endl; //t1.end(); //std::cout << "After combineImmediates:\n";  //std::cout << instrs.dump(true) << std::endl;  // Useful sometimes for debug //Timer t3("combine immediates compute", true); // instructions have changed, redo liveness //std::cout << live.dump() << std::endl; //Timer t3("introduceAccum"); //t3.end(); // Times for following (now) insignificant //std::cout << count_reg_types(instrs).dump() << std::endl;