libFirm 1.20
libfirm/tv.h File Reference

Representation of and static computations on target machine values. More...

#include <stddef.h>
#include "firm_types.h"
#include "begin.h"
#include "end.h"

Go to the source code of this file.

Data Structures

struct  tarval_mode_info
 This structure contains helper information to format the output of a tarval of a mode. More...

Defines

#define tarval_top   tarval_undefined
 The 'top' tarval.
#define get_tarval_top()   get_tarval_undefined()
 Returns the 'top' tarval.
#define tarval_bottom   tarval_bad
 The 'bottom' tarval.
#define get_tarval_bottom()   get_tarval_bad()
 Returns the 'bottom' tarval.

Enumerations

enum  tarval_int_overflow_mode_t { TV_OVERFLOW_BAD, TV_OVERFLOW_WRAP, TV_OVERFLOW_SATURATE }
 Modes for handling integer overflows. More...
enum  tv_output_mode {
  TVO_NATIVE, TVO_HEX, TVO_DECIMAL, TVO_OCTAL,
  TVO_BINARY, TVO_FLOAT, TVO_HEXFLOAT
}
 The output mode for tarval values. More...

Functions

ir_tarvalnew_tarval_from_str (const char *str, size_t len, ir_mode *mode)
 Constructor function for new tarvals.
ir_tarvalnew_integer_tarval_from_str (const char *str, size_t len, char sign, unsigned char base, ir_mode *mode)
 Construct a new tarval from a given string.
ir_tarvalnew_tarval_from_long (long l, ir_mode *mode)
 Constructor function for new tarvals.
long get_tarval_long (ir_tarval *tv)
 Returns value as long if possible.
int tarval_is_long (ir_tarval *tv)
 This validates if get_tarval_long() will return a satisfying result.
ir_tarvalnew_tarval_from_double (double d, ir_mode *mode)
 Constructor function for new tarvals.
ir_tarvalnew_tarval_from_long_double (long double d, ir_mode *mode)
 same as new_tarval_from_double(), but with a long double argument
double get_tarval_double (ir_tarval *tv)
 This returns a double with the value represented value, or gibberish, depending on the size of double and the size of the stored value.
long double get_tarval_long_double (ir_tarval *tv)
 same as get_tarval_double but returns a long double value
int tarval_is_double (ir_tarval *tv)
 This validates if tarval_to_double() will return a satisfying result.
ir_modeget_tarval_mode (const ir_tarval *tv)
 Returns the mode of the tarval.
int tarval_is_negative (ir_tarval *tv)
 Returns 1 if tv is negative.
int tarval_is_null (ir_tarval *tv)
 Returns 1 if tv is null.
int tarval_is_one (ir_tarval *tv)
 Returns 1 if tv is the "one".
int tarval_is_minus_one (ir_tarval *tv)
 Returns 1 if tv is the "minus one".
int tarval_is_all_one (ir_tarval *tv)
 returns non-zero if all bits in the tarval are set
