return get_tarval_overflow(buffer, sc_get_buffer_length(), mode);
}
-/*
- * Constructors =============================================================
- */
ir_tarval *new_tarval_from_str(const char *str, size_t len, ir_mode *mode)
{
const float_descriptor_t *desc;
}
}
-/*
- * helper function, create a tarval from long
- */
ir_tarval *new_tarval_from_long(long l, ir_mode *mode)
{
assert(mode);
}
}
-/* returns non-zero if can be converted to long */
int tarval_is_long(ir_tarval *tv)
{
if (!mode_is_int(tv->mode) && !mode_is_reference(tv->mode))
return 1;
}
-/* this might overflow the machine's long, so use only with small values */
long get_tarval_long(ir_tarval* tv)
{
assert(tarval_is_long(tv) && "tarval too big to fit in long");
return new_tarval_from_long_double(d, mode);
}
-/* returns non-zero if can be converted to double */
int tarval_is_double(ir_tarval *tv)
{
assert(tv);
return get_tarval_long_double(tv);
}
-
-/*
- * Access routines for tarval fields ========================================
- */
-
-/* get the mode of the tarval */
ir_mode *(get_tarval_mode)(const ir_tarval *tv)
{
return _get_tarval_mode(tv);
* Arithmetic operations on tarvals ========================================
*/
-/*
- * test if negative number, 1 means 'yes'
- */
int tarval_is_negative(ir_tarval *a)
{
switch (get_mode_sort(a->mode)) {
}
}
-/*
- * test if null, 1 means 'yes'
- */
int tarval_is_null(ir_tarval *a)
{
return
a == get_mode_null(get_tarval_mode(a));
}
-/*
- * test if one, 1 means 'yes'
- */
int tarval_is_one(ir_tarval *a)
{
return
tv == get_mode_all_one(get_tarval_mode(tv));
}
-/*
- * test if one, 1 means 'yes'
- */
int tarval_is_minus_one(ir_tarval *a)
{
return
a == get_mode_minus_one(get_tarval_mode(a));
}
-/*
- * comparison
- */
ir_relation tarval_cmp(ir_tarval *a, ir_tarval *b)
{
if (a == tarval_bad || b == tarval_bad) {
}
}
-/*
- * convert to other mode
- */
ir_tarval *tarval_convert_to(ir_tarval *src, ir_mode *dst_mode)
{
char *buffer;
return tarval_bad;
}
-/*
- * bitwise negation
- */
ir_tarval *tarval_not(ir_tarval *a)
{
char *buffer;
}
}
-/*
- * arithmetic negation
- */
ir_tarval *tarval_neg(ir_tarval *a)
{
char *buffer;
}
}
-/*
- * addition
- */
ir_tarval *tarval_add(ir_tarval *a, ir_tarval *b)
{
char *buffer;
}
}
-/*
- * subtraction
- */
ir_tarval *tarval_sub(ir_tarval *a, ir_tarval *b, ir_mode *dst_mode)
{
char *buffer;
}
}
-/*
- * multiplication
- */
ir_tarval *tarval_mul(ir_tarval *a, ir_tarval *b)
{
char *buffer;
}
}
-/*
- * division
- * overflow is impossible, but look out for division by zero
- */
ir_tarval *tarval_div(ir_tarval *a, ir_tarval *b)
{
ir_mode *mode = a->mode;
}
}
-/*
- * remainder
- * overflow is impossible, but look out for division by zero
- */
ir_tarval *tarval_mod(ir_tarval *a, ir_tarval *b)
{
assert((a->mode == b->mode) && mode_is_int(a->mode));
return get_tarval(sc_get_buffer(), sc_get_buffer_length(), a->mode);
}
-/*
- * integer division AND remainder
- * overflow is impossible, but look out for division by zero
- */
ir_tarval *tarval_divmod(ir_tarval *a, ir_tarval *b, ir_tarval **mod)
{
int len = sc_get_buffer_length();
return get_tarval(div_res, len, a->mode);
}
-/*
- * absolute value
- */
ir_tarval *tarval_abs(ir_tarval *a)
{
char *buffer;
return tarval_bad;
}
-/*
- * bitwise and
- */
ir_tarval *tarval_and(ir_tarval *a, ir_tarval *b)
{
assert(a->mode == b->mode);
}
}
-/*
- * bitwise or
- */
ir_tarval *tarval_or(ir_tarval *a, ir_tarval *b)
{
assert(a->mode == b->mode);
}
}
-/*
- * bitwise exclusive or (xor)
- */
ir_tarval *tarval_eor(ir_tarval *a, ir_tarval *b)
{
assert((a->mode == b->mode));
}
}
-/*
- * bitwise left shift
- */
ir_tarval *tarval_shl(ir_tarval *a, ir_tarval *b)
{
char *temp_val = NULL;
return get_tarval(sc_get_buffer(), sc_get_buffer_length(), mode);
}
-/*
- * bitwise unsigned right shift
- */
ir_tarval *tarval_shr(ir_tarval *a, ir_tarval *b)
{
char *temp_val = NULL;
return get_tarval(sc_get_buffer(), sc_get_buffer_length(), mode);
}
-/*
- * bitwise signed right shift
- */
ir_tarval *tarval_shrs(ir_tarval *a, ir_tarval *b)
{
char *temp_val = NULL;
return get_tarval(sc_get_buffer(), sc_get_buffer_length(), mode);
}
-/*
- * bitwise rotation to left
- */
ir_tarval *tarval_rotl(ir_tarval *a, ir_tarval *b)
{
char *temp_val = NULL;
return get_tarval(sc_get_buffer(), sc_get_buffer_length(), a->mode);
}
-/*
- * Output of tarvals
- */
int tarval_snprintf(char *buf, size_t len, ir_tarval *tv)
{
static const tarval_mode_info default_info = { TVO_NATIVE, NULL, NULL };
}
}
-/**
- * Output of tarvals to stdio.
- */
int tarval_printf(ir_tarval *tv)
{
char buf[1024];
return res;
}
-/*
- * access to the bitpattern
- */
unsigned char get_tarval_sub_bits(ir_tarval *tv, unsigned byte_ofs)
{
switch (get_mode_arithmetic(tv->mode)) {
}
}
-/*
- * Specify the output options of one mode.
- *
- * This functions stores the modinfo, so DO NOT DESTROY it.
- *
- * Returns zero on success.
- */
int set_tarval_mode_output_option(ir_mode *mode, const tarval_mode_info *modeinfo)
{
assert(mode);
return 0;
}
-/*
- * Returns the output options of one mode.
- *
- * This functions returns the mode info of a given mode.
- */
const tarval_mode_info *get_tarval_mode_output_option(ir_mode *mode)
{
assert(mode);
return (const tarval_mode_info*) mode->tv_priv;
}
-/*
- * Returns non-zero if a given (integer) tarval has only one single bit
- * set.
- */
int tarval_is_single_bit(ir_tarval *tv)
{
int i, l;
return bits;
}
-/*
- * Return the number of set bits in a given (integer) tarval.
- */
int get_tarval_popcount(ir_tarval *tv)
{
int i, l;
return bits;
}
-/**
- * Return the number of the lowest set bit in a given (integer) tarval.
- *
- * @param tv the tarval
- *
- * @return number of lowest set bit or -1 on error
- */
int get_tarval_lowest_bit(ir_tarval *tv)
{
int i, l;
return -1;
}
-/*
- * Returns non-zero if the mantissa of a floating point IEEE-754
- * tarval is zero (i.e. 1.0Exxx)
- */
int tarval_zero_mantissa(ir_tarval *tv)
{
assert(get_mode_arithmetic(tv->mode) == irma_ieee754
return fc_zero_mantissa((const fp_value*) tv->value);
}
-/* Returns the exponent of a floating point IEEE-754 tarval. */
int tarval_get_exponent(ir_tarval *tv)
{
assert(get_mode_arithmetic(tv->mode) == irma_ieee754
return fc_get_exponent((const fp_value*) tv->value);
}
-/*
- * Check if the tarval can be converted to the given mode without
- * precision loss.
- */
int tarval_ieee754_can_conv_lossless(ir_tarval *tv, ir_mode *mode)
{
const float_descriptor_t *desc = get_descriptor(mode);
return fc_can_lossless_conv_to((const fp_value*) tv->value, desc);
}
-/* Returns non-zero if the result of the last IEEE-754 operation was exact. */
unsigned tarval_ieee754_get_exact(void)
{
return fc_is_exact();
}
-/* check if its the a floating point NaN */
int tarval_is_NaN(ir_tarval *tv)
{
if (! mode_is_float(tv->mode))
return fc_is_nan((const fp_value*) tv->value);
}
-/* check if its the a floating point +inf */
int tarval_is_plus_inf(ir_tarval *tv)
{
if (! mode_is_float(tv->mode))
&& !fc_is_negative((const fp_value*) tv->value);
}
-/* check if its the a floating point -inf */
int tarval_is_minus_inf(ir_tarval *tv)
{
if (! mode_is_float(tv->mode))
&& fc_is_negative((const fp_value*) tv->value);
}
-/* check if the tarval represents a finite value */
int tarval_is_finite(ir_tarval *tv)
{
if (mode_is_float(tv->mode))
return 1;
}
-/*
- * Sets the overflow mode for integer operations.
- */
void tarval_set_integer_overflow_mode(tarval_int_overflow_mode_t ov_mode)
{
int_overflow_mode = ov_mode;
}
-/* Get the overflow mode for integer operations. */
tarval_int_overflow_mode_t tarval_get_integer_overflow_mode(void)
{
return int_overflow_mode;
NULL,
};
-/*
- * Initialization of the tarval module: called before init_mode()
- */
void init_tarval_1(long null_value, int support_quad_precision)
{
_null_value = null_value;
init_fltcalc(support_quad_precision ? 112 : 64);
}
-/*
- * Initialization of the tarval module: called after init_mode()
- */
void init_tarval_2(void)
{
tarval_bad->kind = k_tarval;
set_tarval_mode_output_option(mode_P, &hex_output);
}
-/* free all memory occupied by tarval. */
void finish_tarval(void)
{
finish_strcalc();