tree-ssa.h: Don't include gimple-low.h...

* tree-ssa.h: Don't include gimple-low.h, tree-ssa-address.h, sbitmap.h,
	tree-ssa-threadedge.h, tree-ssa-dom.h, and tree-cfgcleanup.h.
	* gimple-low.c (gimple_check_call_arg,
	gimple_check_call_matching_types): Move to cgraph.c.
	* gimple-low.h: Remove prototype.
	* cgraph.c: (gimple_check_call_arg, gimple_check_call_matching_types):
	Relocate from gimple-low.c.
	* cgraph.h: Add prototype.  Don't include basic-block.h.
	* gimplify.c: Add gimple-low to include list.
	* omp-low.c: Add gimple-low and tree-cfgcleanup.h to include list.
	* tree-eh.c: Add gimple-low to include list.
	* tree-nested.c: Likewise.
	* cfgexpand.c: Add tree-ssa-address.h to include list.
	* expr.c: Likewise.
	* gimple-fold.c: Likewise.
	* gimple-ssa-strength-reduction.c: Likewise.
	* trans-mem.c: Likewise.
	* tree-mudflap.c: Likewise.
	* tree-ssa-loop-ivopts.c: Likewise.
	* tree-ssa-dom.c: Include tree-ssa-threadedge.h and tree-ssa-dom.h.
	(degenerate_phi_result): Move to tree-phinodes.c.
	* tree-ssa-loop-ch.c: Include tree-ssa-threadedge.h.
	* tree-ssa-threadedge.c: Likewise.
	* tree-vrp.c: Likewise.
	* tree-phinodes.c (degenerate_phi_result): Relocate here.
	* tree-ssa-dom.h (degenerate_phi_result): Remove Prototype.
	* tree-phinodes.h (degenerate_phi_result): Add prototype.
	* tree-ssa-copy.c: Include tree-ssa-dom.h.
	* tree-ssa-forwprop.c: Likewise.
	* tree-cfgcleanup.c (execute_cleanup_cfg_post_optimizing,
	pass_data_cleanup_cfg_post_optimizing,
	make_pass_cleanup_cfg_post_optimizing): Relocate from tree-optimize.c.
	* tree-optimize.c: Delete File.
	* graphite.c: Include tree-cfgcleanup.h.
	* passes.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-profile.c: Likewise.
	* tree-ssa-dse.c: Likewise.
	* tree-ssa-loop-ivcanon.c: Likewise.
	* tree-switch-conversion.c: Don't include tree-ssa-operands.h.
	* tree-outof-ssa.c: Include sbitmap.h.
	* tree-ssa-live.c: Likewise.
	* tree-ssa-propagate.c: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-stdarg.c: Likewise.
	* Makefile.in (OBJS): Delete tree-optimize.o.
	* basic-block.h (gcov_type, gcov_type_unsigned): Move to coretypes.h.
	* coretypes.h (gcov_type, gcov_type_unsigned): Relocate here.
	* varasm.c: Include basic-block.h.
	* cfgloop.h: Include function.h instead of basic-block.h
	(bb_loop_depth): Move to cfgloop.c.
	* cfgloop.c (bb_loop_depth): Relocate from cfgloop.h.

From-SVN: r203833
This commit is contained in:
Andrew MacLeod 2013-10-18 19:35:40 +00:00 committed by Andrew Macleod
parent bfaa17c183
commit 4484a35a86
46 changed files with 320 additions and 288 deletions

View File

@ -1,3 +1,58 @@
2013-10-18 Andrew MacLeod <amacleod@redhat.com>
* tree-ssa.h: Don't include gimple-low.h, tree-ssa-address.h, sbitmap.h,
tree-ssa-threadedge.h, tree-ssa-dom.h, and tree-cfgcleanup.h.
* gimple-low.c (gimple_check_call_arg,
gimple_check_call_matching_types): Move to cgraph.c.
* gimple-low.h: Remove prototype.
* cgraph.c: (gimple_check_call_arg, gimple_check_call_matching_types):
Relocate from gimple-low.c.
* cgraph.h: Add prototype. Don't include basic-block.h.
* gimplify.c: Add gimple-low to include list.
* omp-low.c: Add gimple-low and tree-cfgcleanup.h to include list.
* tree-eh.c: Add gimple-low to include list.
* tree-nested.c: Likewise.
* cfgexpand.c: Add tree-ssa-address.h to include list.
* expr.c: Likewise.
* gimple-fold.c: Likewise.
* gimple-ssa-strength-reduction.c: Likewise.
* trans-mem.c: Likewise.
* tree-mudflap.c: Likewise.
* tree-ssa-loop-ivopts.c: Likewise.
* tree-ssa-dom.c: Include tree-ssa-threadedge.h and tree-ssa-dom.h.
(degenerate_phi_result): Move to tree-phinodes.c.
* tree-ssa-loop-ch.c: Include tree-ssa-threadedge.h.
* tree-ssa-threadedge.c: Likewise.
* tree-vrp.c: Likewise.
* tree-phinodes.c (degenerate_phi_result): Relocate here.
* tree-ssa-dom.h (degenerate_phi_result): Remove Prototype.
* tree-phinodes.h (degenerate_phi_result): Add prototype.
* tree-ssa-copy.c: Include tree-ssa-dom.h.
* tree-ssa-forwprop.c: Likewise.
* tree-cfgcleanup.c (execute_cleanup_cfg_post_optimizing,
pass_data_cleanup_cfg_post_optimizing,
make_pass_cleanup_cfg_post_optimizing): Relocate from tree-optimize.c.
* tree-optimize.c: Delete File.
* graphite.c: Include tree-cfgcleanup.h.
* passes.c: Likewise.
* tree-cfg.c: Likewise.
* tree-profile.c: Likewise.
* tree-ssa-dse.c: Likewise.
* tree-ssa-loop-ivcanon.c: Likewise.
* tree-switch-conversion.c: Don't include tree-ssa-operands.h.
* tree-outof-ssa.c: Include sbitmap.h.
* tree-ssa-live.c: Likewise.
* tree-ssa-propagate.c: Likewise.
* tree-ssa-structalias.c: Likewise.
* tree-stdarg.c: Likewise.
* Makefile.in (OBJS): Delete tree-optimize.o.
* basic-block.h (gcov_type, gcov_type_unsigned): Move to coretypes.h.
* coretypes.h (gcov_type, gcov_type_unsigned): Relocate here.
* varasm.c: Include basic-block.h.
* cfgloop.h: Include function.h instead of basic-block.h
(bb_loop_depth): Move to cfgloop.c.
* cfgloop.c (bb_loop_depth): Relocate from cfgloop.h.
2013-10-18 Teresa Johnson <tejohnson@google.com>
* predict.c (probably_never_executed): Compare frequency-based

View File

@ -1391,7 +1391,6 @@ OBJS = \
tree-nomudflap.o \
tree-nrv.o \
tree-object-size.o \
tree-optimize.o \
tree-outof-ssa.o \
tree-parloops.o \
tree-phinodes.o \

View File

@ -24,13 +24,11 @@ along with GCC; see the file COPYING3. If not see
#include "vec.h"
#include "function.h"
/* Type we use to hold basic block counters. Should be at least
/* Use gcov_type to hold basic block counters. Should be at least
64bit. Although a counter cannot be negative, we use a signed
type, because erroneous negative counts can be generated when the
flow graph is manipulated by various optimizations. A signed type
makes those easy to detect. */
typedef HOST_WIDEST_INT gcov_type;
typedef unsigned HOST_WIDEST_INT gcov_type_unsigned;
/* Control flow edge information. */
struct GTY((user)) edge_def {

View File

@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see
#include "regs.h" /* For reg_renumber. */
#include "insn-attr.h" /* For INSN_SCHEDULING. */
#include "asan.h"
#include "tree-ssa-address.h"
/* This variable holds information helping the rewriting of SSA trees
into RTL. */

View File

@ -1912,4 +1912,10 @@ get_max_loop_iterations_int (struct loop *loop)
return hwi_nit < 0 ? -1 : hwi_nit;
}
/* Returns the loop depth of the loop BB belongs to. */
int
bb_loop_depth (const_basic_block bb)
{
return bb->loop_father ? loop_depth (bb->loop_father) : 0;
}

View File

