[gcjx] Patch: FYI: remove unused lang hook

Tom Tromey tromey@redhat.com
Sun Jan 23 01:48:00 GMT 2005


I'm checking this in on the gcjx branch.

The can_use_bit_fields_p lang hook, which existed only to work around
a limitation with gcj class file writing, is not needed by gcjx.  As
gcj was the only user, it makes sense to remove it.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* fold-const.c (fold_truthop): Don't use can_use_bit_fields_p.
	(fold): Likewise.
	* langhooks.c (lhd_can_use_bit_fields_p): Removed.
	* langhooks.h (struct lang_hooks) <can_use_bit_fields_p>:
	Removed.
	* langhooks-def.h (lhd_can_use_bit_fields_p): Removed
	declaration.
	(LANG_HOOKS_CAN_USE_BIT_FIELDS_P): Removed.
	(LANG_HOOKS_INITIALIZER): Don't mention
	LANG_HOOKS_CAN_USE_BIT_FIELDS_P.

Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.492
diff -u -r1.492 fold-const.c
--- fold-const.c 9 Jan 2005 22:27:07 -0000 1.492
+++ fold-const.c 23 Jan 2005 01:46:10 -0000
@@ -1,6 +1,6 @@
 /* Fold a constant sub-tree into a single node for C-compiler
    Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -4728,11 +4728,6 @@
 	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.  */
@@ -8895,8 +8890,7 @@
 	}
 
       /* If this is a comparison of a field, we may be able to simplify it.  */
-      if (((TREE_CODE (arg0) == COMPONENT_REF
-	    && lang_hooks.can_use_bit_fields_p ())
+      if ((TREE_CODE (arg0) == COMPONENT_REF
 	   || TREE_CODE (arg0) == BIT_FIELD_REF)
 	  && (code == EQ_EXPR || code == NE_EXPR)
 	  /* Handle the constant case even without -O
Index: langhooks.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks.c,v
retrieving revision 1.79
diff -u -r1.79 langhooks.c
--- langhooks.c 14 Oct 2004 23:15:19 -0000 1.79
+++ langhooks.c 23 Jan 2005 01:46:10 -0000
@@ -1,5 +1,5 @@
 /* Default language-specific hooks.
-   Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Alexandre Oliva  <aoliva@redhat.com>
 
 This file is part of GCC.
@@ -191,13 +191,6 @@
     abort ();
 }
 
-/* By default we always allow bit-field based optimizations.  */
-bool
-lhd_can_use_bit_fields_p (void)
-{
-  return true;
-}
-
 /* Type promotion for variable arguments.  */
 tree
 lhd_type_promotes_to (tree ARG_UNUSED (type))
Index: langhooks.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks.h,v
retrieving revision 1.102
diff -u -r1.102 langhooks.h
--- langhooks.h 14 Oct 2004 23:15:20 -0000 1.102
+++ langhooks.h 23 Jan 2005 01:46:13 -0000
@@ -1,5 +1,5 @@
 /* The lang_hooks data structure.
-   Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -322,10 +322,6 @@
      assembler does not talk about it.  */
   void (*set_decl_assembler_name) (tree);
 
-  /* Return nonzero if fold-const is free to use bit-field
-     optimizations, for instance in fold_truthop().  */
-  bool (*can_use_bit_fields_p) (void);
-
   /* Nonzero if operations on types narrower than their mode should
      have their results reduced to the precision of the type.  */
   bool reduce_bit_field_operations;
Index: langhooks-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks-def.h,v
retrieving revision 1.94
diff -u -r1.94 langhooks-def.h
--- langhooks-def.h 14 Oct 2004 23:15:19 -0000 1.94
+++ langhooks-def.h 23 Jan 2005 01:46:13 -0000
@@ -1,5 +1,5 @@
 /* Default macros to initialize the lang_hooks data structure.
-   Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Alexandre Oliva  <aoliva@redhat.com>
 
 This file is part of GCC.
@@ -59,7 +59,6 @@
 extern void lhd_print_error_function (struct diagnostic_context *,
 				      const char *);
 extern void lhd_set_decl_assembler_name (tree);
-extern bool lhd_can_use_bit_fields_p (void);
 extern bool lhd_warn_unused_global_decl (tree);
 extern void lhd_incomplete_type_error (tree, tree);
 extern tree lhd_type_promotes_to (tree);
@@ -109,7 +108,6 @@
 #define LANG_HOOKS_STATICP		lhd_staticp
 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL lhd_do_nothing_t
 #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_REDUCE_BIT_FIELD_OPERATIONS false
 #define LANG_HOOKS_NO_BODY_BLOCKS	false
 #define LANG_HOOKS_PRINT_STATISTICS	lhd_do_nothing
@@ -274,7 +272,6 @@
   LANG_HOOKS_STATICP, \
   LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \
   LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, \
-  LANG_HOOKS_CAN_USE_BIT_FIELDS_P, \
   LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS, \
   LANG_HOOKS_NO_BODY_BLOCKS, \
   LANG_HOOKS_PRINT_STATISTICS, \



More information about the Java-patches mailing list