本文整理汇总了C++中PassManager::record_running_regalloc方法的典型用法代码示例。如果您正苦于以下问题:C++ PassManager::record_running_regalloc方法的具体用法?C++ PassManager::record_running_regalloc怎么用?C++ PassManager::record_running_regalloc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PassManager
的用法示例。
在下文中一共展示了PassManager::record_running_regalloc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run_pass
void RegAllocPass::run_pass(DexStoresVector& stores,
ConfigFiles&,
PassManager& mgr) {
using Output = graph_coloring::Allocator::Stats;
auto scope = build_class_scope(stores);
auto stats = walk::parallel::reduce_methods<Output>(
scope,
[this](DexMethod* m) { // mapper
graph_coloring::Allocator::Stats stats;
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",
code.get_registers_size(),
SHOW(&code));
try {
live_range::renumber_registers(&code, /* width_aware */ true);
// The transformations below all require a CFG. Build it once
// here instead of requiring each transform to build it.
code.build_cfg(/* editable */ false);
graph_coloring::Allocator allocator(m_allocator_config);
allocator.allocate(m);
stats.accumulate(allocator.get_stats());
TRACE(REG,
5,
"After alloc: regs:%d code:\n%s\n",
code.get_registers_size(),
SHOW(&code));
} catch (std::exception&) {
fprintf(stderr, "Failed to allocate %s\n", SHOW(m));
fprintf(stderr, "%s\n", SHOW(code.cfg()));
throw;
}
return stats;
},
[](Output a, Output b) { // reducer
a.accumulate(b);
return a;
});
TRACE(REG, 1, "Total reiteration count: %lu\n", stats.reiteration_count);
TRACE(REG, 1, "Total Params spilled early: %lu\n", stats.params_spill_early);
TRACE(REG, 1, "Total spill count: %lu\n", stats.moves_inserted());
TRACE(REG, 1, " Total param spills: %lu\n", stats.param_spill_moves);
TRACE(REG, 1, " Total range spills: %lu\n", stats.range_spill_moves);
TRACE(REG, 1, " Total global spills: %lu\n", stats.global_spill_moves);
TRACE(REG, 1, " Total splits: %lu\n", stats.split_moves);
TRACE(REG, 1, "Total coalesce count: %lu\n", stats.moves_coalesced);
TRACE(REG, 1, "Total net moves: %ld\n", stats.net_moves());
mgr.incr_metric("param spilled too early", stats.params_spill_early);
mgr.incr_metric("reiteration_count", stats.reiteration_count);
mgr.incr_metric("spill_count", stats.moves_inserted());
mgr.incr_metric("coalesce_count", stats.moves_coalesced);
mgr.incr_metric("net_moves", stats.net_moves());
mgr.record_running_regalloc();
}