/* The tracer pass for the GNU compiler.
Contributed by Jan Hubicka, SuSE Labs.
- Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ 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 2, or (at your option)
+ 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
License for more details.
You should have received a copy of the GNU General Public License
- along with GCC; see the file COPYING. If not, write to the Free
- Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA. */
+ 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:
#include "coverage.h"
#include "tree-pass.h"
-static int count_insns (basic_block);
-static bool ignore_bb_p (basic_block);
-static bool better_p (edge, edge);
+static int count_insns (const_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 *);
/* Return true if we should ignore the basic block for purposes of tracing. */
static bool
-ignore_bb_p (basic_block bb)
+ignore_bb_p (const_basic_block bb)
{
if (bb->index < NUM_FIXED_BLOCKS)
return true;
/* Return number of instructions in the block. */
static int
-count_insns (basic_block bb)
+count_insns (const_basic_block bb)
{
- rtx insn;
+ const_rtx insn;
int n = 0;
for (insn = BB_HEAD (bb);
/* Return true if E1 is more frequent than E2. */
static bool
-better_p (edge e1, edge e2)
+better_p (const_edge e1, const_edge e2)
{
if (e1->count != e2->count)
return e1->count > e2->count;
}
}
-/* Main entry point to this file. FLAGS is the set of flags to pass
- to cfg_layout_initialize(). */
+/* Main entry point to this file. */
void
-tracer (unsigned int flags)
+tracer (void)
{
+ gcc_assert (current_ir_type () == IR_RTL_CFGLAYOUT);
+
if (n_basic_blocks <= NUM_FIXED_BLOCKS + 1)
return;
- cfg_layout_initialize (flags);
mark_dfs_back_edges ();
if (dump_file)
dump_flow_info (dump_file, dump_flags);
tail_duplicate ();
layout_superblocks ();
+ relink_block_chain (/*stay_in_cfglayout_mode=*/true);
+
if (dump_file)
dump_flow_info (dump_file, dump_flags);
- cfg_layout_finalize ();
/* Merge basic blocks in duplicated traces. */
- cleanup_cfg (CLEANUP_EXPENSIVE);
+ cleanup_cfg (0);
}
\f
static bool
}
/* Run tracer. */
-static void
+static unsigned int
rest_of_handle_tracer (void)
{
if (dump_file)
dump_flow_info (dump_file, dump_flags);
- tracer (0);
- cleanup_cfg (CLEANUP_EXPENSIVE);
- reg_scan (get_insns (), max_reg_num ());
+ tracer ();
+ return 0;
}
struct tree_opt_pass pass_tracer =
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
- TODO_dump_func, /* todo_flags_finish */
+ TODO_dump_func | TODO_verify_rtl_sharing, /* todo_flags_finish */
'T' /* letter */
};