# 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__)
}
/* 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);
}
/**
str += 2;
len -= 2;
base = 16;
+ } else if (str[1] == 'b' || str[1] == 'B') {
+ str += 2;
+ len -= 2;
+ base = 2;
} else {
++str;
--len;
return get_tarval(sc_get_buffer(), sc_get_buffer_length(), a->mode);
}
+ir_tarval *tarval_shl_unsigned(ir_tarval *a, unsigned b)
+{
+ ir_mode *mode = a->mode;
+ unsigned modulo = get_mode_modulo_shift(mode);
+ if (modulo != 0)
+ b %= modulo;
+ assert((unsigned)(long)b==b);
+ sc_shlI(a->value, (long)b, get_mode_size_bits(mode), mode_is_signed(mode), NULL);
+ return get_tarval(sc_get_buffer(), sc_get_buffer_length(), mode);
+}
+
/*
* bitwise unsigned right shift
*/
return get_tarval(sc_get_buffer(), sc_get_buffer_length(), a->mode);
}
+ir_tarval *tarval_shr_unsigned(ir_tarval *a, unsigned b)
+{
+ ir_mode *mode = a->mode;
+ unsigned modulo = get_mode_modulo_shift(mode);
+ if (modulo != 0)
+ b %= modulo;
+ assert((unsigned)(long)b==b);
+ sc_shrI(a->value, (long)b, get_mode_size_bits(mode), mode_is_signed(mode), NULL);
+ return get_tarval(sc_get_buffer(), sc_get_buffer_length(), mode);
+}
+
/*
* bitwise signed right shift
*/
return get_tarval(sc_get_buffer(), sc_get_buffer_length(), a->mode);
}
+ir_tarval *tarval_shrs_unsigned(ir_tarval *a, unsigned b)
+{
+ ir_mode *mode = a->mode;
+ unsigned modulo = get_mode_modulo_shift(mode);
+ if (modulo != 0)
+ b %= modulo;
+ assert((unsigned)(long)b==b);
+ sc_shrsI(a->value, (long)b, get_mode_size_bits(mode), mode_is_signed(mode), NULL);
+ return get_tarval(sc_get_buffer(), sc_get_buffer_length(), mode);
+}
+
/*
* bitwise rotation to left
*/
}
default:
- return snprintf(buf, len, "<TV_??""?>");
+ if (tv == tarval_bad)
+ return snprintf(buf, len, "<TV_BAD>");
+ else if (tv == tarval_undefined)
+ return snprintf(buf, len, "<TV_UNDEFINED>");
+ else if (tv == tarval_reachable)
+ return snprintf(buf, len, "<TV_REACHABLE>");
+ else if (tv == tarval_unreachable)
+ return snprintf(buf, len, "<TV_UNREACHABLE>");
+ else
+ return snprintf(buf, len, "<TV_??""?>");
}
}
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");
}
}