#include "pset.h"
#include "counter.h"
#include "pattern_dmp.h"
+#include "hashptr.h"
/*
* just be make some things clear :-), the
* 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)
{
/**
* 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;
}
/**
- * 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)
{
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
*/
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) {
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);
}
/*
- * initialises the pattern history
+ * initializes the pattern history
*/
void stat_init_pattern_history(int enable)
{