mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-09 02:56:44 +08:00
For PR java/6005 and PR java/7611:
* fold-const.c (fold_truthop): Use can_use_bit_fields_p. (fold): Likewise. * langhooks.c (lhd_can_use_bit_fields_p): New function. * langhooks-def.h (lhd_can_use_bit_fields_p): Declare. (LANG_HOOKS_CAN_USE_BIT_FIELDS_P): New define. (LANG_HOOKS_INITIALIZER): Use it. * langhooks.h (struct lang_hooks) [can_use_bit_fields_p]: New field. From-SVN: r56498
This commit is contained in:
parent
0d811e1a74
commit
57ce46bb22
@ -1,3 +1,15 @@
|
||||
2002-08-21 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
For PR java/6005 and PR java/7611:
|
||||
* fold-const.c (fold_truthop): Use can_use_bit_fields_p.
|
||||
(fold): Likewise.
|
||||
* langhooks.c (lhd_can_use_bit_fields_p): New function.
|
||||
* langhooks-def.h (lhd_can_use_bit_fields_p): Declare.
|
||||
(LANG_HOOKS_CAN_USE_BIT_FIELDS_P): New define.
|
||||
(LANG_HOOKS_INITIALIZER): Use it.
|
||||
* langhooks.h (struct lang_hooks) [can_use_bit_fields_p]: New
|
||||
field.
|
||||
|
||||
2002-08-21 Stan Shebs <shebs@apple.com>
|
||||
|
||||
* tree.c (finish_vector_type): Fix a typo in a comment.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Fold a constant sub-tree into a single node for C-compiler
|
||||
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
||||
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2002,
|
||||
1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
@ -3711,6 +3711,11 @@ fold_truthop (code, truth_type, lhs, rhs)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* After this point all optimizations will generate bit-field
|
||||
references, which we might not want. */
|
||||
if (! (*lang_hooks.can_use_bit_fields_p) ())
|
||||
return 0;
|
||||
|
||||
/* See if we can find a mode that contains both fields being compared on
|
||||
the left. If we can't, fail. Otherwise, update all constants and masks
|
||||
to be relative to a field of that size. */
|
||||
@ -6590,7 +6595,8 @@ fold (expr)
|
||||
}
|
||||
|
||||
/* If this is a comparison of a field, we may be able to simplify it. */
|
||||
if ((TREE_CODE (arg0) == COMPONENT_REF
|
||||
if (((TREE_CODE (arg0) == COMPONENT_REF
|
||||
&& (*lang_hooks.can_use_bit_fields_p) ())
|
||||
|| TREE_CODE (arg0) == BIT_FIELD_REF)
|
||||
&& (code == EQ_EXPR || code == NE_EXPR)
|
||||
/* Handle the constant case even without -O
|
||||
|
@ -59,6 +59,7 @@ extern rtx lhd_expand_expr PARAMS ((tree, rtx, enum machine_mode, int));
|
||||
extern void lhd_print_error_function PARAMS ((struct diagnostic_context *,
|
||||
const char *));
|
||||
extern void lhd_set_decl_assembler_name PARAMS ((tree));
|
||||
extern bool lhd_can_use_bit_fields_p PARAMS ((void));
|
||||
extern bool lhd_warn_unused_global_decl PARAMS ((tree));
|
||||
extern void lhd_incomplete_type_error PARAMS ((tree, tree));
|
||||
extern tree lhd_type_promotes_to PARAMS ((tree));
|
||||
@ -102,6 +103,7 @@ tree lhd_tree_inlining_convert_parm_for_inlining PARAMS ((tree, tree, tree));
|
||||
#define LANG_HOOKS_UNSAVE_EXPR_NOW lhd_unsave_expr_now
|
||||
#define LANG_HOOKS_MAYBE_BUILD_CLEANUP lhd_return_null_tree
|
||||
#define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lhd_set_decl_assembler_name
|
||||
#define LANG_HOOKS_CAN_USE_BIT_FIELDS_P lhd_can_use_bit_fields_p
|
||||
#define LANG_HOOKS_HONOR_READONLY false
|
||||
#define LANG_HOOKS_PRINT_STATISTICS lhd_do_nothing
|
||||
#define LANG_HOOKS_PRINT_XNODE lhd_print_tree_nothing
|
||||
@ -241,6 +243,7 @@ int lhd_tree_dump_type_quals PARAMS ((tree));
|
||||
LANG_HOOKS_UNSAVE_EXPR_NOW, \
|
||||
LANG_HOOKS_MAYBE_BUILD_CLEANUP, \
|
||||
LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, \
|
||||
LANG_HOOKS_CAN_USE_BIT_FIELDS_P, \
|
||||
LANG_HOOKS_HONOR_READONLY, \
|
||||
LANG_HOOKS_PRINT_STATISTICS, \
|
||||
LANG_HOOKS_PRINT_XNODE, \
|
||||
|
@ -175,6 +175,13 @@ lhd_set_decl_assembler_name (decl)
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* By default we always allow bit-field based optimizations. */
|
||||
bool
|
||||
lhd_can_use_bit_fields_p ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Provide a default routine to clear the binding stack. This is used
|
||||
by languages that don't need to do anything special. */
|
||||
void
|
||||
|
@ -299,6 +299,10 @@ struct lang_hooks
|
||||
assembler does not talk about it. */
|
||||
void (*set_decl_assembler_name) PARAMS ((tree));
|
||||
|
||||
/* Return nonzero if fold-const is free to use bit-field
|
||||
optimizations, for instance in fold_truthop(). */
|
||||
bool (*can_use_bit_fields_p) PARAMS ((void));
|
||||
|
||||
/* Nonzero if TYPE_READONLY and TREE_READONLY should always be honored. */
|
||||
bool honor_readonly;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user