Add timers for branch relaxation and instruction shrinking.

This commit is contained in:
Dan Gohman
2018-06-21 16:18:34 -07:00
parent d209137149
commit 593e2bae6c
3 changed files with 8 additions and 0 deletions

View File

@@ -32,12 +32,15 @@ use cursor::{Cursor, FuncCursor};
use ir::{Function, InstructionData, Opcode}; use ir::{Function, InstructionData, Opcode};
use isa::{EncInfo, TargetIsa}; use isa::{EncInfo, TargetIsa};
use iterators::IteratorExtras; use iterators::IteratorExtras;
use timing;
use CodegenResult; use CodegenResult;
/// Relax branches and compute the final layout of EBB headers in `func`. /// Relax branches and compute the final layout of EBB headers in `func`.
/// ///
/// Fill in the `func.offsets` table so the function is ready for binary emission. /// Fill in the `func.offsets` table so the function is ready for binary emission.
pub fn relax_branches(func: &mut Function, isa: &TargetIsa) -> CodegenResult<CodeOffset> { pub fn relax_branches(func: &mut Function, isa: &TargetIsa) -> CodegenResult<CodeOffset> {
let _tt = timing::relax_branches();
let encinfo = isa.encoding_info(); let encinfo = isa.encoding_info();
// Clear all offsets so we can recognize EBBs that haven't been visited yet. // Clear all offsets so we can recognize EBBs that haven't been visited yet.

View File

@@ -8,9 +8,12 @@
use ir::Function; use ir::Function;
use isa::TargetIsa; use isa::TargetIsa;
use regalloc::RegDiversions; use regalloc::RegDiversions;
use timing;
/// Pick the smallest valid encodings for instructions. /// Pick the smallest valid encodings for instructions.
pub fn shrink_instructions(func: &mut Function, isa: &TargetIsa) { pub fn shrink_instructions(func: &mut Function, isa: &TargetIsa) {
let _tt = timing::shrink_instructions();
let encinfo = isa.encoding_info(); let encinfo = isa.encoding_info();
let mut divert = RegDiversions::new(); let mut divert = RegDiversions::new();

View File

@@ -71,6 +71,8 @@ define_passes!{
ra_coloring: "RA coloring", ra_coloring: "RA coloring",
prologue_epilogue: "Prologue/epilogue insertion", prologue_epilogue: "Prologue/epilogue insertion",
shrink_instructions: "Instruction encoding shrinking",
relax_branches: "Branch relaxation",
binemit: "Binary machine code emission", binemit: "Binary machine code emission",
layout_renumber: "Layout full renumbering", layout_renumber: "Layout full renumbering",