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. */
/*
* 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. */
/**
* 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. */
/**
* 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. */
/**
* An address entry.
*/
-typedef struct _addr_entry_t {
+typedef struct addr_entry_t {
void *addr; /**< the address */
unsigned id; /**< associated ID */
} addr_entry_t;
return e1->addr != e2->addr;
} /* addr_cmp */
+static unsigned find_mode_index(const ir_mode *mode)
+{
+ int n = get_irp_n_modes();
+ int i;
+
+ for (i = 0; i < n; ++i) {
+ if (get_irp_mode(i) == mode)
+ return i;
+ }
+ return -1;
+}
+
/**
* Encodes an IR-node, recursive worker.
*
ir_mode *mode = get_irn_mode(node);
if (mode)
- put_code(env->buf, stat_find_mode_index(mode));
+ put_code(env->buf, find_mode_index(mode));
else
put_tag(env->buf, VLC_TAG_EMPTY);
} /* if */
/* 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);
/**
* 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;