/* create the type kinds. */
init_tpop();
/* create an obstack and put all tarvals in a pdeq */
- init_tarval_1(0l);
+ init_tarval_1(0l, /* support_quad_precision */0);
/* Builds a basic program representation, so modes can be added. */
init_irprog_1();
/* initialize all modes an ir node can consist of */
#include "xmalloc.h"
-/** The number of extra precesion rounding bits */
+/** The number of extra precision rounding bits */
#define ROUNDING_BITS 2
typedef uint32_t UINT32;
/* does nothing if already init */
if (precision == 0) precision = FC_DEFAULT_PRECISION;
- init_strcalc(precision + 4);
+ init_strcalc(precision + 2 + ROUNDING_BITS);
- /* needs additionally two bits to round, a bit as explicit 1., and one for
+ /* needs additionally rounding bits, one bit as explicit 1., and one for
* addition overflow */
- max_precision = sc_get_precision() - 4;
+ max_precision = sc_get_precision() - (2 + ROUNDING_BITS);
if (max_precision < precision)
printf("WARNING: not enough precision available, using %d\n", max_precision);
/*
* Initialization of the tarval module: called before init_mode()
*/
-void init_tarval_1(long null_value) {
+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!");
* an initial size, which is the expected number of constants */
tarvals = new_set(cmp_tv, N_CONSTANTS);
values = new_set(memcmp, N_CONSTANTS);
- /* init strcalc with precision of 68 to support floating point values with 64
- * bit mantissa (needs extra bits for rounding and overflow) */
- init_strcalc(68);
- init_fltcalc(0);
+ /* calls init_strcalc() with needed size */
+ init_fltcalc(support_quad_precision ? 112 : 64);
}
/*
*
* Call before init_mode().
*
- * @param null_value The reference mode NULL value, typical 0l
+ * @param null_value
+ * The reference mode NULL value, typical 0l
+ * @param support_quad_precision
+ * If non-zero, activate support for quad precision
*/
-void init_tarval_1(long null_value);
+void init_tarval_1(long null_value, int support_quad_precision);
/**
* Initialization of the tarval module.