@ -20,11 +20,10 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_CFGLOOP_H
#define GCC_CFGLOOP_H
#include "basic-block.h"
#include "double-int.h"
#include "bitmap.h"
#include "sbitmap.h"
#include "function.h"
/* Structure to hold decision about unrolling/peeling. */
enum lpt_dec
@ -455,14 +454,6 @@ loop_depth (const struct loop *loop)
return vec_safe_length (loop->superloops);
}
/* Returns the loop depth of the loop BB belongs to. */
static inline int
bb_loop_depth (const_basic_block bb)
{
return bb->loop_father ? loop_depth (bb->loop_father) : 0;
}
/* Returns the immediate superloop of LOOP, or NULL if LOOP is the outermost
loop. */
@ -744,6 +735,7 @@ extern HOST_WIDE_INT get_estimated_loop_iterations_int (struct loop *);
extern HOST_WIDE_INT get_max_loop_iterations_int (struct loop *);
extern bool get_estimated_loop_iterations (struct loop *loop, double_int *nit);
extern bool get_max_loop_iterations (struct loop *loop, double_int *nit);
extern int bb_loop_depth (const_basic_block);
/* Converts VAL to double_int. */

View File

@ -2998,4 +2998,99 @@ cgraph_get_body (struct cgraph_node *node)
return true;
}
/* Verify if the type of the argument matches that of the function
declaration. If we cannot verify this or there is a mismatch,
return false. */
static bool
gimple_check_call_args (gimple stmt, tree fndecl, bool args_count_match)
{
tree parms, p;
unsigned int i, nargs;
/* Calls to internal functions always match their signature. */
if (gimple_call_internal_p (stmt))
return true;
nargs = gimple_call_num_args (stmt);
/* Get argument types for verification. */
if (fndecl)
parms = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
else
parms = TYPE_ARG_TYPES (gimple_call_fntype (stmt));
/* Verify if the type of the argument matches that of the function
declaration. If we cannot verify this or there is a mismatch,
return false. */
if (fndecl && DECL_ARGUMENTS (fndecl))
{
for (i = 0, p = DECL_ARGUMENTS (fndecl);
i < nargs;
i++, p = DECL_CHAIN (p))
{
tree arg;
/* We cannot distinguish a varargs function from the case
of excess parameters, still deferring the inlining decision
to the callee is possible. */
if (!p)
break;
arg = gimple_call_arg (stmt, i);
if (p == error_mark_node
|| arg == error_mark_node
|| (!types_compatible_p (DECL_ARG_TYPE (p), TREE_TYPE (arg))
&& !fold_convertible_p (DECL_ARG_TYPE (p), arg)))
return false;
}
if (args_count_match && p)
return false;
}
else if (parms)
{
for (i = 0, p = parms; i < nargs; i++, p = TREE_CHAIN (p))
{
tree arg;
/* If this is a varargs function defer inlining decision
to callee. */
if (!p)
break;
arg = gimple_call_arg (stmt, i);
if (TREE_VALUE (p) == error_mark_node
|| arg == error_mark_node
|| TREE_CODE (TREE_VALUE (p)) == VOID_TYPE
|| (!types_compatible_p (TREE_VALUE (p), TREE_TYPE (arg))
&& !fold_convertible_p (TREE_VALUE (p), arg)))
return false;
}
}
else
{
if (nargs != 0)
return false;
}
return true;
}
/* Verify if the type of the argument and lhs of CALL_STMT matches
that of the function declaration CALLEE. If ARGS_COUNT_MATCH is
true, the arg count needs to be the same.
If we cannot verify this or there is a mismatch, return false. */
bool
gimple_check_call_matching_types (gimple call_stmt, tree callee,
bool args_count_match)
{
tree lhs;
if ((DECL_RESULT (callee)
&& !DECL_BY_REFERENCE (DECL_RESULT (callee))
&& (lhs = gimple_call_lhs (call_stmt)) != NULL_TREE
&& !useless_type_conversion_p (TREE_TYPE (DECL_RESULT (callee)),
TREE_TYPE (lhs))
&& !fold_convertible_p (TREE_TYPE (DECL_RESULT (callee)), lhs))
|| !gimple_check_call_args (call_stmt, callee, args_count_match))
return false;
return true;
}
#include "gt-cgraph.h"

