libFirm
Target Machine Values

Tarvals only represent values of mode_sort: More...

Data Structures

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

Macros

#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.

Typedefs

typedef struct ir_tarval ir_tarval
 Target Machine Value.

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_shl_unsigned (ir_tarval *a, unsigned b)
 logical left shift (variant with unsigned argument).
ir_tarvaltarval_shr (ir_tarval *a, ir_tarval *b)
 Unsigned (logical) right shift.
ir_tarvaltarval_shr_unsigned (ir_tarval *a, unsigned b)
 unsigned (logical) right shift (variant with unsigned argument).
ir_tarvaltarval_shrs (ir_tarval *a, ir_tarval *b)
 Signed (arithmetic) right shift.
ir_tarvaltarval_shrs_unsigned (ir_tarval *a, unsigned b)
 signed (arithmetic) right shift (variant with unsigned argument).
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

Tarvals only represent values of mode_sort:

In case of references the module accepts an entity to represent the value. Furthermore, computations and conversions of these values can be performed.

See Also
Techreport 1999-14 irmode.h for the modes definitions

Macro Definition Documentation

#define get_tarval_bottom ( )    get_tarval_bad()

Returns the 'bottom' tarval.

Definition at line 317 of file tv.h.

#define get_tarval_top ( )    get_tarval_undefined()

Returns the 'top' tarval.

Definition at line 312 of file tv.h.

#define tarval_bottom   tarval_bad

The 'bottom' tarval.

This is just another name for the 'bad' tarval.

Definition at line 315 of file tv.h.

#define tarval_top   tarval_undefined

The 'top' tarval.

This is just another name for the 'undefined' tarval.

Definition at line 310 of file tv.h.

Typedef Documentation

typedef struct ir_tarval ir_tarval

Target Machine Value.

Definition at line 78 of file firm_types.h.

Enumeration Type Documentation

Modes for handling integer overflows.

Enumerator:
TV_OVERFLOW_BAD 

tarval module will return tarval_bad if a overflow occurs

TV_OVERFLOW_WRAP 

tarval module will overflow will be ignored, wrap around occurs

TV_OVERFLOW_SATURATE 

tarval module will saturate the overflow

Definition at line 350 of file tv.h.

The output mode for tarval values.

Some modes allow more that one representation, for instance integers can be represented hex or decimal. Of course it would be enough to have one and let every backend convert it into the 'right' one. However, we can do this in the tarval much simpler...

Enumerator:
TVO_NATIVE 

the default output mode, depends on the mode

TVO_HEX 

use hex representation, always possible

TVO_DECIMAL 

use decimal representation

TVO_OCTAL 

use octal representation

TVO_BINARY 

use binary representation

TVO_FLOAT 

use floating point representation (i.e 1.342e-2)

TVO_HEXFLOAT 

use hexadecimal floating point representation (i.e 0x1.ea32p-12)

Definition at line 630 of file tv.h.

Function Documentation

ir_tarval* get_tarval_all_one ( ir_mode mode)

returns the value where all bits are 1 of a given mode.

returns tarval_bad for float modes

ir_tarval* get_tarval_b_false ( void  )

Returns the mode_b tarval 'false'.

ir_tarval* get_tarval_b_true ( void  )

Returns the mode_b tarval 'true'.

ir_tarval* get_tarval_bad ( void  )

Returns the 'bad' tarval.

char* get_tarval_bitpattern ( ir_tarval tv)

Returns Bit representation of a tarval value, as string of '0' and '1'.

Parameters
tvThe tarval

This function returns a printable bit representation of any value stored as tarval. This representation is a null terminated C string.

Returns
As usual in C a pointer to a char is returned. The length of the returned string if fixed, just read as many chars as the mode defines as size.
Note
The string is allocated using malloc() and is free()ed on the next call of this function. The string consists of the ASCII characters '0' and '1' and is null terminated
See Also
irmode.h for the definition of the ir_mode struct the size member of aforementioned struct
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.

This will overflow silently, so use only if you know what you are doing! (better check with tarval_is_long...)

Parameters
tvthe tarval
long get_tarval_long ( ir_tarval tv)

