execfreq calculation fails in case of unreachable code
[libfirm] / ir / tv / tv.c
index 6791747..60f5722 100644 (file)
@@ -77,11 +77,11 @@ static float_to_int_mode current_float_to_int_mode = TRUNCATE;
 #  define TARVAL_VERIFY(a) ((void)0)
 #endif
 
-#define INSERT_TARVAL(tv) ((ir_tarval*)set_insert(tarvals, (tv), sizeof(ir_tarval), hash_tv((tv))))
-#define FIND_TARVAL(tv) ((ir_tarval*)set_find(tarvals, (tv), sizeof(ir_tarval), hash_tv((tv))))
+#define INSERT_TARVAL(tv) (set_insert(ir_tarval, tarvals, (tv), sizeof(ir_tarval), hash_tv((tv))))
+#define FIND_TARVAL(tv) (set_find(ir_tarval, tarvals, (tv), sizeof(ir_tarval), hash_tv((tv))))
 
-#define INSERT_VALUE(val, size) (set_insert(values, (val), size, hash_val((val), size)))
-#define FIND_VALUE(val, size) (set_find(values, (val), size, hash_val((val), size)))
+#define INSERT_VALUE(val, size) (set_insert(char, values, (val), size, hash_val((val), size)))
+#define FIND_VALUE(val, size) (set_find(char, values, (val), size, hash_val((val), size)))
 
 #define fail_verify(a) _fail_verify((a), __FILE__, __LINE__)
 
@@ -199,7 +199,7 @@ static ir_tarval *get_tarval(const void *value, size_t length, ir_mode *mode)
        }
        /* if there is such a tarval, it is returned, else tv is copied
         * into the set */
-       return (ir_tarval *)INSERT_TARVAL(&tv);
+       return INSERT_TARVAL(&tv);
 }
 
 /**
@@ -344,6 +344,10 @@ static ir_tarval *new_tarval_from_str_int(const char *str, size_t len,
                        str += 2;
                        len -= 2;
                        base = 16;
+               } else if (str[1] == 'b' || str[1] == 'B') {
+                       str += 2;
+                       len -= 2;
+                       base = 2;
                } else {
                        ++str;
                        --len;
@@ -636,7 +640,7 @@ ir_tarval *get_tarval_all_one(ir_mode *mode)
 
 int tarval_is_constant(ir_tarval *tv)
 {
-       int num_res = sizeof(reserved_tv) / sizeof(reserved_tv[0]);
+       size_t const num_res = ARRAY_SIZE(reserved_tv);
 
        /* reserved tarvals are NOT constants. Note that although
           tarval_b_true and tarval_b_false are reserved, they are constants of course. */
@@ -1484,9 +1488,10 @@ unsigned char get_tarval_sub_bits(ir_tarval *tv, unsigned byte_ofs)
        case irma_twos_complement:
                return sc_sub_bits(tv->value, get_mode_size_bits(tv->mode), byte_ofs);
        case irma_ieee754:
+       case irma_x86_extended_float:
                return fc_sub_bits((const fp_value*) tv->value, get_mode_size_bits(tv->mode), byte_ofs);
        default:
-               panic("get_tarval_sub_bits(): arithmetic mode not supported");
+               panic("arithmetic mode not supported");
        }
 }