X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fstat%2Fpattern.c;h=fa8fcdeb667c16337dd0d308bd6adbe10b6d3ca6;hb=7fc5212efdd0faf06fed3850760ca319bdc66afc;hp=871e12e26d6c7b186d28feff585515a114fcde1d;hpb=a7b0fcb597948823737e6d65f0adaa79f0bc8eef;p=libfirm diff --git a/ir/stat/pattern.c b/ir/stat/pattern.c index 871e12e26..fa8fcdeb6 100644 --- a/ir/stat/pattern.c +++ b/ir/stat/pattern.c @@ -54,13 +54,13 @@ typedef pset pset_pattern_entry_t; typedef unsigned char BYTE; /** Maximum size of the pattern store. */ -#define PATTERN_STORE_SIZE 2048 +#define PATTERN_STORE_SIZE 2048 /** * The code buffer. */ -typedef struct _code_buf_t { +typedef struct code_buf_t { BYTE *next; /**< Next byte address to be written. */ BYTE *end; /**< End address of the buffer. */ BYTE *start; /**< Start address of the buffer. */ @@ -89,7 +89,7 @@ enum vlc_code_t { /* * An entry for holding one pattern. */ -typedef struct _pattern_entry_t { +typedef struct pattern_entry_t { counter_t count; /**< Amount of pattern occurance. */ unsigned len; /**< The length of the VLC encoded buffer. */ BYTE buf[1]; /**< The buffer containing the VLC encoded pattern. */ @@ -109,7 +109,7 @@ enum options_t { /** * Pattern info. */ -typedef struct _pattern_info_t { +typedef struct pattern_info_t { int enable; /**< If non-zero, this module is enabled. */ struct obstack obst; /**< An obstack containing the counters. */ HASH_MAP(pattern_entry_t) *pattern_hash; /**< A hash map containing the pattern. */ @@ -145,8 +145,8 @@ static int pattern_count_cmp(const void *elt, const void *key) */ static int pattern_cmp(const void *elt, const void *key) { - const pattern_entry_t *e1 = elt; - const pattern_entry_t *e2 = key; + const pattern_entry_t *e1 = (const pattern_entry_t*)elt; + const pattern_entry_t *e2 = (const pattern_entry_t*)key; int diff = e1->len - e2->len; if (diff) @@ -367,7 +367,7 @@ static BYTE next_tag(CODE_BUFFER *buf) /** * An Environment for the pattern encoder. */ -typedef struct _codec_enc_t { +typedef struct codec_enc_t { CODE_BUFFER *buf; /**< The current code buffer. */ set *id_set; /**< A set containing all already seen Firm nodes. */ unsigned curr_id; /**< The current node id. */ @@ -378,7 +378,7 @@ typedef struct _codec_enc_t { /** * An address entry. */ -typedef struct _addr_entry_t { +typedef struct addr_entry_t { void *addr; /**< the address */ unsigned id; /**< associated ID */ } addr_entry_t; @@ -388,8 +388,8 @@ typedef struct _addr_entry_t { */ static int addr_cmp(const void *p1, const void *p2, size_t size) { - const addr_entry_t *e1 = p1; - const addr_entry_t *e2 = p2; + const addr_entry_t *e1 = (const addr_entry_t*)p1; + const addr_entry_t *e2 = (const addr_entry_t*)p2; (void) size; return e1->addr != e2->addr; @@ -419,7 +419,7 @@ static int _encode_node(ir_node *node, int max_depth, codec_env_t *env) int i, preds; int res, depth; - ir_opcode code = get_irn_opcode(node); + unsigned code = get_irn_opcode(node); /* insert the node into our ID map */ entry.addr = node; @@ -454,7 +454,7 @@ static int _encode_node(ir_node *node, int max_depth, codec_env_t *env) /* do we need integer constants */ if (env->options & OPT_WITH_ICONST) { if (code == iro_Const) { - tarval *tv = get_Const_tarval(node); + ir_tarval *tv = get_Const_tarval(node); if (tarval_is_long(tv)) { long v = get_tarval_long(tv); @@ -659,7 +659,7 @@ static void decode_node(BYTE *b, unsigned len, pattern_dumper_t *dump) /** * The environment for the pattern calculation. */ -typedef struct _pattern_env { +typedef struct pattern_env { int max_depth; /**< maximum depth for pattern generation. */ } pattern_env_t; @@ -686,14 +686,14 @@ static pattern_entry_t *pattern_get_entry(CODE_BUFFER *buf, pset *set) hash = buf_hash(buf); - elem = pset_find(set, key, hash); + elem = (pattern_entry_t*)pset_find(set, key, hash); if (elem != NULL) { obstack_free(&status->obst, key); return elem; } /* if */ cnt_clr(&key->count); - return pset_insert(set, key, hash); + return (pattern_entry_t*)pset_insert(set, key, hash); } /* pattern_get_entry */ /** @@ -722,7 +722,7 @@ static void count_pattern(CODE_BUFFER *buf, int depth) */ static void calc_nodes_pattern(ir_node *node, void *ctx) { - pattern_env_t *env = ctx; + pattern_env_t *env = (pattern_env_t*)ctx; BYTE buffer[PATTERN_STORE_SIZE]; CODE_BUFFER buf; int depth; @@ -759,9 +759,9 @@ static void store_pattern(const char *fname) fwrite("FPS1", 4, 1, f); fwrite(&count, sizeof(count), 1, f); - for (i = 0, entry = pset_first(status->pattern_hash); + for (i = 0, entry = (pattern_entry_t*)pset_first(status->pattern_hash); entry && i < count; - entry = pset_next(status->pattern_hash), ++i) { + entry = (pattern_entry_t*)pset_next(status->pattern_hash), ++i) { fwrite(entry, offsetof(pattern_entry_t, buf) + entry->len, 1, f); } /* for */ fclose(f); @@ -836,9 +836,9 @@ static void pattern_output(const char *fname) dump = new_vcg_dumper(fname, 100); pattern_arr = XMALLOCN(pattern_entry_t*, count); - for (i = 0, entry = pset_first(status->pattern_hash); + for (i = 0, entry = (pattern_entry_t*)pset_first(status->pattern_hash); entry && i < count; - entry = pset_next(status->pattern_hash), ++i) { + entry = (pattern_entry_t*)pset_next(status->pattern_hash), ++i) { pattern_arr[i] = entry; } /* for */ assert(count == i);