Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
354ec538
Commit
354ec538
authored
Aug 24, 2008
by
Michael Beck
Browse files
more tarval cleanup
[r21396]
parent
17b9af2a
Changes
4
Hide whitespace changes
Inline
Side-by-side
ir/common/firm.c
View file @
354ec538
...
...
@@ -114,7 +114,7 @@ void init_firm(const firm_parameter_t *param)
/* 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 */
...
...
ir/tv/fltcalc.c
View file @
354ec538
...
...
@@ -52,7 +52,7 @@
#include "xmalloc.h"
/** The number of extra prec
e
sion rounding bits */
/** The number of extra prec
i
sion rounding bits */
#define ROUNDING_BITS 2
typedef
uint32_t
UINT32
;
...
...
@@ -1531,11 +1531,11 @@ void init_fltcalc(int precision) {
/* 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
);
...
...
ir/tv/tv.c
View file @
354ec538
...
...
@@ -1756,7 +1756,7 @@ static const tarval_mode_info hex_output = {
/*
* 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!"
);
...
...
@@ -1767,10 +1767,8 @@ void init_tarval_1(long null_value) {
* 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
);
}
/*
...
...
ir/tv/tv_t.h
View file @
354ec538
...
...
@@ -50,9 +50,12 @@ enum reserved_id {
*
* 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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment