message: Parallelize RegAlloc
  Summary: This commit adds multithreading to the RegAlloc pass.
diff: #include "GraphColoring.h"
  #include "IRInstruction.h"
  #include "LiveRange.h"
  +#include "ParallelWalkers.h"
  #include "Transform.h"
  -#include "Walkers.h"
  using namespace regalloc;
  @@ -55,13 +55,22 @@ static DexOpcode pessimize_opcode(DexOpcode op) {
  void RegAllocPass::run_pass(DexStoresVector& stores,
  ConfigFiles&,
  PassManager& mgr) {
  + using Data = std::nullptr_t;
  + using Output = graph_coloring::Allocator::Stats;
  auto scope = build_class_scope(stores);
  + auto stats = walk_methods_parallel<Scope, Data, Output>(
  + scope,
  + [](Data&, DexMethod* m) { // mapper
  graph_coloring::Allocator::Stats stats;
  - walk_code(scope,
  - [](DexMethod*) { return true; },
  - [&](DexMethod* m, IRCode& code) {
  + if (m->get_code() == nullptr) {
  + return stats;
  + }
  + auto& code = *m->get_code();
  +
  TRACE(REG, 3, "Handling %s:\n", SHOW(m));
  - TRACE(REG, 5, "regs:%d code:\n%s\n",
  + TRACE(REG,
  + 5,
  + "regs:%d code:\n%s\n",
  code.get_registers_size(),
  SHOW(&code));
  try {
  @@ -76,7 +85,9 @@ void RegAllocPass::run_pass(DexStoresVector& stores,
  allocator.allocate(&code);
  stats.accumulate(allocator.get_stats());
  - TRACE(REG, 5, "After alloc: regs:%d code:\n%s\n",
  + TRACE(REG,
  + 5,
  + "After alloc: regs:%d code:\n%s\n",
  code.get_registers_size(),
  SHOW(&code));
  @@ -89,6 +100,14 @@ void RegAllocPass::run_pass(DexStoresVector& stores,
  fprintf(stderr, "%s\n", SHOW(code.cfg()));
  throw;
  }
  + return stats;
  + },
  + [](Output a, Output b) { // reducer
  + a.accumulate(b);
  + return a;
  + },
  + [&](unsigned int) { // data initializer
  + return nullptr;
  });
  TRACE(REG, 1, "Total reiteration count: %lu\n", stats.reiteration_count);
  