Commit 73fbfcad by Sharad Singhai Committed by Sharad Singhai

dumpfile.c (dump_enabled_p): Make it inline and move the definition to dumpfile.h.

2012-10-24  Sharad Singhai  <singhai@google.com>

	* dumpfile.c (dump_enabled_p): Make it inline and move the definition
	to dumpfile.h.
	(dump_kind_p): Deleted. Functionality replaced by dump_enabled_p.
	Make alt_dump_file extern.
	* dumpfile.h (dump_enabled_p): Move inline definition here.
	(dump_kind_p): Delete declaration.
	Add extern declaration of alt_dump_file.
	* toplev.c: Move dump_file and dump_file_name to dumpfile.c.
	* tree-vect-loop-manip.c: Replace all uses of dump_kind_p with
	dump_enabled_p.
	* tree-vectorizer.c: Likewise.
	* tree-vect-loop.c: Likewise.
	* tree-vect-data-refs.c: Likewise.
	* tree-vect-patterns.c: Likewise.
	* tree-vect-stmts.c: Likewise.
	* tree-vect-slp.c: Likewise.

From-SVN: r192773
parent c1a4d0b5
2012-10-24 Sharad Singhai <singhai@google.com>
* dumpfile.c (dump_enabled_p): Make it inline and move the definition
to dumpfile.h.
(dump_kind_p): Deleted. Functionality replaced by dump_enabled_p.
Make alt_dump_file extern.
* dumpfile.h (dump_enabled_p): Move inline definition here.
(dump_kind_p): Delete declaration.
Add extern declaration of alt_dump_file.
* toplev.c: Move dump_file and dump_file_name to dumpfile.c.
* tree-vect-loop-manip.c: Replace all uses of dump_kind_p with
dump_enabled_p.
* tree-vectorizer.c: Likewise.
* tree-vect-loop.c: Likewise.
* tree-vect-data-refs.c: Likewise.
* tree-vect-patterns.c: Likewise.
* tree-vect-stmts.c: Likewise.
* tree-vect-slp.c: Likewise.
2012-10-24 Richard Sandiford <rdsandiford@googlemail.com>
* expmed.c (lowpart_bit_field_p): Add missing == 0 check.
......@@ -32,12 +32,18 @@ along with GCC; see the file COPYING3. If not see
static int pflags; /* current dump_flags */
static int alt_flags; /* current opt_info flags */
static FILE *alt_dump_file = NULL;
static void dump_loc (int, FILE *, source_location);
static int dump_phase_enabled_p (int);
static FILE *dump_open_alternate_stream (struct dump_file_info *);
/* These are currently used for communicating between passes.
However, instead of accessing them directly, the passes can use
dump_printf () for dumps. */
FILE *dump_file = NULL;
FILE *alt_dump_file = NULL;
const char *dump_file_name;
/* Table of tree dump switches. This must be consistent with the
TREE_DUMP_INDEX enumeration in dumpfile.h. */
static struct dump_file_info dump_files[TDI_end] =
......@@ -514,14 +520,6 @@ dump_phase_enabled_p (int phase)
}
}
/* Return true if any of the dumps are enabled, false otherwise. */
inline bool
dump_enabled_p (void)
{
return (dump_file || alt_dump_file);
}
/* Returns nonzero if tree dump PHASE has been initialized. */
int
......@@ -836,16 +834,6 @@ opt_info_switch_p (const char *arg)
return opt_info_enable_all ((TDF_TREE | TDF_RTL | TDF_IPA), flags, filename);
}
/* Return true if any dumps are enabled for the given MSG_TYPE, false
otherwise. */
bool
dump_kind_p (int msg_type)
{
return (dump_file && (msg_type & pflags))
|| (alt_dump_file && (msg_type & alt_flags));
}
/* Print basic block on the dump streams. */
void
......
......@@ -108,7 +108,6 @@ struct dump_file_info
int num; /* dump file number */
};
/* In dumpfile.c */
extern char *get_dump_file_name (int);
extern int dump_initialized_p (int);
......@@ -120,8 +119,6 @@ extern void dump_node (const_tree, int, FILE *);
extern int dump_switch_p (const char *);
extern int opt_info_switch_p (const char *);
extern const char *dump_flag_name (int);
extern bool dump_kind_p (int);
extern inline bool dump_enabled_p (void);
extern void dump_printf (int, const char *, ...) ATTRIBUTE_PRINTF_2;
extern void dump_printf_loc (int, source_location,
const char *, ...) ATTRIBUTE_PRINTF_3;
......@@ -142,10 +139,19 @@ extern void dump_bb (FILE *, basic_block, int, int);
/* Global variables used to communicate with passes. */
extern FILE *dump_file;
extern FILE *alt_dump_file;
extern int dump_flags;
extern const char *dump_file_name;
/* Return the dump_file_info for the given phase. */
extern struct dump_file_info *get_dump_file_info (int);
/* Return true if any of the dumps are enabled, false otherwise. */
static inline bool
dump_enabled_p (void)
{
return (dump_file || alt_dump_file);
}
#endif /* GCC_DUMPFILE_H */
......@@ -169,8 +169,6 @@ const char *user_label_prefix;
FILE *asm_out_file;
FILE *aux_info_file;
FILE *stack_usage_file = NULL;
FILE *dump_file = NULL;
const char *dump_file_name;
/* The current working directory of a translation. It's generally the
directory from which compilation was initiated, but a preprocessed
......
......@@ -792,7 +792,7 @@ slpeel_make_loop_iterate_ntimes (struct loop *loop, tree niters)
free_stmt_vec_info (orig_cond);
loop_loc = find_loop_location (loop);
if (dump_kind_p (MSG_NOTE))
if (dump_enabled_p ())
{
if (LOCATION_LOCUS (loop_loc) != UNKNOWN_LOC)
dump_printf (MSG_NOTE, "\nloop at %s:%d: ", LOC_FILE (loop_loc),
......@@ -1683,7 +1683,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
/* Analyze phi functions of the loop header. */
if (dump_kind_p (MSG_NOTE))
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location, "vect_can_advance_ivs_p:");
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
......@@ -1691,7 +1691,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
tree evolution_part;
phi = gsi_stmt (gsi);
if (dump_kind_p (MSG_NOTE))
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location, "Analyze phi: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0);
......@@ -1702,7 +1702,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
if (virtual_operand_p (PHI_RESULT (phi)))
{
if (dump_kind_p (MSG_MISSED_OPTIMIZATION))
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"virtual phi. skip.");
continue;
......@@ -1712,7 +1712,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
if (STMT_VINFO_DEF_TYPE (vinfo_for_stmt (phi)) == vect_reduction_def)
{
if (dump_kind_p (MSG_MISSED_OPTIMIZATION))
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"reduc phi. skip.");
continue;
......@@ -1725,13 +1725,13 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
if (!access_fn)
{
if (dump_kind_p (MSG_MISSED_OPTIMIZATION))
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"No Access function.");
return false;
}
if (dump_kind_p (MSG_NOTE))
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location,
"Access function of PHI: ");
......@@ -1742,7 +1742,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
if (evolution_part == NULL_TREE)
{
if (dump_kind_p (MSG_MISSED_OPTIMIZATION))
if (dump_enabled_p ())
dump_printf (MSG_MISSED_OPTIMIZATION, "No evolution.");
return false;
}
......@@ -1827,7 +1827,7 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
phi = gsi_stmt (gsi);
phi1 = gsi_stmt (gsi1);
if (dump_kind_p (MSG_NOTE))
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location,
"vect_update_ivs_after_vectorizer: phi: ");
......@@ -1837,7 +1837,7 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
/* Skip virtual phi's. */
if (virtual_operand_p (PHI_RESULT (phi)))
{
if (dump_kind_p (MSG_MISSED_OPTIMIZATION))
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"virtual phi. skip.");
continue;
......@@ -1847,7 +1847,7 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
stmt_info = vinfo_for_stmt (phi);
if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def)
{
if (dump_kind_p (MSG_MISSED_OPTIMIZATION))
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"reduc phi. skip.");
continue;
......@@ -1910,7 +1910,7 @@ vect_do_peeling_for_loop_bound (loop_vec_info loop_vinfo, tree *ratio,
tree cond_expr = NULL_TREE;
gimple_seq cond_expr_stmt_list = NULL;
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"=== vect_do_peeling_for_loop_bound ===");
......@@ -2022,7 +2022,7 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters, int
{
int npeel = LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo);
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"known peeling = %d.", npeel);
......@@ -2076,7 +2076,7 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters, int
if (TREE_CODE (loop_niters) != INTEGER_CST)
iters = fold_build2 (MIN_EXPR, niters_type, iters, loop_niters);
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
{
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"niters for prolog loop: ");
......@@ -2134,7 +2134,7 @@ vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters)
VEC (data_reference_p, heap) *datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
struct data_reference *dr;
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"=== vect_update_inits_of_dr ===");
......@@ -2163,7 +2163,7 @@ vect_do_peeling_for_alignment (loop_vec_info loop_vinfo,
int max_iter;
int bound = 0;
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"=== vect_do_peeling_for_alignment ===");
......@@ -2475,7 +2475,7 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo,
segment_length_a = vect_vfa_segment_size (dr_a, length_factor);
segment_length_b = vect_vfa_segment_size (dr_b, length_factor);
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
{
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"create runtime check for data references ");
......@@ -2506,7 +2506,7 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo,
*cond_expr = part_cond_expr;
}
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"created %u versioning for alias checks.\n",
VEC_length (ddr_p, may_alias_ddrs));
......
......@@ -416,7 +416,7 @@ vect_recog_dot_prod_pattern (VEC (gimple, heap) **stmts, tree *type_in,
pattern_stmt = gimple_build_assign_with_ops (DOT_PROD_EXPR, var,
oprnd00, oprnd01, oprnd1);
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
{
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"vect_recog_dot_prod_pattern: detected: ");
......@@ -676,7 +676,7 @@ vect_recog_widen_mult_pattern (VEC (gimple, heap) **stmts,
return NULL;
/* Pattern detected. */
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"vect_recog_widen_mult_pattern: detected: ");
......@@ -699,7 +699,7 @@ vect_recog_widen_mult_pattern (VEC (gimple, heap) **stmts,
pattern_stmt = gimple_build_assign_with_ops (WIDEN_MULT_EXPR, var, oprnd0,
oprnd1);
if (dump_kind_p (MSG_NOTE))
if (dump_enabled_p ())
dump_gimple_stmt_loc (MSG_NOTE, vect_location, TDF_SLIM, pattern_stmt, 0);
VEC_safe_push (gimple, heap, *stmts, last_stmt);
......@@ -912,7 +912,7 @@ vect_recog_widen_sum_pattern (VEC (gimple, heap) **stmts, tree *type_in,
pattern_stmt = gimple_build_assign_with_ops (WIDEN_SUM_EXPR, var,
oprnd0, oprnd1);
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
{
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"vect_recog_widen_sum_pattern: detected: ");
......@@ -1217,7 +1217,7 @@ vect_recog_over_widening_pattern (VEC (gimple, heap) **stmts,
STMT_VINFO_RELATED_STMT (vinfo_for_stmt (stmt)) = pattern_stmt;
new_pattern_def_seq (vinfo_for_stmt (stmt), new_def_stmt);
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
{
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"created pattern stmt: ");
......@@ -1285,7 +1285,7 @@ vect_recog_over_widening_pattern (VEC (gimple, heap) **stmts,
return NULL;
/* Pattern detected. */
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
{
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"vect_recog_over_widening_pattern: detected: ");
......@@ -1421,7 +1421,7 @@ vect_recog_widen_shift_pattern (VEC (gimple, heap) **stmts,
return NULL;
/* Pattern detected. */
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"vect_recog_widen_shift_pattern: detected: ");
......@@ -1445,7 +1445,7 @@ vect_recog_widen_shift_pattern (VEC (gimple, heap) **stmts,
pattern_stmt =
gimple_build_assign_with_ops (WIDEN_LSHIFT_EXPR, var, oprnd0, oprnd1);
if (dump_kind_p (MSG_NOTE))
if (dump_enabled_p ())
dump_gimple_stmt_loc (MSG_NOTE, vect_location, TDF_SLIM, pattern_stmt, 0);
VEC_safe_push (gimple, heap, *stmts, last_stmt);
......@@ -1567,7 +1567,7 @@ vect_recog_vector_vector_shift_pattern (VEC (gimple, heap) **stmts,
}
/* Pattern detected. */
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"vect_recog_vector_vector_shift_pattern: detected: ");
......@@ -1575,7 +1575,7 @@ vect_recog_vector_vector_shift_pattern (VEC (gimple, heap) **stmts,
var = vect_recog_temp_ssa_var (TREE_TYPE (oprnd0), NULL);
pattern_stmt = gimple_build_assign_with_ops (rhs_code, var, oprnd0, def);
if (dump_kind_p (MSG_NOTE))
if (dump_enabled_p ())
dump_gimple_stmt_loc (MSG_NOTE, vect_location, TDF_SLIM, pattern_stmt, 0);
VEC_safe_push (gimple, heap, *stmts, last_stmt);
......@@ -1685,7 +1685,7 @@ vect_recog_divmod_pattern (VEC (gimple, heap) **stmts,
return NULL;
/* Pattern detected. */
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"vect_recog_divmod_pattern: detected: ");
......@@ -1789,7 +1789,7 @@ vect_recog_divmod_pattern (VEC (gimple, heap) **stmts,
signmask);
}
if (dump_kind_p (MSG_NOTE))
if (dump_enabled_p ())
dump_gimple_stmt_loc (MSG_NOTE, vect_location, TDF_SLIM, pattern_stmt,
0);
......@@ -2031,7 +2031,7 @@ vect_recog_divmod_pattern (VEC (gimple, heap) **stmts,
}
/* Pattern detected. */
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
{
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"vect_recog_divmod_pattern: detected: ");
......@@ -2199,7 +2199,7 @@ vect_recog_mixed_size_cond_pattern (VEC (gimple, heap) **stmts, tree *type_in,
*type_in = vecitype;
*type_out = vectype;
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"vect_recog_mixed_size_cond_pattern: detected: ");
......@@ -2592,7 +2592,7 @@ vect_recog_bool_pattern (VEC (gimple, heap) **stmts, tree *type_in,
*type_out = vectype;
*type_in = vectype;
VEC_safe_push (gimple, heap, *stmts, last_stmt);
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"vect_recog_bool_pattern: detected: ");
......@@ -2638,7 +2638,7 @@ vect_recog_bool_pattern (VEC (gimple, heap) **stmts, tree *type_in,
*type_out = vectype;
*type_in = vectype;
VEC_safe_push (gimple, heap, *stmts, last_stmt);
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"vect_recog_bool_pattern: detected: ");
return pattern_stmt;
......@@ -2788,7 +2788,7 @@ vect_pattern_recog_1 (vect_recog_func_ptr vect_recog_func,
}
/* Found a vectorizable pattern. */
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
{
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"pattern recognized: ");
......@@ -2814,7 +2814,7 @@ vect_pattern_recog_1 (vect_recog_func_ptr vect_recog_func,
{
stmt_info = vinfo_for_stmt (stmt);
pattern_stmt = STMT_VINFO_RELATED_STMT (stmt_info);
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
{
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"additional pattern stmt: ");
......@@ -2915,7 +2915,7 @@ vect_pattern_recog (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
VEC (gimple, heap) *stmts_to_replace = VEC_alloc (gimple, heap, 1);
gimple stmt;
if (dump_kind_p (MSG_NOTE))
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"=== vect_pattern_recog ===");
......
......@@ -107,7 +107,7 @@ vectorize_loops (void)
loop_vec_info loop_vinfo;
vect_location = find_loop_location (loop);
if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOC
&& dump_kind_p (MSG_ALL))
&& dump_enabled_p ())
dump_printf (MSG_ALL, "\nAnalyzing loop at %s:%d\n",
LOC_FILE (vect_location), LOC_LINE (vect_location));
......@@ -118,7 +118,7 @@ vectorize_loops (void)
continue;
if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOC
&& dump_kind_p (MSG_ALL))
&& dump_enabled_p ())
dump_printf (MSG_ALL, "\n\nVectorizing loop at %s:%d\n",
LOC_FILE (vect_location), LOC_LINE (vect_location));
vect_transform_loop (loop_vinfo);
......@@ -128,8 +128,8 @@ vectorize_loops (void)
vect_location = UNKNOWN_LOC;
statistics_counter_event (cfun, "Vectorized loops", num_vectorized_loops);
if (dump_kind_p (MSG_ALL)
|| (num_vectorized_loops > 0 && dump_kind_p (MSG_ALL)))
if (dump_enabled_p ()
|| (num_vectorized_loops > 0 && dump_enabled_p ()))
dump_printf_loc (MSG_ALL, vect_location,
"vectorized %u loops in function.\n",
num_vectorized_loops);
......@@ -170,7 +170,7 @@ execute_vect_slp (void)
if (vect_slp_analyze_bb (bb))
{
vect_slp_transform_bb (bb);
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS))
if (dump_enabled_p ())
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
"basic block vectorized using SLP\n");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment