summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2002-08-22 00:42:40 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2002-08-22 00:42:40 +0000
commitd50b22afcdae7245cbef3749e85f2cce581d47f4 (patch)
treeab953fd73d6634557761e02e3e308f4b315d6dc6 /gcc/fold-const.c
parent8531f242aa7ca71d1aa333f56c747f5b106781e1 (diff)
downloadgcc-d50b22afcdae7245cbef3749e85f2cce581d47f4.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56498 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 033dbfcfc62..b8da1a74b26 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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