int tarval_is_constant (ir_tarval *tv)
 Returns non-zero if the tarval is a constant (ie.
ir_tarvalget_tarval_bad (void)
 Returns the 'bad' tarval.
ir_tarvalget_tarval_undefined (void)
 Returns the 'undefined' tarval.
ir_tarvalget_tarval_b_false (void)
 Returns the mode_b tarval 'false'.
ir_tarvalget_tarval_b_true (void)
 Returns the mode_b tarval 'true'.
ir_tarvalget_tarval_unreachable (void)
 Returns the mode_X tarval 'unreachable'.
ir_tarvalget_tarval_reachable (void)
 Returns the mode_X tarval 'reachable'.
ir_tarvalget_tarval_max (ir_mode *mode)
 Returns the maximum value of a given mode.
ir_tarvalget_tarval_min (ir_mode *mode)
 Returns the minimum value of a given mode.
ir_tarvalget_tarval_null (ir_mode *mode)
 Returns the 0 value (additive neutral) of a given mode.
ir_tarvalget_tarval_one (ir_mode *mode)
 Returns the 1 value (multiplicative neutral) of a given mode.
ir_tarvalget_tarval_minus_one (ir_mode *mode)
 Returns the -1 value (multiplicative neutral) of a given mode.
ir_tarvalget_tarval_all_one (ir_mode *mode)
 returns the value where all bits are 1 of a given mode.
ir_tarvalget_tarval_nan (ir_mode *mode)
 Returns quite nan for float_number modes.
ir_tarvalget_tarval_plus_inf (ir_mode *mode)
 Returns +inf for float_number modes.
ir_tarvalget_tarval_minus_inf (ir_mode *mode)
 Returns -inf for float_number modes.
void tarval_set_integer_overflow_mode (tarval_int_overflow_mode_t ov_mode)
 Sets the overflow mode for integer operations.
tarval_int_overflow_mode_t tarval_get_integer_overflow_mode (void)
 Returns the overflow mode for integer operations.
ir_relation tarval_cmp (ir_tarval *a, ir_tarval *b)
 Compares two tarvals.
ir_tarvaltarval_convert_to (ir_tarval *src, ir_mode *mode)
 Converts a tarval to another mode.
ir_tarvaltarval_not (ir_tarval *a)
 Bitwise Negation of a tarval.
ir_tarvaltarval_neg (ir_tarval *a)
 Arithmetic Negation of a tarval.
ir_tarvaltarval_add (ir_tarval *a, ir_tarval *b)
 Addition of two tarvals.
ir_tarvaltarval_sub (ir_tarval *a, ir_tarval *b, ir_mode *dst_mode)
 Subtraction from a tarval.
ir_tarvaltarval_mul (ir_tarval *a, ir_tarval *b)
 Multiplication of tarvals.
ir_tarvaltarval_div (ir_tarval *a, ir_tarval *b)
 Integer division of two tarvals.
ir_tarvaltarval_mod (ir_tarval *a, ir_tarval *b)
 Remainder of integer division.
ir_tarvaltarval_divmod (ir_tarval *a, ir_tarval *b, ir_tarval **mod_res)
 Integer division AND remainder.
ir_tarvaltarval_abs (ir_tarval *a)
 Absolute value of a tarval.
ir_tarvaltarval_and (ir_tarval *a, ir_tarval *b)
 Bitwise and of two integer tarvals.
ir_tarvaltarval_andnot (ir_tarval *a, ir_tarval *b)
 Bitwise and not of two integer tarvals.
ir_tarvaltarval_or (ir_tarval *a, ir_tarval *b)
 Bitwise or of two integer tarvals.
ir_tarvaltarval_eor (ir_tarval *a, ir_tarval *b)
 Bitwise exclusive or of two integer tarvals.
ir_tarvaltarval_shl (ir_tarval *a, ir_tarval *b)
 Logical Left shift.
ir_tarvaltarval_shr (ir_tarval *a, ir_tarval *b)
 Unsigned (logical) right shift.
ir_tarvaltarval_shrs (ir_tarval *a, ir_tarval *b)
 Signed (arithmetic) right shift.
ir_tarvaltarval_rotl (ir_tarval *a, ir_tarval *b)
 Rotation to left.
int tarval_carry (void)
 Returns the carry flag of the last operation.
int set_tarval_mode_output_option (ir_mode *mode, const tarval_mode_info *modeinfo)
 Specify the output options of one mode.
const tarval_mode_infoget_tarval_mode_output_option (ir_mode *mode)
 Returns the output options of one mode.
char * get_tarval_bitpattern (ir_tarval *tv)
 Returns Bit representation of a tarval value, as string of '0' and '1'.
unsigned char get_tarval_sub_bits (ir_tarval *tv, unsigned byte_ofs)
 Returns the bitpattern of the bytes_ofs byte.
int tarval_is_single_bit (ir_tarval *tv)
 Returns non-zero if a given (integer) tarval has only one single bit set.
int get_tarval_popcount (ir_tarval *tv)
 Returns the number of set bits in a given (integer) tarval.
int get_tarval_lowest_bit (ir_tarval *tv)
 Returns the number of the lowest set bit in a given (integer) tarval.
int tarval_snprintf (char *buf, size_t buflen, ir_tarval *tv)
 Output a tarval to a string buffer.
int tarval_printf (ir_tarval *tv)
 Output a tarval to stdio.
int tarval_zero_mantissa (ir_tarval *tv)
 Returns non-zero if the mantissa of a floating point tarval is zero (i.e.
int tarval_get_exponent (ir_tarval *tv)
 Returns the exponent of a floating point IEEE-754 tarval.
int tarval_ieee754_can_conv_lossless (ir_tarval *tv, ir_mode *mode)
 Check if the tarval can be converted to the given mode without precision loss.
unsigned tarval_ieee754_get_exact (void)
 Returns non-zero if the result of the last IEEE-754 operation was exact.
void tarval_enable_fp_ops (int enable)
 Enable/Disable floating point constant folding.
int tarval_fp_ops_enabled (void)
 returns 0/1 if floating point folding is enable/disabled
int tarval_is_NaN (ir_tarval *tv)
 Check if its the a floating point NaN.
int tarval_is_plus_inf (ir_tarval *tv)
 Check if its the a floating point +inf.
int tarval_is_minus_inf (ir_tarval *tv)
 Check if its the a floating point -inf.
int tarval_is_finite (ir_tarval *tv)
 Check if the tarval represents a finite value, ie neither NaN nor inf.
int is_tarval (const void *thing)
 Checks whether a pointer points to a tarval.

Variables

ir_tarvaltarval_bad
 The 'bad' tarval.
ir_tarvaltarval_undefined
 The 'undefined' tarval.
ir_tarvaltarval_b_false
 The mode_b tarval 'false'.
ir_tarvaltarval_b_true
 The mode_b tarval 'true'.
ir_tarvaltarval_unreachable
 The mode_X tarval 'unreachable'.
ir_tarvaltarval_reachable
 The mode_X tarval 'reachable'.

Detailed Description

Representation of and static computations on target machine values.

Date:
2003
Author:
Mathias Heil target machine values.

Definition in file tv.h.