GCC Middle and Back End API Reference
tracer.c File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
#include "rtl.h"
#include "hard-reg-set.h"
#include "basic-block.h"
#include "fibheap.h"
#include "flags.h"
#include "params.h"
#include "coverage.h"
#include "tree-pass.h"
#include "gimple.h"
#include "tree-cfg.h"
#include "tree-ssa.h"
#include "tree-inline.h"
#include "cfgloop.h"
Include dependency graph for tracer.c:

Functions

static int count_insns (basic_block)
static bool ignore_bb_p (const_basic_block)
static bool better_p (const_edge, const_edge)
static edge find_best_successor (basic_block)
static edge find_best_predecessor (basic_block)
static int find_trace (basic_block, basic_block *)
static void mark_bb_seen ()
static bool bb_seen_p ()
static bool ignore_bb_p ()
static int count_insns ()
static bool better_p ()
static edge find_best_successor ()
static edge find_best_predecessor ()
static int find_trace ()
static bool tail_duplicate ()
static unsigned int tracer ()
static bool gate_tracer ()
gimple_opt_passmake_pass_tracer ()

Variables

static int probability_cutoff
static int branch_ratio_cutoff
sbitmap bb_seen

Function Documentation

static bool bb_seen_p ( )
inlinestatic
static bool better_p ( const_edge  ,
const_edge   
)
static
static bool better_p ( )
static

Return true if E1 is more frequent than E2.

This is needed to avoid changes in the decision after CFG is modified.

static int count_insns ( basic_block  )
static

The tracer pass for the GNU compiler. Contributed by Jan Hubicka, SuSE Labs. Adapted to work on GIMPLE instead of RTL by Robert Kidd, UIUC. Copyright (C) 2001-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. This pass performs the tail duplication needed for superblock formation. For more information see:

Design and Analysis of Profile-Based Optimization in Compaq's Compilation Tools for Alpha; Journal of Instruction-Level Parallelism 3 (2000) 1-25

Unlike Compaq's implementation we don't do the loop peeling as most probably a better job can be done by a special pass and we don't need to worry too much about the code size implications as the tail duplicates are crossjumped again if optimizations are not performed.

static int count_insns ( )
static

Return number of instructions in the block.

References eni_size_weights, estimate_num_insns(), and gsi_stmt().

static edge find_best_predecessor ( basic_block  )
static
static edge find_best_predecessor ( )
static

Return most frequent predecessor of basic block BB.

static edge find_best_successor ( basic_block  )
static
static edge find_best_successor ( )
static

Return most frequent successor of basic block BB.

static int find_trace ( basic_block  ,
basic_block  
)
static
static int find_trace ( )
static

Find the trace using bb and record it in the TRACE array. Return number of basic blocks recorded.

Follow the trace in forward direction.

static bool gate_tracer ( )
static

References execute(), and tracer().

static bool ignore_bb_p ( const_basic_block  )
static
static bool ignore_bb_p ( )
static

Return true if we should ignore the basic block for purposes of tracing.

A transaction is a single entry multiple exit region. It must be duplicated in its entirety or not at all.

gimple_opt_pass* make_pass_tracer ( )
static void mark_bb_seen ( )
inlinestatic
static bool tail_duplicate ( )
static

Look for basic blocks in frequency order, construct traces and tail duplicate if profitable.

 Create an oversized sbitmap to reduce the chance that we need to
 resize it.   
             We have the tendency to duplicate the loop header
             of all do { } while loops.  Do not do that - it is
             not profitable and it might create a loop with multiple
             entries or at least rotate the loop.   
             Reconsider the original copy of block we've duplicated.
             Removing the most common predecessor may make it to be
             head.   
         In case the trace became infrequent, stop duplicating.   
static unsigned int tracer ( )
static

Main entry point to this file.

Trace formation is done on the fly inside tail_duplicate

     If we changed the CFG schedule loops for fixup by cleanup_cfg.   

Referenced by gate_tracer().


Variable Documentation

sbitmap bb_seen

A bit BB->index is set if BB has already been seen, i.e. it is connected to some trace already.

int branch_ratio_cutoff
static
int probability_cutoff
static

Minimal outgoing edge probability considered for superblock formation.