DBG_OPT_SYNC added
[libfirm] / ir / stat / const_stat.c
index 3fa94cc..8b5c4f4 100644 (file)
@@ -16,7 +16,7 @@ static stat_info_t *status;
 /**
  * calculated the dual logarithmus of |value|
  */
-static unsigned log2(long value) {
+static unsigned log2abs(long value) {
   unsigned res = 0;
 
   if (value < 0)
@@ -88,7 +88,12 @@ void stat_update_const(stat_info_t *status, ir_node *node, graph_entry_t *graph)
 
   if (mode_is_int(mode)) {
     tv   = get_Const_tarval(node);
-    bits = log2(get_tarval_long(tv));
+
+    /* FIXME: */
+    if (! tarval_is_long(tv))
+      return;
+
+    bits = log2abs(get_tarval_long(tv));
 
     if (bits > ARR_SIZE(status->const_info.int_bits_count))
       bits = ARR_SIZE(status->const_info.int_bits_count);