View File

@ -25,7 +25,6 @@ along with GCC; see the file COPYING3. If not see
#include "plugin-api.h"
#include "vec.h"
#include "tree.h"
#include "basic-block.h"
#include "function.h"
#include "ipa-ref.h"
@ -742,6 +741,7 @@ void cgraph_speculative_call_info (struct cgraph_edge *,
struct cgraph_edge *&,
struct cgraph_edge *&,
struct ipa_ref *&);
extern bool gimple_check_call_matching_types (gimple, tree, bool);
/* In cgraphunit.c */
struct asm_node *add_asm_node (tree);

View File

@ -43,6 +43,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#ifndef USED_FOR_TARGET
typedef HOST_WIDEST_INT gcov_type;
typedef unsigned HOST_WIDEST_INT gcov_type_unsigned;
struct bitmap_head_def;
typedef struct bitmap_head_def *bitmap;
typedef const struct bitmap_head_def *const_bitmap;

View File

@ -52,6 +52,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-outof-ssa.h"
#include "target-globals.h"
#include "params.h"
#include "tree-ssa-address.h"
/* Decide whether a function's arguments should be processed
from first to last or from last to first.

View File

@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "ipa-utils.h"
#include "gimple-pretty-print.h"
#include "tree-ssa-address.h"
/* Return true when DECL can be referenced from current unit.
FROM_DECL (if non-null) specify constructor of variable DECL was taken from.

View File

@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-core.h"
#include "tree-pass.h"
#include "langhooks.h"
#include "gimple-low.h"
/* The differences between High GIMPLE and Low GIMPLE are the
following:
@ -215,103 +216,6 @@ make_pass_lower_cf (gcc::context *ctxt)
return new pass_lower_cf (ctxt);
}
/* Verify if the type of the argument matches that of the function
declaration. If we cannot verify this or there is a mismatch,
return false. */
static bool
gimple_check_call_args (gimple stmt, tree fndecl, bool args_count_match)
{
tree parms, p;
unsigned int i, nargs;
/* Calls to internal functions always match their signature. */
if (gimple_call_internal_p (stmt))
return true;
nargs = gimple_call_num_args (stmt);
/* Get argument types for verification. */
if (fndecl)
parms = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
else
parms = TYPE_ARG_TYPES (gimple_call_fntype (stmt));
/* Verify if the type of the argument matches that of the function
declaration. If we cannot verify this or there is a mismatch,
return false. */
if (fndecl && DECL_ARGUMENTS (fndecl))
{
for (i = 0, p = DECL_ARGUMENTS (fndecl);
i < nargs;
i++, p = DECL_CHAIN (p))
{
tree arg;
/* We cannot distinguish a varargs function from the case
of excess parameters, still deferring the inlining decision
to the callee is possible. */
if (!p)
break;
arg = gimple_call_arg (stmt, i);
if (p == error_mark_node
|| arg == error_mark_node
|| (!types_compatible_p (DECL_ARG_TYPE (p), TREE_TYPE (arg))
&& !fold_convertible_p (DECL_ARG_TYPE (p), arg)))
return false;
}
if (args_count_match && p)
return false;
}
else if (parms)
{
for (i = 0, p = parms; i < nargs; i++, p = TREE_CHAIN (p))
{
tree arg;
/* If this is a varargs function defer inlining decision
to callee. */
if (!p)
break;
arg = gimple_call_arg (stmt, i);
if (TREE_VALUE (p) == error_mark_node
|| arg == error_mark_node
|| TREE_CODE (TREE_VALUE (p)) == VOID_TYPE
|| (!types_compatible_p (TREE_VALUE (p), TREE_TYPE (arg))
&& !fold_convertible_p (TREE_VALUE (p), arg)))
return false;
}
}
else
{
if (nargs != 0)
return false;
}
return true;
}
/* Verify if the type of the argument and lhs of CALL_STMT matches
that of the function declaration CALLEE. If ARGS_COUNT_MATCH is
true, the arg count needs to be the same.
If we cannot verify this or there is a mismatch, return false. */
bool
gimple_check_call_matching_types (gimple call_stmt, tree callee,
bool args_count_match)
{
tree lhs;
if ((DECL_RESULT (callee)
&& !DECL_BY_REFERENCE (DECL_RESULT (callee))
&& (lhs = gimple_call_lhs (call_stmt)) != NULL_TREE
&& !useless_type_conversion_p (TREE_TYPE (DECL_RESULT (callee)),
TREE_TYPE (lhs))
&& !fold_convertible_p (TREE_TYPE (DECL_RESULT (callee)), lhs))
|| !gimple_check_call_args (call_stmt, callee, args_count_match))
return false;
return true;
}
/* Lower sequence SEQ. Unlike gimplification the statements are not relowered
when they are changed -- if this has to be done, the lowering routine must
do it explicitly. DATA is passed through the recursion. */