Returns value as long if possible.

This returns a long int with the value represented value, or gibberish, depending on the size of long int and the size of the stored value. It works for e.g. 1 as mode_Ls, but might not work for get_mode_max(mode_Ls). This will overflow silently, so use only if you know what you are doing! (better check with tarval_is_long()...) Works only for int modes, even not for character modes!

long double get_tarval_long_double ( ir_tarval tv)

same as get_tarval_double but returns a long double value

int get_tarval_lowest_bit ( ir_tarval tv)

Returns the number of the lowest set bit in a given (integer) tarval.

Parameters
tvthe tarval
Returns
number of lowest set bit or -1 on error
ir_tarval* get_tarval_max ( ir_mode mode)

Returns the maximum value of a given mode.

ir_tarval* get_tarval_min ( ir_mode mode)

Returns the minimum value of a given mode.

ir_tarval* get_tarval_minus_inf ( ir_mode mode)

Returns -inf for float_number modes.

ir_tarval* get_tarval_minus_one ( ir_mode mode)

Returns the -1 value (multiplicative neutral) of a given mode.

Returns tarval bad for unsigned modes

ir_mode* get_tarval_mode ( const ir_tarval tv)

Returns the mode of the tarval.

Parameters
tvthe tarval
const tarval_mode_info* get_tarval_mode_output_option ( ir_mode mode)

Returns the output options of one mode.

This functions returns the mode info of a given mode.

Parameters
modea ir_mode that should be associated
Returns
the output option
ir_tarval* get_tarval_nan ( ir_mode mode)

Returns quite nan for float_number modes.

ir_tarval* get_tarval_null ( ir_mode mode)

Returns the 0 value (additive neutral) of a given mode.

For reference modes, the NULL value is returned (old tarval_P_void)

ir_tarval* get_tarval_one ( ir_mode mode)

Returns the 1 value (multiplicative neutral) of a given mode.

ir_tarval* get_tarval_plus_inf ( ir_mode mode)

Returns +inf for float_number modes.

int get_tarval_popcount ( ir_tarval tv)

Returns the number of set bits in a given (integer) tarval.

Parameters
tvthe tarval
Returns
number of set bits or -1 on error
ir_tarval* get_tarval_reachable ( void  )

Returns the mode_X tarval 'reachable'.

unsigned char get_tarval_sub_bits ( ir_tarval tv,
unsigned  byte_ofs 
)

Returns the bitpattern of the bytes_ofs byte.

This function succeeds even if the mode of the tarval uses lesser bits than requested, in that case the bitpattern is filled with zero bits.

To query a 32bit value the following code can be used:

val0 = tarval_sub_bits(tv, 0); <- lowest bits val1 = tarval_sub_bits(tv, 1); val2 = tarval_sub_bits(tv, 2); val3 = tarval_sub_bits(tv, 3); <- highest bits

Because this is the bit representation of the target machine, only the following operations are legal on the result:

  • concatenation (endian dependence MUST be handled by the CALLER)
  • bitwise logical operations to select/mask bits
Parameters
tvthe tarval
byte_ofsthe byte offset from lower to higher
Note
The result of this function is undefined if the mode is neither integer nor float.
ir_tarval* get_tarval_undefined ( void  )

Returns the 'undefined' tarval.

ir_tarval* get_tarval_unreachable ( void  )

Returns the mode_X tarval 'unreachable'.

int is_tarval ( const void *  thing)

Checks whether a pointer points to a tarval.

Parameters
thingan arbitrary pointer
Returns
true if the thing is a tarval, else false
ir_tarval* new_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.

Parameters
strThe string representing the target value
lenThe length of the string
signis -1 or 1 depending on the numbers sign
basenumber system base. binary(2), octal(8), decimal(10) and hexadecimal(16) numbers are supported.
modeThe mode requested for the result tarval
Returns
A tarval with the given mode. If overflow settings are set to TV_OVERFLOW_BAD then a tarval_bad is returned if the number can't be represented in the given mode. Returns bad if the number couldn't successfully be parsed.
ir_tarval* new_tarval_from_double ( double  d,
ir_mode mode 
)

