aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@codesourcery.com>2002-05-28 17:33:14 +0000
committerZack Weinberg <zack@gcc.gnu.org>2002-05-28 17:33:14 +0000
commit11ad4784f3f1acda9ddd4032be6f91cbfc70aad2 (patch)
tree005b9830ad50445b6392fd80c98e1ea6584a5deb /gcc/tree.c
parentbf77398cef20e7f1d079bb8b76d383c4ca163165 (diff)
downloadgcc-11ad4784f3f1acda9ddd4032be6f91cbfc70aad2.zip
gcc-11ad4784f3f1acda9ddd4032be6f91cbfc70aad2.tar.gz
gcc-11ad4784f3f1acda9ddd4032be6f91cbfc70aad2.tar.bz2
tree.h: Forward-declare struct realvaluetype.
* tree.h: Forward-declare struct realvaluetype. (struct tree_real_cst): Point to the REAL_VALUE_TYPE, do not contain it. (TREE_REAL_CST_PTR): New accessor. (TREE_REAL_CST): Update. * real.h: Include machmode.h. (realvaluetype): Make it struct realvaluetype, not a typedef. (build_real): Prototype here. * tree.c: Include real.h. (build_real): Allocate the REAL_VALUE_TYPE as a separate object in GC memory, set TREE_REAL_CST_PTR to point to it. (build_real_from_int_cst): Use build_real. * ggc-common.c (ggc_mark_trees): Mark TREE_REAL_CST_PTR of a REAL_CST. * builtins.c, c-common.c, c-lex.c, dwarf2out.c, expr.c, fold-const.c, print-tree.c, real.c, cp/mangle.c, cp/tree.c, f/bld.c, f/com.c, f/expr.c, f/target.c, java/decl.c, java/jcf-parse.c, java/parse.y, java/typeck.c: Include real.h. * Makefile.in, cp/Make-lang.in, f/Make-lang.in, java/Make-lang.in: Update dependency lists. From-SVN: r53959
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 58ec6f8..d4c6e4f 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -37,6 +37,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "system.h"
#include "flags.h"
#include "tree.h"
+#include "real.h"
#include "tm_p.h"
#include "function.h"
#include "obstack.h"
@@ -509,6 +510,7 @@ build_real (type, d)
REAL_VALUE_TYPE d;
{
tree v;
+ REAL_VALUE_TYPE *dp;
int overflow = 0;
/* Check for valid float value for this type on this target machine;
@@ -518,8 +520,11 @@ build_real (type, d)
#endif
v = make_node (REAL_CST);
+ dp = ggc_alloc (sizeof (REAL_VALUE_TYPE));
+ memcpy (dp, &d, sizeof (REAL_VALUE_TYPE));
+
TREE_TYPE (v) = type;
- TREE_REAL_CST (v) = d;
+ TREE_REAL_CST_PTR (v) = dp;
TREE_OVERFLOW (v) = TREE_CONSTANT_OVERFLOW (v) = overflow;
return v;
}
@@ -556,20 +561,11 @@ build_real_from_int_cst (type, i)
{
tree v;
int overflow = TREE_OVERFLOW (i);
- REAL_VALUE_TYPE d;
- v = make_node (REAL_CST);
- TREE_TYPE (v) = type;
+ v = build_real (type, real_value_from_int_cst (type, i));
- d = real_value_from_int_cst (type, i);
-
- /* Check for valid float value for this type on this target machine. */
-#ifdef CHECK_FLOAT_VALUE
- CHECK_FLOAT_VALUE (TYPE_MODE (type), d, overflow);
-#endif
-
- TREE_REAL_CST (v) = d;
- TREE_OVERFLOW (v) = TREE_CONSTANT_OVERFLOW (v) = overflow;
+ TREE_OVERFLOW (v) |= overflow;
+ TREE_CONSTANT_OVERFLOW (v) |= overflow;
return v;
}