#define set_irn_dag_entry(n, e) set_irn_link(n, e)
/**
- * checks wheater a node is an arg
+ * checks wether a node is an arg
*/
static int is_arg(ir_node *node)
{
set_irn_dag_entry(node, entry);
}
- /* if this option is set, Loads are onways leaves */
+ /* if this option is set, Loads are allways leaves */
if (dag_env->options & FIRMSTAT_LOAD_IS_LEAVE && get_irn_op(node) == op_Load)
return;
#include "pattern.h"
#include "dags.h"
#include "stat_dmp.h"
+#include "xmalloc.h"
/*
* need this to be static:
*/
static ir_op _op_Phi0;
-/** The PhiM, just to count memorty Phi's. */
+/** The PhiM, just to count memory Phi's. */
static ir_op _op_PhiM;
/** The Mul by Const node. */
}
/**
- * Returns the acssociates graph_entry_t for an irg
+ * Returns the associated graph_entry_t for an irg
*/
static graph_entry_t *graph_get_entry(ir_graph *irg, pset *set)
{
}
/**
- * Returns the associates opt_entry_t for an ir_op
+ * Returns the associated opt_entry_t for an ir_op
*/
static opt_entry_t *opt_get_entry(const ir_op *op, pset *set)
{
}
/**
- * Returns the associates block_entry_t for an block
+ * Returns the associated block_entry_t for an block
*/
static block_entry_t *block_get_entry(long block_nr, pset *set)
{
ir_graph *callee = NULL;
/*
- * If the block is bad, the whole subgraph will colabse later
+ * If the block is bad, the whole subgraph will collapse later
* so do not count this call.
* This happens in dead code.
*/
ir_graph *callee = NULL;
/*
- * If the block is bad, the whole subgraph will colabse later
+ * If the block is bad, the whole subgraph will collapse later
* so do not count this call.
* This happens in dead code.
*/
}
/**
- * walker for reachable nodes count for graphs on teh wait_q
+ * walker for reachable nodes count for graphs on the wait_q
*/
static void update_node_stat_2(ir_node *node, void *env)
{
*/
static void stat_register_dumper(const dumper_t *dumper)
{
- dumper_t *p = malloc(sizeof(*p));
+ dumper_t *p = xmalloc(sizeof(*p));
if (p) {
*p = *dumper;
}
/**
- * initialise the dumper
+ * initialize the dumper
*/
static void stat_dump_init(const char *name)
{
}
}
- /* some calculations are dependant, we pushed them on the wait_q */
+ /* some calculations are dependent, we pushed them on the wait_q */
while (! pdeq_empty(status->wait_q)) {
entry = pdeq_getr(status->wait_q);
* Statistic options, can be or'ed.
*/
enum firmstat_options_t {
- FIRMSTAT_ENABLED = 0x00000001, /**< enable statistics */
- FIRMSTAT_PATTERN_ENABLED = 0x00000002, /**< enable pattern calculation */
- FIRMSTAT_COUNT_STRONG_OP = 0x00000004, /**< if set, count Mul/Div/Mod/DivMod by constant */
- FIRMSTAT_COUNT_DAG = 0x00000008, /**< if set, count DAG statistics */
- FIRMSTAT_COUNT_DELETED = 0x00000010, /**< if set, count deleted graphs */
- FIRMSTAT_CSV_OUTPUT = 0x10000000 /**< CSV output of some mini-statistic */
+ FIRMSTAT_ENABLED = 0x00000001, /**< enable statistics */
+ FIRMSTAT_PATTERN_ENABLED = 0x00000002, /**< enable pattern calculation */
+ FIRMSTAT_COUNT_STRONG_OP = 0x00000004, /**< if set, count Mul/Div/Mod/DivMod by constant */
+ FIRMSTAT_COUNT_DAG = 0x00000008, /**< if set, count DAG statistics */
+ FIRMSTAT_COUNT_DELETED = 0x00000010, /**< if set, count deleted graphs */
+ FIRMSTAT_CSV_OUTPUT = 0x10000000 /**< CSV output of some mini-statistic */
};
/**
#ifdef FIRM_STATISTICS
typedef enum {
- STAT_OPT_STG, /**< straightening optimization */
- STAT_OPT_IFSIM, /**< if simplification */
- STAT_OPT_CONST_EVAL, /**< constant evaluation */
- STAT_OPT_ALGSIM, /**< algebraic simplification */
- STAT_OPT_PHI, /**< Phi optmization */
- STAT_OPT_WAW, /**< Write-After-Write optimization */
- STAT_OPT_WAR, /**< Write-After-Read optimization */
- STAT_OPT_RAW, /**< Read-After-Write optimization */
- STAT_OPT_RAR, /**< Read-After-Read optimization */
- STAT_OPT_RC, /**< Read-a-Const optimization */
+ STAT_OPT_STG, /**< straightening optimization */
+ STAT_OPT_IFSIM, /**< if simplification */
+ STAT_OPT_CONST_EVAL, /**< constant evaluation */
+ STAT_OPT_ALGSIM, /**< algebraic simplification */
+ STAT_OPT_PHI, /**< Phi optmization */
+ STAT_OPT_WAW, /**< Write-After-Write optimization */
+ STAT_OPT_WAR, /**< Write-After-Read optimization */
+ STAT_OPT_RAW, /**< Read-After-Write optimization */
+ STAT_OPT_RAR, /**< Read-After-Read optimization */
+ STAT_OPT_RC, /**< Read-a-Const optimization */
STAT_OPT_TUPLE, /**< Tuple optimization */
- STAT_OPT_ID, /**< ID optimization */
- STAT_OPT_CSE, /**< common subexpression elimination */
- STAT_OPT_STRENGTH_RED, /**< strength reduction */
- STAT_OPT_ARCH_DEP, /**< architecture dependent optimization */
- STAT_OPT_REASSOC, /**< reassociation */
- STAT_OPT_POLY_CALL, /**< polymorphic call optimization */
- STAT_LOWERED, /**< lowered */
+ STAT_OPT_ID, /**< ID optimization */
+ STAT_OPT_CSE, /**< common subexpression elimination */
+ STAT_OPT_STRENGTH_RED,/**< strength reduction */
+ STAT_OPT_ARCH_DEP, /**< architecture dependent optimization */
+ STAT_OPT_REASSOC, /**< reassociation */
+ STAT_OPT_POLY_CALL, /**< polymorphic call optimization */
+ STAT_LOWERED, /**< lowered */
STAT_OPT_MAX
} stat_opt_kind;
/**
* initialize the statistics module.
*
- * @param enable_options Bitmask containing the statistic options
+ * @param enable_options a bitmask containing the statistic options
*/
void init_stat(unsigned enable_options);
* An entry for patterns
*/
typedef struct _pattern_entry_t {
- counter_t count; /**< amount of pattern occurance */
- unsigned len; /**< lenght of the VLC encoded buffer */
- BYTE buf[1]; /**< buffer contains the VLC encoded pattern */
+ counter_t count; /**< amount of pattern occurance */
+ unsigned len; /**< length of the VLC encoded buffer */
+ BYTE buf[1]; /**< buffer contains the VLC encoded pattern */
} pattern_entry_t;
/**
* pattern info
*/
typedef struct _pattern_info_t {
- int enable; /**< if non-zero, this module is enabled */
- struct obstack obst; /**< obstack containing the counters */
- HASH_MAP(pattern_entry_t) *pattern_hash; /**< hash map containing the counter for pattern */
- unsigned bound; /**< lowest value for output */
- unsigned options; /**< option mask */
+ int enable; /**< if non-zero, this module is enabled */
+ struct obstack obst; /**< obstack containing the counters */
+ HASH_MAP(pattern_entry_t) *pattern_hash; /**< hash map containing the counter for pattern */
+ unsigned bound; /**< lowest value for output */
+ unsigned options; /**< option mask */
} pattern_info_t;
/*
static pattern_info_t _status, *status = &_status;
/**
- * compare two elemnts for counter
+ * compare two elements for counter
*/
static int pattern_count_cmp(const void *elt, const void *key)
{
}
/**
- * initialise a code buffer
+ * initialize a code buffer
*/
static void init_buf(CODE_BUFFER *buf, BYTE *data, unsigned len)
{
}
/**
- * returns the current lenght of a buffer
+ * returns the current length of a buffer
*/
static unsigned buf_lenght(const CODE_BUFFER *buf)
{
}
/**
- * returns the current lenght of a buffer
+ * returns the current length of a buffer
*/
static const BYTE *buf_content(const CODE_BUFFER *buf)
{
}
/*
- * initialises the pattern history
+ * initializes the pattern history
*/
void stat_init_pattern_history(int enable)
{
void stat_calc_pattern_history(ir_graph *irg);
/**
- * initialises the pattern history.
+ * initializes the pattern history.
*
* @param enable Enable flag.
*/
}
/**
- * finishes childred dumper
+ * finishes the children dumper
*/
static void stdout_finish_children(pattern_dumper_t *self, unsigned id)
{
}
/*
- * finishes childred dumper
+ * finishes the children dumper
*/
void pattern_finish_children(pattern_dumper_t *self, unsigned id)
{
void pattern_start_children(pattern_dumper_t *self, unsigned id);
/**
- * finishes childred dumper
+ * finishes the children dumper
*/
void pattern_finish_children(pattern_dumper_t *self, unsigned id);
/**
- * finishes dumper, destroyes the dumper object
+ * finishes dumper, destroys the dumper object
*/
void pattern_end(pattern_dumper_t *self);
}
/**
- * dumps the endges count
+ * dumps the edges count
*/
static void simple_dump_edges(dumper_t *dmp, counter_t *cnt)
{
entry->cnt_walked.cnt[0], entry->cnt_walked_blocks.cnt[0],
entry->cnt_was_inlined.cnt[0],
entry->cnt_got_inlined.cnt[0],
- entry->cnt_strength_red.cnt[0],
- entry->is_leaf ? "YES" : "NO",
- entry->is_leaf_call == LCS_NON_LEAF_CALL ? "NO" : (entry->is_leaf_call == LCS_LEAF_CALL ? "Yes" : "Maybe"),
- entry->is_recursive ? "YES" : "NO",
- entry->is_chain_call ? "YES" : "NO",
+ entry->cnt_strength_red.cnt[0],
+ entry->is_leaf ? "YES" : "NO",
+ entry->is_leaf_call == LCS_NON_LEAF_CALL ? "NO" : (entry->is_leaf_call == LCS_LEAF_CALL ? "Yes" : "Maybe"),
+ entry->is_recursive ? "YES" : "NO",
+ entry->is_chain_call ? "YES" : "NO",
entry->cnt_all_calls.cnt[0],
entry->cnt_indirect_calls.cnt[0]
);
}
/**
- * initialise the simple dumper
+ * initialize the simple dumper
*/
static void simple_init(dumper_t *dmp, const char *name)
{
}
/**
- * initialise the simple dumper
+ * initialize the simple dumper
*/
static void csv_init(dumper_t *dmp, const char *name)
{
+#ifndef _STAT_DMP_H
+#define _STAT_DMP_H
+
#include "firmstat_t.h"
/**
* @note Limited capabilities, mostly for the Firm paper
*/
extern const dumper_t csv_dumper;
+
+#endif /* _STAT_DMP_H */