Constructor function for new tarvals.

Parameters
dThe (long) double representing the value
modeThe mode requested for the result tarval

This function creates a new tarval representing the value represented by a (long) double. If a tarval representing this value already exists, this tarval is returned instead of a new one. So tarvals are directly comparable since their representation is unique. Only modes of sort float_number can be constructed this way.

Returns
A tarval of proper type representing the requested value is returned. Tarvals are unique, so for any value/mode pair at most one tarval will exist, which will be returned upon further requests with an identical value/mode pair.
Note
If the (long) double is not representable in the given mode an assertion is thrown. This will happen for any mode not of sort float_number.
See Also
irmode.h for predefined values new_tarval_from_str() new_tarval_from_long()
ir_tarval* new_tarval_from_long ( long  l,
ir_mode mode 
)

Constructor function for new tarvals.

Parameters
lThe long representing the value
modeThe mode requested for the result tarval

This function creates a new tarval representing the value represented by a long integer. If a tarval representing this value already exists, this tarval is returned instead of a new one. So tarvals are directly comparable since their representation is unique.

Returns
A tarval of proper type representing the requested value is returned. Tarvals are unique, so for any value/mode pair at most one tarval will exist, which will be returned upon further requests with an identical value/mode pair.
Note
If the long is not representable in the given mode an assertion is thrown in assert build.
See Also
irmode.h for predefined modes new_tarval_from_str() new_tarval_from_double()
ir_tarval* new_tarval_from_long_double ( long double  d,
ir_mode mode 
)

same as new_tarval_from_double(), but with a long double argument

ir_tarval* new_tarval_from_str ( const char *  str,
size_t  len,
ir_mode mode 
)

Constructor function for new tarvals.

Parameters
strThe string representing the target value
lenThe length of the string
modeThe mode requested for the result tarval

This function creates a new tarval representing the value represented by a CString, aka char array. If a tarval representing this value already exists, this tarval is returned instead of a new one. So tarvals are directly comparable since their representation is unique.

This function accepts the following strings:

if mode is int_number:

  • [+-]?0[xX][0-9a-fA-F]+ (hexadecimal representation)
  • [+-]?0[0-7]* (octal representation)
  • [+-]?0[bB][01]+ (binary representation)
  • [+-]?[1-9][0-9]* (decimal representation)

if mode is float_number:

  • [+-]?(decimal int) (. (decimal int))? ([eE][+-]?(decimal int))?

if mode is boolean: true, True, TRUE ... False... 0, 1,

if mode is reference: "null" and the same as for int_number

Leading and/or trailing spaces are ignored

Returns
A tarval of proper type representing the requested value is returned. Tarvals are unique, so for any value/mode pair at most one tarval will exist, which will be returned upon further requests with an identical value/mode pair.
Note
If the string is not representable in the given mode an assertion is thrown in assert build.
See Also
irmode.h for predefined modes new_tarval_from_long() new_tarval_from_double()
int set_tarval_mode_output_option ( ir_mode mode,
const tarval_mode_info modeinfo 
)

Specify the output options of one mode.

This functions stores the mode info, so DO NOT DESTROY it.

Parameters
modea ir_mode that should be associated
modeinfothe output format info
Returns
zero on success.
ir_tarval* tarval_abs ( ir_tarval a)

Absolute value of a tarval.

Parameters
athe first tarval
Returns
|a| or tarval_bad
ir_tarval* tarval_add ( ir_tarval a,
ir_tarval b 
)

Addition of two tarvals.

Parameters
athe first tarval
bthe second tarval
Returns
a + b or tarval_bad
ir_tarval* tarval_and ( ir_tarval a,
ir_tarval b 
)

Bitwise and of two integer tarvals.

Parameters
athe first tarval
bthe second tarval
Returns
a & b or tarval_bad
ir_tarval* tarval_andnot ( ir_tarval a,
ir_tarval b 
)

Bitwise and not of two integer tarvals.

Parameters
athe first tarval
bthe second tarval
Returns
a & ~b or tarval_bad
int tarval_carry ( void  )

Returns the carry flag of the last operation.

ir_relation tarval_cmp ( ir_tarval a,
ir_tarval b 
)

Compares two tarvals.

Compare a with b and return their relation. This is either ir_rel_unordered, ir_rel_less, ir_rel_greater, ir_rel_equal or ir_rel_false if a or b are symbolic pointers which can not be compared at all.

Parameters
athe first tarval to be compared
bthe second tarval to be compared
ir_tarval* tarval_convert_to ( ir_tarval src,
ir_mode mode 
)

Converts a tarval to another mode.

Convert tarval 'src' to mode 'mode', this will succeed if and only if mode 'mode' is wider than the mode of src, as defined in the firm documentation and as returned by the function mode_is_smaller defined in irmode.h.

Parameters
srcThe tarval to convert
modeTho mode to convert to
Returns
If a tarval of mode 'mode' with the result of the conversion of the 'src' tarvals value already exists, it will be returned, else a new tarval is constructed and returned
Note
Illegal convertions will trigger a panic
See Also
FIRM documentation for conversion rules mode_is_smaller defined in irmode.h
ir_tarval* tarval_div ( ir_tarval a,
ir_tarval b 
)

Integer division of two tarvals.

Parameters
athe first tarval
bthe second tarval
Returns
a / b or tarval_bad
ir_tarval* tarval_divmod ( ir_tarval a,
ir_tarval b,
ir_tarval **  mod_res 
)

Integer division AND remainder.

Parameters
athe first tarval
bthe second tarval
mod_resafter return, contains the remainder result, a % b or tarval_bad
Returns
a / b or tarval_bad
void tarval_enable_fp_ops ( int  enable)

Enable/Disable floating point constant folding.

ir_tarval* tarval_eor ( ir_tarval a,
ir_tarval b 
)

Bitwise exclusive or of two integer tarvals.

Parameters
athe first tarval
bthe second tarval
Returns
a ^ b or tarval_bad
int tarval_fp_ops_enabled ( void  )

returns 0/1 if floating point folding is enable/disabled

int tarval_get_exponent ( ir_tarval tv)

Returns the exponent of a floating point IEEE-754 tarval.

Parameters
tvthe tarval
tarval_int_overflow_mode_t tarval_get_integer_overflow_mode ( void  )

Returns the overflow mode for integer operations.

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.

Parameters
tvthe tarval
modethe mode to convert to
unsigned tarval_ieee754_get_exact ( void  )

Returns non-zero if the result of the last IEEE-754 operation was exact.

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.

NOT a reserved tarval like bad, undef, reachable etc.)

int tarval_is_double ( ir_tarval tv)

This validates if tarval_to_double() will return a satisfying result.

I.e. if tv is an float_number and between min, max of double

Parameters
tvthe tarval
int tarval_is_finite ( ir_tarval tv)

Check if the tarval represents a finite value, ie neither NaN nor inf.

Parameters
tvthe tarval
int tarval_is_long ( ir_tarval tv)

This validates if get_tarval_long() will return a satisfying result.

I.e. if tv is an int_number and between min, max of long int (signed!)

Parameters
tvthe tarval
int tarval_is_minus_inf ( ir_tarval tv)

Check if its the a floating point -inf.

Parameters
tvthe tarval
int tarval_is_minus_one ( ir_tarval tv)

Returns 1 if tv is the "minus one".

Parameters
tvthe tarval
int tarval_is_NaN ( ir_tarval tv)

Check if its the a floating point NaN.

Parameters
tvthe tarval
int tarval_is_negative ( ir_tarval tv)

Returns 1 if tv is negative.

Parameters
tvthe tarval
int tarval_is_null ( ir_tarval tv)

Returns 1 if tv is null.

Parameters
tvthe tarval
int tarval_is_one ( ir_tarval tv)

Returns 1 if tv is the "one".

Parameters
tvthe tarval
int tarval_is_plus_inf ( ir_tarval tv)

Check if its the a floating point +inf.

Parameters
tvthe tarval
int tarval_is_single_bit ( ir_tarval tv)

Returns non-zero if a given (integer) tarval has only one single bit set.