View File

@ -20,7 +20,6 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_GIMPLE_LOW_H
#define GCC_GIMPLE_LOW_H
extern bool gimple_check_call_matching_types (gimple, tree, bool);
extern bool gimple_stmt_may_fallthru (gimple);
extern bool gimple_seq_may_fallthru (gimple_seq);
extern void record_vars_into (tree, tree);

View File

@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see
#include "expmed.h"
#include "params.h"
#include "hash-table.h"
#include "tree-ssa-address.h"
/* Information about a strength reduction candidate. Each statement
in the candidate table represents an expression of one of the

View File

@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see
#include "splay-tree.h"
#include "vec.h"
#include "omp-low.h"
#include "gimple-low.h"
#include "langhooks-def.h" /* FIXME: for lhd_set_decl_assembler_name */
#include "tree-pass.h" /* FIXME: only for PROP_gimple_any */

View File

@ -57,6 +57,7 @@ along with GCC; see the file COPYING3. If not see
#include "dbgcnt.h"
#include "tree-parloops.h"
#include "tree-pass.h"
#include "tree-cfgcleanup.h"
#ifdef HAVE_cloog

View File

@ -44,6 +44,8 @@ along with GCC; see the file COPYING3. If not see
#include "cfgloop.h"
#include "target.h"
#include "omp-low.h"
#include "gimple-low.h"
#include "tree-cfgcleanup.h"
/* Lowering of OpenMP parallel and workshare constructs proceeds in two

View File

@ -73,6 +73,7 @@ along with GCC; see the file COPYING3. If not see
#include "context.h"
#include "pass_manager.h"
#include "tree-ssa-live.h" /* For remove_unused_locals. */
#include "tree-cfgcleanup.h"
using namespace gcc;

View File

@ -35,6 +35,7 @@
#include "langhooks.h"
#include "gimple-pretty-print.h"
#include "cfgloop.h"
#include "tree-ssa-address.h"
#define PROB_VERY_UNLIKELY (REG_BR_PROB_BASE / 2000 - 1)

View File

@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "tree-ssa-live.h"
#include "omp-low.h"
#include "tree-cfgcleanup.h"
/* This file contains functions for building the Control Flow Graph (CFG)
for a function tree. */

View File

@ -1027,3 +1027,90 @@ make_pass_merge_phi (gcc::context *ctxt)
{
return new pass_merge_phi (ctxt);
}
/* Pass: cleanup the CFG just before expanding trees to RTL.
This is just a round of label cleanups and case node grouping
because after the tree optimizers have run such cleanups may
be necessary. */
static unsigned int
execute_cleanup_cfg_post_optimizing (void)
{
unsigned int todo = 0;
if (cleanup_tree_cfg ())
todo |= TODO_update_ssa;
maybe_remove_unreachable_handlers ();
cleanup_dead_labels ();
group_case_labels ();
if ((flag_compare_debug_opt || flag_compare_debug)
&& flag_dump_final_insns)
{
FILE *final_output = fopen (flag_dump_final_insns, "a");
if (!final_output)
{
error ("could not open final insn dump file %qs: %m",
flag_dump_final_insns);
flag_dump_final_insns = NULL;
}
else
{
int save_unnumbered = flag_dump_unnumbered;
int save_noaddr = flag_dump_noaddr;
flag_dump_noaddr = flag_dump_unnumbered = 1;
fprintf (final_output, "\n");
dump_enumerated_decls (final_output, dump_flags | TDF_NOUID);
flag_dump_noaddr = save_noaddr;
flag_dump_unnumbered = save_unnumbered;
if (fclose (final_output))
{
error ("could not close final insn dump file %qs: %m",
flag_dump_final_insns);
flag_dump_final_insns = NULL;
}
}
}
return todo;
}
namespace {
const pass_data pass_data_cleanup_cfg_post_optimizing =
{
GIMPLE_PASS, /* type */
"optimized", /* name */
OPTGROUP_NONE, /* optinfo_flags */
false, /* has_gate */
true, /* has_execute */
TV_TREE_CLEANUP_CFG, /* tv_id */
PROP_cfg, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_remove_unused_locals, /* todo_flags_finish */
};
class pass_cleanup_cfg_post_optimizing : public gimple_opt_pass
{
public:
pass_cleanup_cfg_post_optimizing (gcc::context *ctxt)
: gimple_opt_pass (pass_data_cleanup_cfg_post_optimizing, ctxt)
{}
/* opt_pass methods: */
unsigned int execute () {
return execute_cleanup_cfg_post_optimizing ();
}
}; // class pass_cleanup_cfg_post_optimizing
} // anon namespace
gimple_opt_pass *
make_pass_cleanup_cfg_post_optimizing (gcc::context *ctxt)
{
return new pass_cleanup_cfg_post_optimizing (ctxt);
}

