X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fstat%2Fpattern.c;h=f1b712d5659f9991a85b11f0e6a20bcc2322a94c;hb=24a8ed9b437fa2ff3734c3dc8ea5c8fbe7fba45c;hp=33a09e55ea326bcfc2d3a75cfd42b0d992cb9763;hpb=86c386304826a15ea0e418c525a125f7aee385ee;p=libfirm diff --git a/ir/stat/pattern.c b/ir/stat/pattern.c index 33a09e55e..f1b712d56 100644 --- a/ir/stat/pattern.c +++ b/ir/stat/pattern.c @@ -13,6 +13,7 @@ #include "pset.h" #include "counter.h" #include "pattern_dmp.h" +#include "hashptr.h" /* * just be make some things clear :-), the @@ -57,9 +58,9 @@ enum vlc_code_t { * 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; /** @@ -76,11 +77,11 @@ enum options_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; /* @@ -89,7 +90,7 @@ typedef struct _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) { @@ -120,7 +121,7 @@ static int pattern_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) { @@ -132,7 +133,7 @@ static void init_buf(CODE_BUFFER *buf, BYTE *data, unsigned len) /** * put a byte into the buffer */ -static INLINE void put_byte(CODE_BUFFER *buf, BYTE byte) +static INLINE void put_byte(CODE_BUFFER *buf, unsigned byte) { if (buf->next < buf->end) { unsigned hash = buf->hash; @@ -144,7 +145,7 @@ static INLINE void put_byte(CODE_BUFFER *buf, BYTE byte) } /** - * returns the current lenght of a buffer + * returns the current length of a buffer */ static unsigned buf_lenght(const CODE_BUFFER *buf) { @@ -152,7 +153,7 @@ 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) { @@ -296,14 +297,6 @@ typedef struct _addr_entry_t { unsigned id; /**< associated ID */ } addr_entry_t; -/** - * hash value of an address - */ -static INLINE unsigned addr_hash(void *addr) -{ - return ((unsigned)addr) >> 3; -} - /** * compare two addresses */ @@ -332,7 +325,7 @@ static int _encode_node(ir_node *node, int max_depth, codec_env_t *env) entry.addr = node; entry.id = env->curr_id; - s_entry = set_hinsert(env->id_set, &entry, sizeof(entry), addr_hash(node)); + s_entry = set_hinsert(env->id_set, &entry, sizeof(entry), HASH_PTR(node)); r_entry = (addr_entry_t *)s_entry->dptr; if (r_entry->id != env->curr_id) { @@ -354,6 +347,7 @@ static int _encode_node(ir_node *node, int max_depth, codec_env_t *env) ir_mode *mode = get_irn_mode(node); if (mode) + /* FIXME: not 64bit save */ put_code(env->buf, (unsigned)mode); else put_tag(env->buf, VLC_TAG_EMPTY); @@ -365,7 +359,7 @@ static int _encode_node(ir_node *node, int max_depth, codec_env_t *env) tarval *tv = get_Const_tarval(node); if (tarval_is_long(tv)) { - long v = tarval_to_long(tv); + long v = get_tarval_long(tv); put_tag(env->buf, VLC_TAG_ICONST); put_code(env->buf, v); @@ -662,7 +656,7 @@ void stat_calc_pattern_history(ir_graph *irg) } /* - * initialises the pattern history + * initializes the pattern history */ void stat_init_pattern_history(int enable) {