Parameters
tvthe tarval
ir_tarval* tarval_mod ( ir_tarval a,
ir_tarval b 
)

Remainder of integer division.

Parameters
athe first tarval
bthe second tarval
Returns
a % b or tarval_bad
ir_tarval* tarval_mul ( ir_tarval a,
ir_tarval b 
)

Multiplication of tarvals.

Parameters
athe first tarval
bthe second tarval
Returns
a * b or tarval_bad
ir_tarval* tarval_neg ( ir_tarval a)

Arithmetic Negation of a tarval.

Parameters
athe first tarval
Returns
-a or tarval_bad
ir_tarval* tarval_not ( ir_tarval a)

Bitwise Negation of a tarval.

Parameters
athe first tarval
Returns
~a or tarval_bad
ir_tarval* tarval_or ( ir_tarval a,
ir_tarval b 
)

Bitwise or of two integer tarvals.

Parameters
athe first tarval
bthe second tarval
Returns
a | b or tarval_bad
int tarval_printf ( ir_tarval tv)

Output a tarval to stdio.

Parameters
tvthe tarval
ir_tarval* tarval_rotl ( ir_tarval a,
ir_tarval b 
)

Rotation to left.

Parameters
athe first tarval
bthe second tarval
Returns
a <<L>> b or tarval_bad
void tarval_set_integer_overflow_mode ( tarval_int_overflow_mode_t  ov_mode)

Sets the overflow mode for integer operations.

Parameters
ov_modeone of the overflow modes
ir_tarval* tarval_shl ( ir_tarval a,
ir_tarval b 
)

Logical Left shift.

Parameters
athe first tarval
bthe second tarval
Returns
a << b or tarval_bad
ir_tarval* tarval_shl_unsigned ( ir_tarval a,
unsigned  b 
)

logical left shift (variant with unsigned argument).

See Also
tarval_shl()
ir_tarval* tarval_shr ( ir_tarval a,
ir_tarval b 
)

Unsigned (logical) right shift.

Parameters
athe first tarval
bthe second tarval
Returns
a >>u b or tarval_bad
ir_tarval* tarval_shr_unsigned ( ir_tarval a,
unsigned  b 
)

unsigned (logical) right shift (variant with unsigned argument).

See Also
tarval_shr()
ir_tarval* tarval_shrs ( ir_tarval a,
ir_tarval b 
)

Signed (arithmetic) right shift.

Parameters
athe first tarval
bthe second tarval
Returns
a >>s b or tarval_bad
ir_tarval* tarval_shrs_unsigned ( ir_tarval a,
unsigned  b 
)

signed (arithmetic) right shift (variant with unsigned argument).

See Also
tarval_shrs()
int tarval_snprintf ( char *  buf,
size_t  buflen,
ir_tarval tv 
)

Output a tarval to a string buffer.

Parameters
bufthe output buffer
buflenthe length of the buffer
tvthe tarval
ir_tarval* tarval_sub ( ir_tarval a,
ir_tarval b,
ir_mode dst_mode 
)

Subtraction from a tarval.

Parameters
athe first tarval
bthe second tarval
dst_modethe mode of the result, needed for mode_P - mode_P, else NULL
Returns
a - b or tarval_bad
int tarval_zero_mantissa ( ir_tarval tv)

Returns non-zero if the mantissa of a floating point tarval is zero (i.e.

1.0Exxx)

Parameters
tvthe tarval

Variable Documentation

ir_tarval* tarval_b_false

The mode_b tarval 'false'.

Definition at line 290 of file tv.h.

ir_tarval* tarval_b_true

The mode_b tarval 'true'.

Definition at line 295 of file tv.h.

ir_tarval* tarval_bad

The 'bad' tarval.

Definition at line 280 of file tv.h.

ir_tarval* tarval_reachable

The mode_X tarval 'reachable'.

Definition at line 305 of file tv.h.

ir_tarval* tarval_undefined

The 'undefined' tarval.

Definition at line 285 of file tv.h.

ir_tarval* tarval_unreachable

The mode_X tarval 'unreachable'.

Definition at line 300 of file tv.h.