View File

@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple.h"
#include "target.h"
#include "cfgloop.h"
#include "gimple-low.h"
/* In some instances a tree and a gimple need to be stored in a same table,
i.e. in hash tables. This is a structure to do this. */

View File

@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#include "cgraph.h"
#include "gimple.h"
#include "tree-ssa-address.h"
extern void add_bb_to_loop (basic_block, struct loop *);

View File

@ -33,6 +33,7 @@
#include "expr.h" /* FIXME: For STACK_SAVEAREA_MODE and SAVE_NONLOCAL. */
#include "langhooks.h"
#include "pointer-set.h"
#include "gimple-low.h"
/* The object of this pass is to lower the representation of a set of nested

View File

@ -1,130 +0,0 @@
/* Top-level control of tree optimizations.
Copyright (C) 2001-2013 Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
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/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
#include "tm_p.h"
#include "basic-block.h"
#include "flags.h"
#include "tree-ssa.h"
#include "function.h"
#include "langhooks.h"
#include "diagnostic-core.h"
#include "toplev.h"
#include "flags.h"
#include "cgraph.h"
#include "tree-inline.h"
#include "tree-pass.h"
#include "ggc.h"
#include "cgraph.h"
#include "cfgloop.h"
#include "except.h"
#include "plugin.h"
/* Pass: cleanup the CFG just before expanding trees to RTL.
This is just a round of label cleanups and case node grouping
because after the tree optimizers have run such cleanups may
be necessary. */
static unsigned int
execute_cleanup_cfg_post_optimizing (void)
{
unsigned int todo = 0;
if (cleanup_tree_cfg ())
todo |= TODO_update_ssa;
maybe_remove_unreachable_handlers ();
cleanup_dead_labels ();
group_case_labels ();
if ((flag_compare_debug_opt || flag_compare_debug)
&& flag_dump_final_insns)
{
FILE *final_output = fopen (flag_dump_final_insns, "a");
if (!final_output)
{
error ("could not open final insn dump file %qs: %m",
flag_dump_final_insns);
flag_dump_final_insns = NULL;
}
else
{
int save_unnumbered = flag_dump_unnumbered;
int save_noaddr = flag_dump_noaddr;
flag_dump_noaddr = flag_dump_unnumbered = 1;
fprintf (final_output, "\n");
dump_enumerated_decls (final_output, dump_flags | TDF_NOUID);
flag_dump_noaddr = save_noaddr;
flag_dump_unnumbered = save_unnumbered;
if (fclose (final_output))
{
error ("could not close final insn dump file %qs: %m",
flag_dump_final_insns);
flag_dump_final_insns = NULL;
}
}
}
return todo;
}
namespace {
const pass_data pass_data_cleanup_cfg_post_optimizing =
{
GIMPLE_PASS, /* type */
"optimized", /* name */
OPTGROUP_NONE, /* optinfo_flags */
false, /* has_gate */
true, /* has_execute */
TV_TREE_CLEANUP_CFG, /* tv_id */
PROP_cfg, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_remove_unused_locals, /* todo_flags_finish */
};
class pass_cleanup_cfg_post_optimizing : public gimple_opt_pass
{
public:
pass_cleanup_cfg_post_optimizing (gcc::context *ctxt)
: gimple_opt_pass (pass_data_cleanup_cfg_post_optimizing, ctxt)
{}
/* opt_pass methods: */
unsigned int execute () {
return execute_cleanup_cfg_post_optimizing ();
}
}; // class pass_cleanup_cfg_post_optimizing
} // anon namespace
gimple_opt_pass *
make_pass_cleanup_cfg_post_optimizing (gcc::context *ctxt)
{
return new pass_cleanup_cfg_post_optimizing (ctxt);
}

