Commit 6946b3f7 by Jan Hubicka Committed by Jan Hubicka

Makefile.in: Add dependencies.

	
	* Makefile.in: Add dependencies.
	* tree-pretty-print.c: Include value-prof.h
	(dump_generic_bb_buff): Dump histograms
	* value-prof.c: Include pointer-set.h
	(gimple_alloc_histogram_value, histogram_hash, histogram_eq,
	set_histogram_value, gimple_histogram_value,
	gimple_add_histogram_value, gimple_remove_histogram_value,
	gimple_histogram_value_of_type, dump_histogram_value,
	dump_histograms_for_stmt, gimple_remove_stmt_histograms,
	gimple_duplicate_stmt_histograms, visit_hist,
	verify_histograms): New functions.
	(tree_value_profile_transformations): Update for new histogram API.
	(tree_divmod_fixed_value): Update for new histogram API.
	(tree_divmod_fixed_value_transform): Update for new histogram API.
	(tree_mod_pow2): Update for new histogram API.
	(tree_mod_pow2_value_transform): Update for new histogram API.
	(tree_mod_subtract): Update for new histogram API.
	(tree_mod_subtract_transform): Update for new histogram API.
	(tree_stringops_transform): Update for new histogram API.
	(tree_divmod_values_to_profile): Update for new histogram API.
	(tree_stringops_values_to_profile): Update for new histogram API.
	(tree_find_values_to_profile): Update for new histogram API.
	* value-prof.h (gimple_histogram_value): Declare.
	(gimple_histogram_value_of_type): Declare.
	(gimple_add_histogram_value): Declare.
	(gimple_remove_histogram_value): Declare.
	(dump_histograms_for_stmt): Declare.
	(gimple_remove_histogram_value): Declare.
	(gimple_remove_stmt_histograms): Declare.
	(gimple_duplicate_stmt_histograms): Declare.
	(verify_histograms): Declare.
	* function.h
	(struct funrction): Add value_histograms hash.
	(VALUE_HISTOGRAMS): New macro.
	* profile.c (compute_value_histograms): update for new API.
	* tree-inline.c: Include value-prof.h
	(copy_bb): Update histograms.
	* tree-flow.h (struct stmt_ann_d): Do not contain pointer to histograms;
	reorder to get smaller memory layout.
	* tree-cfg.c: Include value-prof.h
	(bsi_remove): Update histograms.
	(bsi_replace): Update histograms.
	(verify_stmts): Call histogram verifier.
	(tree_duplicate_bb): Update histograms.
	(move_block_to_fn): Update histograms.

From-SVN: r119829
parent a22831b1
2006-12-13 Jan Hubicka <jh@suse.cz>
* Makefile.in: Add dependencies.
* tree-pretty-print.c: Include value-prof.h
(dump_generic_bb_buff): Dump histograms
* value-prof.c: Include pointer-set.h
(gimple_alloc_histogram_value, histogram_hash, histogram_eq,
set_histogram_value, gimple_histogram_value,
gimple_add_histogram_value, gimple_remove_histogram_value,
gimple_histogram_value_of_type, dump_histogram_value,
dump_histograms_for_stmt, gimple_remove_stmt_histograms,
gimple_duplicate_stmt_histograms, visit_hist,
verify_histograms): New functions.
(tree_value_profile_transformations): Update for new histogram API.
(tree_divmod_fixed_value): Update for new histogram API.
(tree_divmod_fixed_value_transform): Update for new histogram API.
(tree_mod_pow2): Update for new histogram API.
(tree_mod_pow2_value_transform): Update for new histogram API.
(tree_mod_subtract): Update for new histogram API.
(tree_mod_subtract_transform): Update for new histogram API.
(tree_stringops_transform): Update for new histogram API.
(tree_divmod_values_to_profile): Update for new histogram API.
(tree_stringops_values_to_profile): Update for new histogram API.
(tree_find_values_to_profile): Update for new histogram API.
* value-prof.h (gimple_histogram_value): Declare.
(gimple_histogram_value_of_type): Declare.
(gimple_add_histogram_value): Declare.
(gimple_remove_histogram_value): Declare.
(dump_histograms_for_stmt): Declare.
(gimple_remove_histogram_value): Declare.
(gimple_remove_stmt_histograms): Declare.
(gimple_duplicate_stmt_histograms): Declare.
(verify_histograms): Declare.
* function.h
(struct funrction): Add value_histograms hash.
(VALUE_HISTOGRAMS): New macro.
* profile.c (compute_value_histograms): update for new API.
* tree-inline.c: Include value-prof.h
(copy_bb): Update histograms.
* tree-flow.h (struct stmt_ann_d): Do not contain pointer to histograms;
reorder to get smaller memory layout.
* tree-cfg.c: Include value-prof.h
(bsi_remove): Update histograms.
(bsi_replace): Update histograms.
(verify_stmts): Call histogram verifier.
(tree_duplicate_bb): Update histograms.
(move_block_to_fn): Update histograms.
2006-12-13 Richard Guenther <rguenther@suse.de>
* ipa-inline.c (cgraph_flatten_node): Replace leafify with
......
......@@ -1828,7 +1828,7 @@ tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(VARRAY_H) $(HASHTAB_H) $(SPLAY_TREE_H) toplev.h \
langhooks.h $(TREE_INLINE_H) $(CGRAPH_H) intl.h $(FUNCTION_H) $(TREE_GIMPLE_H) \
debug.h $(DIAGNOSTIC_H) $(TREE_FLOW_H) tree-iterator.h tree-mudflap.h \
ipa-prop.h
ipa-prop.h value-prof.h
print-tree.o : print-tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(GGC_H) langhooks.h $(REAL_H) tree-iterator.h
stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
......@@ -2127,7 +2127,8 @@ tree-nomudflap.o : $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TREE_INLINE_H) \
$(GGC_H) gt-tree-mudflap.h tree-pass.h toplev.h
tree-pretty-print.o : tree-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) $(DIAGNOSTIC_H) $(REAL_H) $(HASHTAB_H) $(TREE_FLOW_H) \
$(TM_H) coretypes.h tree-iterator.h tree-chrec.h langhooks.h tree-pass.h
$(TM_H) coretypes.h tree-iterator.h tree-chrec.h langhooks.h tree-pass.h \
value-prof.h
fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(FLAGS_H) $(REAL_H) toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) \
$(GGC_H) $(TM_P_H) langhooks.h $(MD5_H)
......@@ -2438,7 +2439,8 @@ cfghooks.o: cfghooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
cfgexpand.o : cfgexpand.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) \
coretypes.h $(TREE_DUMP_H) except.h langhooks.h tree-pass.h $(RTL_H) \
$(DIAGNOSTIC_H) toplev.h $(BASIC_BLOCK_H) $(FLAGS_H) debug.h $(PARAMS_H)
$(DIAGNOSTIC_H) toplev.h $(BASIC_BLOCK_H) $(FLAGS_H) debug.h $(PARAMS_H) \
value-prof.h
cfgrtl.o : cfgrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
output.h toplev.h $(FUNCTION_H) except.h $(TM_P_H) insn-config.h $(EXPR_H) \
......
......@@ -40,6 +40,7 @@ Boston, MA 02110-1301, USA. */
#include "debug.h"
#include "params.h"
#include "tree-inline.h"
#include "value-prof.h"
/* Verify that there is exactly single jump instruction since last and attach
REG_BR_PROB note specifying probability.
......@@ -1860,6 +1861,7 @@ tree_expand_cfg (void)
/* After expanding, the return labels are no longer needed. */
return_label = NULL;
naked_return_label = NULL;
free_histograms ();
return 0;
}
......
......@@ -195,6 +195,9 @@ struct function GTY(())
/* The loops in this function. */
struct loops * GTY((skip)) x_current_loops;
/* Value histograms attached to particular statements. */
htab_t GTY((skip)) value_histograms;
/* For function.c. */
/* Points to the FUNCTION_DECL of this function. */
......@@ -532,6 +535,7 @@ extern int trampolines_created;
#define temp_slot_level (cfun->x_temp_slot_level)
#define nonlocal_goto_handler_labels (cfun->x_nonlocal_goto_handler_labels)
#define current_loops (cfun->x_current_loops)
#define VALUE_HISTOGRAMS(fun) (fun)->value_histograms
/* Given a function decl for a containing function,
return the `struct function' for it. */
......
......@@ -648,15 +648,13 @@ compute_value_histograms (histogram_values values)
{
histogram_value hist = VEC_index (histogram_value, values, i);
tree stmt = hist->hvalue.stmt;
stmt_ann_t ann = get_stmt_ann (stmt);
t = (int) hist->type;
aact_count = act_count[t];
act_count[t] += hist->n_counters;
hist->hvalue.next = ann->histograms;
ann->histograms = hist;
gimple_add_histogram_value (cfun, stmt, hist);
hist->hvalue.counters = XNEWVEC (gcov_type, hist->n_counters);
for (j = 0; j < hist->n_counters; j++)
hist->hvalue.counters[j] = aact_count[j];
......
......@@ -46,6 +46,7 @@ Boston, MA 02110-1301, USA. */
#include "cfglayout.h"
#include "hashtab.h"
#include "tree-ssa-propagate.h"
#include "value-prof.h"
/* This file contains functions for building the Control Flow Graph (CFG)
for a function tree. */
......@@ -2871,7 +2872,10 @@ bsi_remove (block_stmt_iterator *i, bool remove_eh_info)
tsi_delink (&i->tsi);
mark_stmt_modified (t);
if (remove_eh_info)
remove_stmt_from_eh_region (t);
{
remove_stmt_from_eh_region (t);
gimple_remove_stmt_histograms (cfun, t);
}
}
......@@ -2934,6 +2938,8 @@ bsi_replace (const block_stmt_iterator *bsi, tree stmt, bool update_eh_info)
{
remove_stmt_from_eh_region (orig_stmt);
add_stmt_to_eh_region (stmt, eh_region);
gimple_duplicate_stmt_histograms (cfun, stmt, cfun, orig_stmt);
gimple_remove_stmt_histograms (cfun, orig_stmt);
}
}
......@@ -3671,6 +3677,7 @@ verify_stmts (void)
internal_error ("verify_stmts failed");
htab_delete (htab);
verify_histograms ();
timevar_pop (TV_TREE_STMT_VERIFY);
}
......@@ -4342,6 +4349,7 @@ tree_duplicate_bb (basic_block bb)
region = lookup_stmt_eh_region (stmt);
if (region >= 0)
add_stmt_to_eh_region (copy, region);
gimple_duplicate_stmt_histograms (cfun, copy, cfun, stmt);
/* Create new names for all the definitions created by COPY and
add replacement mappings for each new name. */
......@@ -4785,6 +4793,8 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
{
add_stmt_to_eh_region_fn (dest_cfun, stmt, region + eh_offset);
remove_stmt_from_eh_region (stmt);
gimple_duplicate_stmt_histograms (dest_cfun, stmt, cfun, stmt);
gimple_remove_stmt_histograms (cfun, stmt);
}
}
}
......
......@@ -356,17 +356,6 @@ struct stmt_ann_d GTY(())
{
struct tree_ann_common_d common;
/* Nonzero if the statement has been modified (meaning that the operands
need to be scanned again). */
unsigned modified : 1;
/* Nonzero if the statement makes references to volatile storage. */
unsigned has_volatile_ops : 1;
/* Nonzero if the statement makes a function call that may clobber global
and local addressable variables. */
unsigned makes_clobbering_call : 1;
/* Nonzero if the statement references memory (at least one of its
expressions contains a non-register operand). */
unsigned references_memory : 1;
......@@ -385,11 +374,16 @@ struct stmt_ann_d GTY(())
pass which needs statement UIDs. */
unsigned int uid;
/* Linked list of histograms for value-based profiling. This is really a
struct histogram_value*. We use void* to avoid having to export that
everywhere, and to avoid having to put it in GC memory. */
void * GTY ((skip (""))) histograms;
/* Nonzero if the statement has been modified (meaning that the operands
need to be scanned again). */
unsigned modified : 1;
/* Nonzero if the statement makes references to volatile storage. */
unsigned has_volatile_ops : 1;
/* Nonzero if the statement makes a function call that may clobber global
and local addressable variables. */
unsigned makes_clobbering_call : 1;
};
union tree_ann_d GTY((desc ("ann_type ((tree_ann_t)&%h)")))
......
......@@ -49,6 +49,7 @@ Boston, MA 02110-1301, USA. */
#include "debug.h"
#include "pointer-set.h"
#include "ipa-prop.h"
#include "value-prof.h"
/* I'm not real happy about this, but we need to handle gimple and
non-gimple trees. */
......@@ -707,6 +708,8 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, int count_scal
{
tree call, decl;
gimple_duplicate_stmt_histograms (cfun, stmt, id->src_cfun, orig_stmt);
/* With return slot optimization we can end up with
non-gimple (foo *)&this->m, fix that here. */
if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
......
......@@ -33,6 +33,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "tree-iterator.h"
#include "tree-chrec.h"
#include "tree-pass.h"
#include "value-prof.h"
/* Local functions, macros and variables. */
static int op_prio (tree);
......@@ -3000,6 +3001,7 @@ dump_generic_bb_buff (pretty_printer *buffer, basic_block bb,
INDENT (curr_indent);
dump_generic_node (buffer, stmt, curr_indent, flags, true);
pp_newline (buffer);
dump_histograms_for_stmt (cfun, buffer->buffer->stream, stmt);
}
dump_implicit_edges (buffer, bb, indent, flags);
......
......@@ -96,6 +96,17 @@ struct profile_hooks {
void (*gen_const_delta_profiler) (histogram_value, unsigned, unsigned);
};
histogram_value gimple_histogram_value (struct function *, tree);
histogram_value gimple_histogram_value_of_type (struct function *, tree, enum hist_type);
void gimple_add_histogram_value (struct function *, tree, histogram_value);
void gimple_remove_histogram_value (struct function *, tree, histogram_value);
void dump_histograms_for_stmt (struct function *, FILE *, tree);
void gimple_remove_histogram_value (struct function *, tree, histogram_value);
void gimple_remove_stmt_histograms (struct function *, tree);
void gimple_duplicate_stmt_histograms (struct function *, tree, struct function *, tree);
void verify_histograms (void);
void free_histograms (void);
/* In profile.c. */
extern void init_branch_prob (void);
extern void branch_prob (void);
......
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