expr.c (store_expr): Assume lang_hooks.reduce_bit_field_operations is true.
authorPaolo Bonzini <bonzini@gnu.org>
Tue, 18 Mar 2008 17:11:30 +0000 (17:11 +0000)
committerPaolo Bonzini <bonzini@gcc.gnu.org>
Tue, 18 Mar 2008 17:11:30 +0000 (17:11 +0000)
2008-03-18  Paolo Bonzini  <bonzini@gnu.org>

        * expr.c (store_expr): Assume lang_hooks.reduce_bit_field_operations
        is true.
        (expand_expr_real_1) <REDUCE_BIT_FIELD>: Don't look at ignore.
        (expand_expr_real_1): Assume lang_hooks.reduce_bit_field_operations
        is true.  Add "&& !ignore" condition to reduce_bit_field.  Modify
        target after ignore has been set, and move there also the commputation
        of subtarget and original_target.
        * langhooks-def.h (LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS): Delete.
        (LANG_HOOKS_INITIALIZER): Remove it.
        * langhooks.h (struct lang_hooks): Remove reduce_bit_field_operations.

ada:
2008-03-18  Paolo Bonzini  <bonzini@gnu.org>

        * misc.c (LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS): Delete.

cp:
2008-03-18  Paolo Bonzini  <bonzini@gnu.org>

        * cp-lang.c (LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS): Delete.

From-SVN: r133316

gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/misc.c
gcc/cp/ChangeLog
gcc/cp/cp-lang.c
gcc/expr.c
gcc/langhooks-def.h
gcc/langhooks.h

index add3e25ad86b821e1498bcdfd0e11ab3035270b7..3a093c129054699156c4acdb4539006bbd8b4d08 100644 (file)
@@ -1,3 +1,16 @@
+2008-03-18  Paolo Bonzini  <bonzini@gnu.org>
+
+        * expr.c (store_expr): Assume lang_hooks.reduce_bit_field_operations
+        is true.
+        (expand_expr_real_1) <REDUCE_BIT_FIELD>: Don't look at ignore.
+        (expand_expr_real_1): Assume lang_hooks.reduce_bit_field_operations
+        is true.  Add "&& !ignore" condition to reduce_bit_field.  Modify
+        target after ignore has been set, and move there also the commputation
+        of subtarget and original_target.
+        * langhooks-def.h (LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS): Delete.
+        (LANG_HOOKS_INITIALIZER): Remove it.
+        * langhooks.h (struct lang_hooks): Remove reduce_bit_field_operations.
+
 2008-03-18  Richard Guenther  <rguenther@suse.de>
 
        * tree-ssa-sccvn.c (visit_reference_op_load): If the lookup
index 5960ea96fadd5fb74b36bcaf5592287c85df7dbf..9847af6633e4f7deb2f1107ea67502fc4c61cd96 100644 (file)
@@ -1,3 +1,7 @@
+2008-03-18  Paolo Bonzini  <bonzini@gnu.org>
+
+        * misc.c (LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS): Delete.
+       
 2008-03-15  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * gnat_rm.texi (Implementation Defined Characteristics)
index da0f2d96a0a0ec5801fdba22cccf7e5575195368..fbb6b8ecb77c655d0020b5c0d317eeb67f0f5c5a 100644 (file)
@@ -129,8 +129,6 @@ static tree gnat_type_max_size              (const_tree);
 #define LANG_HOOKS_WRITE_GLOBALS       gnat_write_global_declarations
 #undef  LANG_HOOKS_FINISH_INCOMPLETE_DECL
 #define LANG_HOOKS_FINISH_INCOMPLETE_DECL gnat_finish_incomplete_decl
-#undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
-#define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
 #undef  LANG_HOOKS_GET_ALIAS_SET
 #define LANG_HOOKS_GET_ALIAS_SET       gnat_get_alias_set
 #undef  LANG_HOOKS_EXPAND_EXPR
index d2ae223aaf32447e807196e6fb8eb71c66be06aa..a85346545c5e8a2123637150933fd5ddf678a7e3 100644 (file)
@@ -1,3 +1,7 @@
+2008-03-18  Paolo Bonzini  <bonzini@gnu.org>
+
+        * cp-lang.c (LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS): Delete.
+       
 2008-03-17  Jason Merrill  <jason@redhat.com>
 
        PR c++/35548
index b35f7f3811cdad53c93235a4e44a5f0260cc2ff4..70709298e9a88e2397bbf8bebc4ba10aab75d669 100644 (file)
@@ -57,8 +57,6 @@ static enum classify_record cp_classify_record (tree type);
 #define LANG_HOOKS_FOLD_OBJ_TYPE_REF cp_fold_obj_type_ref
 #undef LANG_HOOKS_INIT_TS
 #define LANG_HOOKS_INIT_TS cp_init_ts
-#undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
-#define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
 
 /* Each front end provides its own lang hook initializer.  */
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
index 83e8e442a8a0977144e7b2a08728b1dfb18e84f1..7e1a0ffa85bda0037955ced4929a14152665831c 100644 (file)
@@ -4484,9 +4484,8 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal)
         converting modes.  */
       if (INTEGRAL_TYPE_P (TREE_TYPE (exp))
          && TREE_TYPE (TREE_TYPE (exp)) == 0
-         && (!lang_hooks.reduce_bit_field_operations
-             || (GET_MODE_PRECISION (GET_MODE (target))
-                 == TYPE_PRECISION (TREE_TYPE (exp)))))
+         && GET_MODE_PRECISION (GET_MODE (target))
+            == TYPE_PRECISION (TREE_TYPE (exp)))
        {
          if (TYPE_UNSIGNED (TREE_TYPE (exp))
              != SUBREG_PROMOTED_UNSIGNED_P (target))
@@ -7134,8 +7133,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
   rtx subtarget, original_target;
   int ignore;
   tree context, subexp0, subexp1;
-  bool reduce_bit_field = false;
-#define REDUCE_BIT_FIELD(expr) (reduce_bit_field && !ignore              \
+  bool reduce_bit_field;
+#define REDUCE_BIT_FIELD(expr) (reduce_bit_field                         \
                                 ? reduce_to_bit_field_precision ((expr), \
                                                                  target, \
                                                                  type)   \
@@ -7153,27 +7152,20 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
       mode = TYPE_MODE (type);
       unsignedp = TYPE_UNSIGNED (type);
     }
-  if (lang_hooks.reduce_bit_field_operations
-      && TREE_CODE (type) == INTEGER_TYPE
-      && GET_MODE_PRECISION (mode) > TYPE_PRECISION (type))
-    {
-      /* An operation in what may be a bit-field type needs the
-        result to be reduced to the precision of the bit-field type,
-        which is narrower than that of the type's mode.  */
-      reduce_bit_field = true;
-      if (modifier == EXPAND_STACK_PARM)
-       target = 0;
-    }
 
-  /* Use subtarget as the target for operand 0 of a binary operation.  */
-  subtarget = get_subtarget (target);
-  original_target = target;
   ignore = (target == const0_rtx
            || ((code == NON_LVALUE_EXPR || code == NOP_EXPR
                 || code == CONVERT_EXPR || code == COND_EXPR
                 || code == VIEW_CONVERT_EXPR)
                && TREE_CODE (type) == VOID_TYPE));
 
+  /* An operation in what may be a bit-field type needs the
+     result to be reduced to the precision of the bit-field type,
+     which is narrower than that of the type's mode.  */
+  reduce_bit_field = (!ignore
+                     && TREE_CODE (type) == INTEGER_TYPE
+                     && GET_MODE_PRECISION (mode) > TYPE_PRECISION (type));
+
   /* If we are going to ignore this result, we need only do something
      if there is a side-effect somewhere in the expression.  If there
      is, short-circuit the most common cases here.  Note that we must
@@ -7222,6 +7214,12 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
       target = 0;
     }
 
+  if (reduce_bit_field && modifier == EXPAND_STACK_PARM)
+    target = 0;
+
+  /* Use subtarget as the target for operand 0 of a binary operation.  */
+  subtarget = get_subtarget (target);
+  original_target = target;
 
   switch (code)
     {
index 9f2cc71a431f349d05503801ddccf71554eb235e..bd3fdca6c385559b8646557d5a126f6aee9100a5 100644 (file)
@@ -97,7 +97,6 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
 #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_REDUCE_BIT_FIELD_OPERATIONS true
 #define LANG_HOOKS_NO_BODY_BLOCKS      false
 #define LANG_HOOKS_PRINT_STATISTICS    lhd_do_nothing
 #define LANG_HOOKS_PRINT_XNODE         lhd_print_tree_nothing
@@ -257,7 +256,6 @@ extern tree lhd_make_node (enum tree_code);
   LANG_HOOKS_STATICP, \
   LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \
   LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, \
-  LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS, \
   LANG_HOOKS_NO_BODY_BLOCKS, \
   LANG_HOOKS_PRINT_STATISTICS, \
   LANG_HOOKS_PRINT_XNODE, \
index 9da60f11b23184d5777ca47fe8a6b4921cd29e33..3ee23f69c0ffdb7aeb7cc7a9b438d628ab44adae 100644 (file)
@@ -329,10 +329,6 @@ struct lang_hooks
      assembler does not talk about it.  */
   void (*set_decl_assembler_name) (tree);
 
-  /* 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;
-
   /* Nonzero if this front end does not generate a dummy BLOCK between
      the outermost scope of the function and the FUNCTION_DECL.  See
      is_body_block in stmt.c, and its callers.  */