View File

@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "gimple-pretty-print.h"
#include "bitmap.h"
#include "sbitmap.h"
#include "tree-ssa.h"
#include "dumpfile.h"
#include "diagnostic-core.h"

View File

@ -464,4 +464,41 @@ remove_phi_nodes (basic_block bb)
set_phi_nodes (bb, NULL);
}
/* Given PHI, return its RHS if the PHI is a degenerate, otherwise return
NULL. */
tree
degenerate_phi_result (gimple phi)
{
tree lhs = gimple_phi_result (phi);
tree val = NULL;
size_t i;
/* Ignoring arguments which are the same as LHS, if all the remaining
arguments are the same, then the PHI is a degenerate and has the
value of that common argument. */
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
tree arg = gimple_phi_arg_def (phi, i);
if (arg == lhs)
continue;
else if (!arg)
break;
else if (!val)
val = arg;
else if (arg == val)
continue;
/* We bring in some of operand_equal_p not only to speed things
up, but also to avoid crashing when dereferencing the type of
a released SSA name. */
else if (TREE_CODE (val) != TREE_CODE (arg)
|| TREE_CODE (val) == SSA_NAME
|| !operand_equal_p (arg, val, 0))
break;
}
return (i == gimple_phi_num_args (phi) ? val : NULL);
}
#include "gt-tree-phinodes.h"

View File

@ -29,7 +29,7 @@ extern void add_phi_arg (gimple, tree, edge, source_location);
extern void remove_phi_args (edge);
extern void remove_phi_node (gimple_stmt_iterator *, bool);
extern void remove_phi_nodes (basic_block);
/* Return a use_operand_p pointer for argument I of PHI node GS. */
extern tree degenerate_phi_result (gimple);
/* Set PHI nodes of a basic block BB to SEQ. */

View File

@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h"
#include "profile.h"
#include "target.h"
#include "tree-cfgcleanup.h"
static GTY(()) tree gcov_type_node;
static GTY(()) tree tree_interval_profiler_fn;

View File

@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "cfgloop.h"
#include "tree-scalar-evolution.h"
#include "tree-ssa-dom.h"
/* This file implements the copy propagation pass and provides a
handful of interfaces for performing const/copy propagation and

View File

@ -37,6 +37,8 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-threadupdate.h"
#include "langhooks.h"
#include "params.h"
#include "tree-ssa-threadedge.h"
#include "tree-ssa-dom.h"
/* This file implements optimizations on the dominator tree. */
@ -2588,42 +2590,6 @@ avail_expr_hash (const void *p)
/* PHI-ONLY copy and constant propagation. This pass is meant to clean
up degenerate PHIs created by or exposed by jump threading. */
/* Given PHI, return its RHS if the PHI is a degenerate, otherwise return
NULL. */
tree
degenerate_phi_result (gimple phi)
{
tree lhs = gimple_phi_result (phi);
tree val = NULL;
size_t i;
/* Ignoring arguments which are the same as LHS, if all the remaining
arguments are the same, then the PHI is a degenerate and has the
value of that common argument. */
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
tree arg = gimple_phi_arg_def (phi, i);
if (arg == lhs)
continue;
else if (!arg)
break;
else if (!val)
val = arg;
else if (arg == val)
continue;
/* We bring in some of operand_equal_p not only to speed things
up, but also to avoid crashing when dereferencing the type of
a released SSA name. */
else if (TREE_CODE (val) != TREE_CODE (arg)
|| TREE_CODE (val) == SSA_NAME
|| !operand_equal_p (arg, val, 0))
break;
}
return (i == gimple_phi_num_args (phi) ? val : NULL);
}
/* Given a statement STMT, which is either a PHI node or an assignment,
remove it from the IL. */

View File

@ -24,6 +24,5 @@ extern void dump_dominator_optimization_stats (FILE *);
extern void debug_dominator_optimization_stats (void);
extern int loop_depth_of_name (tree);
extern bool simple_iv_increment_p (gimple);
extern tree degenerate_phi_result (gimple);
#endif /* GCC_TREE_SSA_DOM_H */

View File

@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "domwalk.h"
#include "flags.h"
#include "langhooks.h"
#include "tree-cfgcleanup.h"
/* This file implements dead store elimination.

View File

@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see
#include "cfgloop.h"
#include "optabs.h"
#include "tree-ssa-propagate.h"
#include "tree-ssa-dom.h"
/* This pass propagates the RHS of assignment statements into use
sites of the LHS of the assignment. It's basically a specialized

View File

@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "gimple-pretty-print.h"
#include "bitmap.h"
#include "sbitmap.h"
#include "tree-ssa.h"
#include "timevar.h"
#include "dumpfile.h"

View File

@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "cfgloop.h"
#include "tree-inline.h"
#include "flags.h"
#include "tree-ssa-threadedge.h"
/* Duplicates headers of loops if they are small enough, so that the statements
in the loop body are always executed when the loop is entered. This

View File

@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "tree-inline.h"
#include "target.h"
#include "tree-cfgcleanup.h"
/* Specifies types of loops that may be unrolled. */

View File

@ -86,6 +86,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h"
#include "tree-ssa-propagate.h"
#include "expmed.h"
#include "tree-ssa-address.h"
/* FIXME: Expressions are expanded to RTL in this pass to determine the
cost of different addressing modes. This should be moved to a TBD

View File

@ -29,6 +29,7 @@
#include "function.h"
#include "gimple-pretty-print.h"
#include "dumpfile.h"
#include "sbitmap.h"
#include "tree-ssa.h"
#include "tree-ssa-propagate.h"
#include "langhooks.h"

View File

@ -25,6 +25,7 @@
#include "ggc.h"
#include "obstack.h"
#include "bitmap.h"
#include "sbitmap.h"
#include "flags.h"
#include "basic-block.h"
#include "tree.h"

View File

@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-threadupdate.h"
#include "langhooks.h"
#include "params.h"
#include "tree-ssa-threadedge.h"
/* To avoid code explosion due to jump threading, we limit the
number of statements we are going to copy. This variable

View File

@ -21,21 +21,15 @@ along with GCC; see the file COPYING3. If not see
#define GCC_TREE_SSA_H
#include "bitmap.h"
#include "sbitmap.h"
#include "gimple.h"
#include "gimple-ssa.h"
#include "cgraph.h"
#include "tree-cfgcleanup.h"
#include "tree-cfg.h"
#include "tree-phinodes.h"
#include "ssa-iterators.h"
#include "tree-ssanames.h"
#include "tree-ssa-dom.h"
#include "tree-ssa-threadedge.h"
#include "tree-ssa-address.h"
#include "tree-ssa-loop.h"
#include "tree-into-ssa.h"
#include "gimple-low.h"
#include "tree-dfa.h"
/* Mapping for redirected edges. */

View File

@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-pretty-print.h"
#include "target.h"
#include "tree-ssa.h"
#include "sbitmap.h"
#include "tree-pass.h"
#include "tree-stdarg.h"

View File

@ -32,7 +32,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "tree.h"
#include "basic-block.h"
#include "tree-ssa.h"
#include "tree-ssa-operands.h"
#include "tree-pass.h"
#include "gimple-pretty-print.h"
#include "cfgloop.h"

View File

@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-threadupdate.h"
#include "expr.h"
#include "optabs.h"
#include "tree-ssa-threadedge.h"

View File

@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h"
#include "pointer-set.h"
#include "asan.h"
#include "basic-block.h"
#ifdef XCOFF_DEBUGGING_INFO
#include "xcoffout.h" /* Needed for external data