Commit ca7a3bd7 by Nathan Sidwell

tree.h (force_fit_type): Return a tree, take three flags.

	* tree.h (force_fit_type): Return a tree, take three flags.
	* fold-const.c (force_fit_type): Set TREE_OVERFLOW and
	TREE_CONSTANT_OVERFLOW here.
	(int_const_binop, const_binop): Adjust.
	(size_int_type): Do sign extension here.
	(fold_convert_const, optimize_bit_field_compare,
	decode_field_reference, all_ones_mask_p, fold_div_compare, fold,
	fold_negate_const, fold_abs_const, fold_not_const): Adjust.
	* tree.c (size_in_bytes, int_fits_type_p): Adjust.

	* cp/cvt.c (cp_convert_to_pointer): Adjust force_fit_type call.

	* java/jcf-parse.c (get_constant): Adjust force_fit_type call.
	* java/lex.h (SET_LVAL_NODE_TYPE): Remove.
	* java/lex.c (java_perform_atof): Use SET_LVAL_NODE directly.
	(do_java_lex): Likewise. Adjust force_fit_type call.

From-SVN: r85599
parent d36837f4
2004-08-05 Nathan Sidwell <nathan@codesourcery.com>
* tree.h (force_fit_type): Return a tree, take three flags.
* fold-const.c (force_fit_type): Set TREE_OVERFLOW and
TREE_CONSTANT_OVERFLOW here.
(int_const_binop, const_binop): Adjust.
(size_int_type): Do sign extension here.
(fold_convert_const, optimize_bit_field_compare,
decode_field_reference, all_ones_mask_p, fold_div_compare, fold,
fold_negate_const, fold_abs_const, fold_not_const): Adjust.
* tree.c (size_in_bytes, int_fits_type_p): Adjust.
2004-08-05 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> 2004-08-05 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
PR tree-optimization/16864 PR tree-optimization/16864
...@@ -268,7 +280,7 @@ ...@@ -268,7 +280,7 @@
* config/i386/xmmintrin.h: Include <mm_malloc.h>. * config/i386/xmmintrin.h: Include <mm_malloc.h>.
2004-08-03 H.J. Lu <hongjiu.lu@intel.com> 2004-08-03 H.J. Lu <hongjiu.lu@intel.com>
Tanguy Fautr <tfautre@pandora.be> Tanguy Fautrà <tfautre@pandora.be>
* config/i386/pmm_malloc.h: New file. * config/i386/pmm_malloc.h: New file.
......
2004-08-05 Nathan Sidwell <nathan@codesourcery.com>
* cvt.c (cp_convert_to_pointer): Adjust force_fit_type call.
2004-08-04 Geoffrey Keating <geoffk@apple.com> 2004-08-04 Geoffrey Keating <geoffk@apple.com>
* decl.c (make_rtl_for_nonlocal_decl): Set DECL_ASSEMBLER_NAME rather * decl.c (make_rtl_for_nonlocal_decl): Set DECL_ASSEMBLER_NAME rather
......
...@@ -267,8 +267,10 @@ cp_convert_to_pointer (tree type, tree expr, bool force) ...@@ -267,8 +267,10 @@ cp_convert_to_pointer (tree type, tree expr, bool force)
else else
expr = build_int_2 (0, 0); expr = build_int_2 (0, 0);
TREE_TYPE (expr) = type; TREE_TYPE (expr) = type;
/* Fix up the representation of -1 if appropriate. */ /* Fix up the representation of -1 if appropriate. */
force_fit_type (expr, 0); expr = force_fit_type (expr, 0, false, false);
return expr; return expr;
} }
else if (TYPE_PTR_TO_MEMBER_P (type) && INTEGRAL_CODE_P (form)) else if (TYPE_PTR_TO_MEMBER_P (type) && INTEGRAL_CODE_P (form))
......
2004-08-05 Nathan Sidwell <nathan@codesourcery.com>
* jcf-parse.c (get_constant): Adjust force_fit_type call.
* lex.h (SET_LVAL_NODE_TYPE): Remove.
* lex.c (java_perform_atof): Use SET_LVAL_NODE directly.
(do_java_lex): Likewise. Adjust force_fit_type call.
2004-08-04 Roger Sayle <roger@eyesopen.com> 2004-08-04 Roger Sayle <roger@eyesopen.com>
Andrew Haley <aph@redhat.com> Andrew Haley <aph@redhat.com>
......
...@@ -275,12 +275,13 @@ get_constant (JCF *jcf, int index) ...@@ -275,12 +275,13 @@ get_constant (JCF *jcf, int index)
unsigned HOST_WIDE_INT num = JPOOL_UINT (jcf, index); unsigned HOST_WIDE_INT num = JPOOL_UINT (jcf, index);
unsigned HOST_WIDE_INT lo; unsigned HOST_WIDE_INT lo;
HOST_WIDE_INT hi; HOST_WIDE_INT hi;
lshift_double (num, 0, 32, 64, &lo, &hi, 0); lshift_double (num, 0, 32, 64, &lo, &hi, 0);
num = JPOOL_UINT (jcf, index+1); num = JPOOL_UINT (jcf, index+1);
add_double (lo, hi, num, 0, &lo, &hi); add_double (lo, hi, num, 0, &lo, &hi);
value = build_int_2 (lo, hi); value = build_int_2 (lo, hi);
TREE_TYPE (value) = long_type_node; TREE_TYPE (value) = long_type_node;
force_fit_type (value, 0); value = force_fit_type (value, 0, false, false);
break; break;
} }
......
...@@ -939,7 +939,7 @@ java_perform_atof (YYSTYPE *java_lval, char *literal_token, int fflag, ...@@ -939,7 +939,7 @@ java_perform_atof (YYSTYPE *java_lval, char *literal_token, int fflag,
} }
} }
SET_LVAL_NODE_TYPE (build_real (type, value), type); SET_LVAL_NODE (build_real (type, value));
} }
#endif #endif
...@@ -1278,9 +1278,10 @@ do_java_lex (YYSTYPE *java_lval) ...@@ -1278,9 +1278,10 @@ do_java_lex (YYSTYPE *java_lval)
/* Range checking. */ /* Range checking. */
value = build_int_2 (low, high); value = build_int_2 (low, high);
/* Temporarily set type to unsigned. */ /* Temporarily set type to unsigned. */
SET_LVAL_NODE_TYPE (value, (long_suffix TREE_TYPE (value) = (long_suffix
? unsigned_long_type_node ? unsigned_long_type_node
: unsigned_int_type_node)); : unsigned_int_type_node);
SET_LVAL_NODE (value);
/* For base 10 numbers, only values up to the highest value /* For base 10 numbers, only values up to the highest value
(plus one) can be written. For instance, only ints up to (plus one) can be written. For instance, only ints up to
...@@ -1300,12 +1301,11 @@ do_java_lex (YYSTYPE *java_lval) ...@@ -1300,12 +1301,11 @@ do_java_lex (YYSTYPE *java_lval)
} }
/* Sign extend the value. */ /* Sign extend the value. */
SET_LVAL_NODE_TYPE (value, (long_suffix ? long_type_node : int_type_node)); TREE_TYPE (value) = long_suffix ? long_type_node : int_type_node;
force_fit_type (value, 0); value = force_fit_type (value, 0, false, false);
SET_LVAL_NODE (value);
JAVA_RADIX10_FLAG (value) = radix == 10; JAVA_RADIX10_FLAG (value) = radix == 10;
#else
SET_LVAL_NODE_TYPE (build_int_2 (low, high),
long_suffix ? long_type_node : int_type_node);
#endif #endif
return INT_LIT_TK; return INT_LIT_TK;
} }
...@@ -1314,6 +1314,7 @@ do_java_lex (YYSTYPE *java_lval) ...@@ -1314,6 +1314,7 @@ do_java_lex (YYSTYPE *java_lval)
if (c == '\'') if (c == '\'')
{ {
int char_lit; int char_lit;
if ((c = java_get_unicode ()) == '\\') if ((c = java_get_unicode ()) == '\\')
char_lit = java_parse_escape_sequence (); char_lit = java_parse_escape_sequence ();
else else
...@@ -1334,7 +1335,13 @@ do_java_lex (YYSTYPE *java_lval) ...@@ -1334,7 +1335,13 @@ do_java_lex (YYSTYPE *java_lval)
char_lit = 0; /* We silently convert it to zero. */ char_lit = 0; /* We silently convert it to zero. */
JAVA_LEX_CHAR_LIT (char_lit); JAVA_LEX_CHAR_LIT (char_lit);
SET_LVAL_NODE_TYPE (build_int_2 (char_lit, 0), char_type_node); #ifndef JC1_LITE
{
tree value = build_int_2 (char_lit, 0);
TREE_TYPE (value) = char_type_node;
SET_LVAL_NODE (value);
}
#endif
return CHAR_LIT_TK; return CHAR_LIT_TK;
} }
......
...@@ -188,7 +188,6 @@ extern void java_destroy_lexer (java_lexer *); ...@@ -188,7 +188,6 @@ extern void java_destroy_lexer (java_lexer *);
#define BUILD_OPERATOR(TOKEN) return TOKEN #define BUILD_OPERATOR(TOKEN) return TOKEN
#define BUILD_OPERATOR2(TOKEN) return ASSIGN_ANY_TK #define BUILD_OPERATOR2(TOKEN) return ASSIGN_ANY_TK
#define SET_LVAL_NODE(NODE) #define SET_LVAL_NODE(NODE)
#define SET_LVAL_NODE_TYPE(NODE, TYPE)
#define BUILD_ID_WFL(EXP) (EXP) #define BUILD_ID_WFL(EXP) (EXP)
#define JAVA_FLOAT_RANGE_ERROR(S) {} #define JAVA_FLOAT_RANGE_ERROR(S) {}
#define JAVA_INTEGRAL_RANGE_ERROR(S) do { } while (0) #define JAVA_INTEGRAL_RANGE_ERROR(S) do { } while (0)
...@@ -225,11 +224,6 @@ extern void java_destroy_lexer (java_lexer *); ...@@ -225,11 +224,6 @@ extern void java_destroy_lexer (java_lexer *);
} }
/* Set java_lval->node and TREE_TYPE(java_lval->node) in macros */ /* Set java_lval->node and TREE_TYPE(java_lval->node) in macros */
#define SET_LVAL_NODE(NODE) java_lval->node = (NODE) #define SET_LVAL_NODE(NODE) java_lval->node = (NODE)
#define SET_LVAL_NODE_TYPE(NODE,TYPE) \
{ \
java_lval->node = (NODE); \
TREE_TYPE (java_lval->node) = (TYPE); \
}
/* Wrap identifier around a wfl */ /* Wrap identifier around a wfl */
#define BUILD_ID_WFL(EXP) build_wfl_node ((EXP)) #define BUILD_ID_WFL(EXP) build_wfl_node ((EXP))
/* Special ways to report error on numeric literals */ /* Special ways to report error on numeric literals */
......
...@@ -1130,7 +1130,7 @@ size_in_bytes (tree type) ...@@ -1130,7 +1130,7 @@ size_in_bytes (tree type)
} }
if (TREE_CODE (t) == INTEGER_CST) if (TREE_CODE (t) == INTEGER_CST)
force_fit_type (t, 0); t = force_fit_type (t, 0, false, false);
return t; return t;
} }
...@@ -4563,7 +4563,8 @@ int_fits_type_p (tree c, tree type) ...@@ -4563,7 +4563,8 @@ int_fits_type_p (tree c, tree type)
{ {
c = copy_node (c); c = copy_node (c);
TREE_TYPE (c) = type; TREE_TYPE (c) = type;
return !force_fit_type (c, 0); c = force_fit_type (c, -1, false, false);
return !TREE_OVERFLOW (c);
} }
} }
......
...@@ -3384,7 +3384,8 @@ extern tree fold_single_bit_test (enum tree_code, tree, tree, tree); ...@@ -3384,7 +3384,8 @@ extern tree fold_single_bit_test (enum tree_code, tree, tree, tree);
extern tree fold_ignored_result (tree); extern tree fold_ignored_result (tree);
extern tree fold_abs_const (tree, tree); extern tree fold_abs_const (tree, tree);
extern int force_fit_type (tree, int); extern tree force_fit_type (tree, int, bool, bool);
extern int add_double (unsigned HOST_WIDE_INT, HOST_WIDE_INT, extern int add_double (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
unsigned HOST_WIDE_INT, HOST_WIDE_INT, unsigned HOST_WIDE_INT, HOST_WIDE_INT,
unsigned HOST_WIDE_INT *, HOST_WIDE_INT *); unsigned HOST_WIDE_INT *, HOST_WIDE_INT *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment