+/**
+ * Compares two tarvals
+ *
+ * Compare a with b and return a pnc_number describing the relation
+ * between a and b. This is either Uo, Lt, Eq, Gt, or False if a or b
+ * are symbolic pointers which can not be compared at all.
+ *
+ * @param a A tarval to be compared
+ * @param b A tarval to be compared
+ *
+ * @return
+ * The pnc_number best describing the relation between a and b is returned.
+ * This means the mode with the least bits set is returned, e.g. if the
+ * tarvals are equal the pnc_number 'Eq' is returned, not 'Ge' which
+ * indicates 'greater or equal'
+ *
+ * @sa
+ * irnode.h for the definition of pnc_numbers
+ */
+pnc_number tarval_cmp(tarval *a, tarval *b);
+
+/**
+ * Converts a tarval to another mode.
+ *
+ * Convert tarval 'src' to mode 'mode', this will suceed 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.
+ *
+ * @param src The tarval to convert
+ * @param mode Tho mode to convert to
+ *
+ * @return
+ * 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 conversations will trigger an assertion
+ *
+ * @sa
+ * FIRM documentation for conversion rules
+ * mode_is_smaller defined in irmode.h
+ */
+tarval *tarval_convert_to(tarval *src, ir_mode *m);
+
+/*
+ * These function implement basic computations representable as opcodes
+ * in FIRM nodes.
+ *
+ * PARAMETERS
+ * tarval_neg:
+ * traval_abs:
+ * a - the tarval to operate on
+ *
+ * all oters:
+ * a - the first operand tarval
+ * b - the second operand tarval
+ *
+ * RESULT
+ * If neccessary a new tarval is constructed for the resulting value,
+ * or the one already carrying the computation result is retrieved and
+ * returned as result.
+ *
+ * NOTES
+ * The order the arguments are given in is important, imagine postfix
+ * notation.
+ * Illegal operations will trigger an assertion.
+ * The sort member of the struct mode defines which operations are valid
+ */
+
+/** bitwise Negation of a tarval. */
+tarval *tarval_not(tarval *a);
+
+/** arithmetic Negation of a tarval. */
+tarval *tarval_neg(tarval *a);
+
+/** Addition of two tarvals. */
+tarval *tarval_add(tarval *a, tarval *b);
+
+/** Subtraction from a tarval. */
+tarval *tarval_sub(tarval *a, tarval *b);
+
+/** Multiplication of tarvals. */
+tarval *tarval_mul(tarval *a, tarval *b);
+
+/** 'Exact' division. */
+tarval *tarval_quo(tarval *a, tarval *b);
+
+/** Integer division. */
+tarval *tarval_div(tarval *a, tarval *b);
+
+/** Remainder of integer division. */
+tarval *tarval_mod(tarval *a, tarval *b);
+
+/** Absolute value. */
+tarval *tarval_abs(tarval *a);
+
+/** Bitwise and. */
+tarval *tarval_and(tarval *a, tarval *b);
+
+/** Bitwise or. */
+tarval *tarval_or(tarval *a, tarval *b);
+
+/** Bitwise exclusive or. */
+tarval *tarval_eor(tarval *a, tarval *b);
+
+/** Left shift. */
+tarval *tarval_shl(tarval *a, tarval *b);
+
+/** Unsigned (logical) right shift. */
+tarval *tarval_shr(tarval *a, tarval *b);
+
+/** Signed (arithmetic) right shift. */
+tarval *tarval_shrs(tarval *a, tarval *b);
+
+/** Rotation. */
+tarval *tarval_rot(tarval *a, tarval *b);
+
+/** Carry flag of the last operation */
+int tarval_carry(void);
+
+/* *********** Output of tarvals *********** */
+
+/**
+ * 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 simplier...
+ */
+typedef enum {
+ 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)*/
+} tv_output_mode;
+
+/**
+ * This structure contains helper information to format the output
+ * of a tarval of a mode.
+ */
+typedef struct tarval_mode_info {
+ tv_output_mode mode_output; /**< if != TVO_NATIVE select a special mode */
+ const char *mode_prefix; /**< if set, this prefix will be printed
+ before a value of this mode */
+ const char *mode_suffix; /**< if set, this suffix will be printed
+ after a value of this mode */
+} tarval_mode_info;
+
+/**
+ * Specify the output options of one mode.
+ *
+ * This functions stores the modinfo, so DO NOT DESTROY it.
+ *
+ * @param mode a ir_mode that should be associated
+ * @param modeinfo the output format info
+ *
+ * @return zero on success.
+ */
+int set_tarval_mode_output_option(ir_mode *mode, const tarval_mode_info *modeinfo);
+
+/**
+ * Returns the output options of one mode.
+ *
+ * This functions returns the modinfo of a given mode.
+ *
+ * @param mode a ir_mode that should be associated
+ *
+ * @return the output option
+ */
+const tarval_mode_info *get_tarval_mode_output_option(ir_mode *mode);
+
+/**
+ * Returns Bit representation of a tarval value, as string of '0' and '1'
+ *
+ * @param tv The tarval
+ *
+ * This function returns a printable bit representation of any value
+ * stored as tarval. This representation is a null terminated C string.
+ *
+ * @return
+ * 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
+ *
+ * @sa
+ * irmode.h for the definition of the ir_mode struct
+ * the size member of aforementioned struct
+ */
+char *get_tarval_bitpattern(tarval *tv);
+
+/**
+ * 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);
+ * val1 = tarval_sub_bits(tv, 1);
+ * val2 = tarval_sub_bits(tv, 2);
+ * val3 = tarval_sub_bits(tv, 3);
+ *
+ * Because this is the bit representation of the target machine, only the following
+ * operations are legal on the result:
+ *
+ * - concatenation (endian dependance MUST be handled by the CALLER)
+ * - bitwise logical operations to select/mask bits
+ *
+ * @param tv the tarval
+ * @param byte_ofs the byte offset
+ *
+ * @note
+ * The result of this funcion is undefined if the mode is neither integer nor float.
+ */
+unsigned char get_tarval_sub_bits(tarval *tv, unsigned byte_ofs);
+
+/**
+ * Return values of tarval classify
+ */
+typedef enum _tarval_classification_t {
+ TV_CLASSIFY_NULL = 0, /**< the tarval represents the additive neutral element */
+ TV_CLASSIFY_ONE = +1, /**< the tarval represents the multiplicative neutral element */
+ TV_CLASSIFY_ALL_ONE = -1, /**< the tarval represents the bitwise-and neutral element */
+ TV_CLASSIFY_OTHER = 2 /**< all other tarvals */
+} tarval_classification_t;
+
+/**
+ * Identifying tarvals values for algebraic simplifications.
+ * @param tv
+ * @return
+ * - TV_CLASSIFY_NULL for additive neutral,
+ * - TV_CLASSIFY_ONE for multiplicative neutral,
+ * - TV_CLASSIFY_ALL_ONE for bitwise-and neutral
+ * - TV_CLASSIFY_OTHER else
+ */
+tarval_classification_t classify_tarval(tarval *tv);
+
+
+
+/**
+ * Output of tarvals to a buffer.
+ */
+int tarval_snprintf(char *buf, size_t buflen, tarval *tv);
+
+/**
+ * Output of tarvals to stdio.
+ */
+int tarval_printf(tarval *tv);
+
+#endif /* _TV_H_ */