+/*
+ * 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;
+}
+
+/* Enable/Disable floating point constant folding. */
+void tarval_enable_fp_ops(int enable)
+{
+ no_float = !enable;
+}
+
+int tarval_fp_ops_enabled(void)
+{
+ return !no_float;
+}
+
+/**
+ * default mode_info for output as HEX
+ */
+static const tarval_mode_info hex_output = {
+ TVO_HEX,
+ "0x",
+ NULL,
+};
+
+/*
+ * Initialization of the tarval module: called before init_mode()
+ */
+void init_tarval_1(long null_value, int support_quad_precision)
+{
+ /* if these assertion fail, tarval_is_constant() will follow ... */
+ assert(tarval_b_false == &reserved_tv[0] && "b_false MUST be the first reserved tarval!");
+ assert(tarval_b_true == &reserved_tv[1] && "b_true MUST be the second reserved tarval!");
+
+ _null_value = null_value;
+
+ /* initialize the sets holding the tarvals with a comparison function and
+ * an initial size, which is the expected number of constants */
+ tarvals = new_set(cmp_tv, N_CONSTANTS);
+ values = new_set(memcmp, N_CONSTANTS);
+ /* calls init_strcalc() with needed size */
+ 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;
+ tarval_bad->mode = mode_BAD;
+ tarval_bad->value = INT_TO_PTR(resid_tarval_bad);
+
+ tarval_undefined->kind = k_tarval;
+ tarval_undefined->mode = mode_ANY;
+ tarval_undefined->value = INT_TO_PTR(resid_tarval_undefined);
+
+ tarval_b_true->kind = k_tarval;
+ tarval_b_true->mode = mode_b;
+ tarval_b_true->value = INT_TO_PTR(resid_tarval_b_true);
+
+ tarval_b_false->kind = k_tarval;
+ tarval_b_false->mode = mode_b;
+ tarval_b_false->value = INT_TO_PTR(resid_tarval_b_false);
+
+ tarval_unreachable->kind = k_tarval;
+ tarval_unreachable->mode = mode_X;
+ tarval_unreachable->value = INT_TO_PTR(resid_tarval_unreachable);
+
+ tarval_reachable->kind = k_tarval;
+ tarval_reachable->mode = mode_X;
+ tarval_reachable->value = INT_TO_PTR(resid_tarval_reachable);
+
+ /*
+ * assign output modes that are compatible with the
+ * old implementation: Hex output
+ */
+ set_tarval_mode_output_option(mode_Bs, &hex_output);
+ set_tarval_mode_output_option(mode_Bu, &hex_output);
+ set_tarval_mode_output_option(mode_Hs, &hex_output);
+ set_tarval_mode_output_option(mode_Hu, &hex_output);
+ set_tarval_mode_output_option(mode_Is, &hex_output);
+ set_tarval_mode_output_option(mode_Iu, &hex_output);
+ set_tarval_mode_output_option(mode_Ls, &hex_output);
+ set_tarval_mode_output_option(mode_Lu, &hex_output);
+ set_tarval_mode_output_option(mode_P, &hex_output);
+}
+
+/* free all memory occupied by tarval. */
+void finish_tarval(void)
+{
+ finish_strcalc();
+ finish_fltcalc();
+ del_set(tarvals); tarvals = NULL;
+ del_set(values); values = NULL;
+}
+
+int (is_tarval)(const void *thing)
+{
+ return _is_tarval(thing);