OSDN Git Service

2009-04-16 Paolo Bonzini <bonzini@gnu.org>
authorbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Apr 2009 09:11:39 +0000 (09:11 +0000)
committerbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Apr 2009 09:11:39 +0000 (09:11 +0000)
* c-common.c (vector_targets_convertible_p, vector_types_convertible_p):
Use TYPE_VECTOR_OPAQUE instead of targetm.vector_opaque_p.
* c-typeck.c (really_start_incremental_init): Likewise.
* target-def.h (TARGET_VECTOR_OPAQUE_P): Remove.
(TARGET_INITIALIZER): Remove it.
* target.h (struct target): Remove vector_opaque_p.
* tree.c (build_opaque_vector_type): New.
* tree.h (TYPE_VECTOR_OPAQUE): New.
(build_opaque_vector_type): Declare.
* doc/tm.texi (TARGET_VECTOR_OPAQUE_P): Remove.
* config/rs6000/rs6000.c (build_opaque_vector_type,
rs6000_is_vector_type, TARGET_VECTOR_OPAQUE_P): Remove.
(rs6000_init_builtins): Use build_opaque_vector_type for
opaque_V4SI_type_node.

cp:
2009-04-16  Paolo Bonzini  <bonzini@gnu.org>

* decl.c (check_initializer): Use TYPE_VECTOR_OPAQUE
instead of targetm.vector_opaque_p.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146153 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-common.c
gcc/c-typeck.c
gcc/config/rs6000/rs6000.c
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/doc/tm.texi
gcc/target-def.h
gcc/target.h
gcc/tree.c
gcc/tree.h

index fa122a9..66374e5 100644 (file)
@@ -1,3 +1,20 @@
+2009-04-16  Paolo Bonzini  <bonzini@gnu.org>
+
+       * c-common.c (vector_targets_convertible_p, vector_types_convertible_p):
+       Use TYPE_VECTOR_OPAQUE instead of targetm.vector_opaque_p.
+       * c-typeck.c (really_start_incremental_init): Likewise.
+       * target-def.h (TARGET_VECTOR_OPAQUE_P): Remove.
+       (TARGET_INITIALIZER): Remove it.
+       * target.h (struct target): Remove vector_opaque_p.
+       * tree.c (build_opaque_vector_type): New.
+       * tree.h (TYPE_VECTOR_OPAQUE): New.
+       (build_opaque_vector_type): Declare.
+       * doc/tm.texi (TARGET_VECTOR_OPAQUE_P): Remove.
+       * config/rs6000/rs6000.c (build_opaque_vector_type,
+       rs6000_is_vector_type, TARGET_VECTOR_OPAQUE_P): Remove.
+       (rs6000_init_builtins): Use build_opaque_vector_type for
+       opaque_V4SI_type_node.
+
 2009-04-15  Catherine Moore  <clm@codesourcery.com>
 
         * debug.h (set_name):  Declare.
index 3d11455..77f7ebc 100644 (file)
@@ -1882,7 +1882,7 @@ bool
 vector_targets_convertible_p (const_tree t1, const_tree t2)
 {
   if (TREE_CODE (t1) == VECTOR_TYPE && TREE_CODE (t2) == VECTOR_TYPE
-      && (targetm.vector_opaque_p (t1) || targetm.vector_opaque_p (t2))
+      && (TYPE_VECTOR_OPAQUE (t1) || TYPE_VECTOR_OPAQUE (t2))
       && tree_int_cst_equal (TYPE_SIZE (t1), TYPE_SIZE (t2)))
     return true;
 
@@ -1900,7 +1900,7 @@ vector_types_convertible_p (const_tree t1, const_tree t2, bool emit_lax_note)
   static bool emitted_lax_note = false;
   bool convertible_lax;
 
-  if ((targetm.vector_opaque_p (t1) || targetm.vector_opaque_p (t2))
+  if ((TYPE_VECTOR_OPAQUE (t1) || TYPE_VECTOR_OPAQUE (t2))
       && tree_int_cst_equal (TYPE_SIZE (t1), TYPE_SIZE (t2)))
     return true;
 
index c6bb9f8..4b0dbbb 100644 (file)
@@ -5700,7 +5700,8 @@ really_start_incremental_init (tree type)
   if (type == 0)
     type = TREE_TYPE (constructor_decl);
 
-  if (targetm.vector_opaque_p (type))
+  if (TREE_CODE (type) == VECTOR_TYPE
+      && TYPE_VECTOR_OPAQUE (type))
     error ("opaque vector types cannot be initialized");
 
   p->type = constructor_type;
index b99f371..07131b7 100644 (file)
@@ -885,7 +885,6 @@ static rtx paired_expand_predicate_builtin (enum insn_code, tree, rtx);
 static void enable_mask_for_builtins (struct builtin_description *, int,
                                      enum rs6000_builtins,
                                      enum rs6000_builtins);
-static tree build_opaque_vector_type (tree, int);
 static void spe_init_builtins (void);
 static rtx spe_expand_builtin (tree, rtx, bool *);
 static rtx spe_expand_stv_builtin (enum insn_code, tree);
@@ -916,7 +915,6 @@ static void compute_save_world_info (rs6000_stack_t *info_ptr);
 static void is_altivec_return_reg (rtx, void *);
 static rtx generate_set_vrsave (rtx, rs6000_stack_t *, int);
 int easy_vector_constant (rtx, enum machine_mode);
-static bool rs6000_is_opaque_type (const_tree);
 static rtx rs6000_dwarf_register_span (rtx);
 static void rs6000_init_dwarf_reg_sizes_extra (tree);
 static rtx rs6000_legitimize_tls_address (rtx, enum tls_model);
@@ -1191,9 +1189,6 @@ static const char alt_reg_names[][8] =
 #undef TARGET_ADDRESS_COST
 #define TARGET_ADDRESS_COST hook_int_rtx_bool_0
 
-#undef TARGET_VECTOR_OPAQUE_P
-#define TARGET_VECTOR_OPAQUE_P rs6000_is_opaque_type
-
 #undef TARGET_DWARF_REGISTER_SPAN
 #define TARGET_DWARF_REGISTER_SPAN rs6000_dwarf_register_span
 
@@ -9362,15 +9357,6 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
   gcc_unreachable ();
 }
 
-static tree
-build_opaque_vector_type (tree node, int nunits)
-{
-  node = copy_node (node);
-  TYPE_MAIN_VARIANT (node) = node;
-  TYPE_CANONICAL (node) = node;
-  return build_vector_type (node, nunits);
-}
-
 static void
 rs6000_init_builtins (void)
 {
@@ -9391,7 +9377,7 @@ rs6000_init_builtins (void)
   opaque_V2SF_type_node = build_opaque_vector_type (float_type_node, 2);
   opaque_V2SI_type_node = build_opaque_vector_type (intSI_type_node, 2);
   opaque_p_V2SI_type_node = build_pointer_type (opaque_V2SI_type_node);
-  opaque_V4SI_type_node = copy_node (V4SI_type_node);
+  opaque_V4SI_type_node = build_opaque_vector_type (intSI_type_node, 4);
 
   /* The 'vector bool ...' types must be kept distinct from 'vector unsigned ...'
      types, especially in C++ land.  Similarly, 'vector pixel' is distinct from
@@ -22694,16 +22680,6 @@ rs6000_initial_elimination_offset (int from, int to)
   return offset;
 }
 
-/* Return true if TYPE is a SPE or AltiVec opaque type.  */
-
-static bool
-rs6000_is_opaque_type (const_tree type)
-{
-  return (type == opaque_V2SI_type_node
-             || type == opaque_V2SF_type_node
-             || type == opaque_V4SI_type_node);
-}
-
 static rtx
 rs6000_dwarf_register_span (rtx reg)
 {
index 0cd3460..c0fa5ba 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-16  Le-Chun Wu  <lcwu@google.com>
+
+       * decl.c (check_initializer): Use TYPE_VECTOR_OPAQUE
+       instead of targetm.vector_opaque_p.
+
 2009-04-15  Le-Chun Wu  <lcwu@google.com>
 
        PR c++/39551
index 2c13e84..707bd33 100644 (file)
@@ -5157,7 +5157,7 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
                       decl);
              init = build_tree_list (NULL_TREE, init);
            }
-         else if ((*targetm.vector_opaque_p) (type))
+         else if (TREE_CODE (type) == VECTOR_TYPE && TYPE_VECTOR_OPAQUE (type))
            {
              error ("opaque vector types cannot be initialized");
              init = error_mark_node;
index 0396a70..3f61f61 100644 (file)
@@ -1424,14 +1424,6 @@ floating-point arithmetic.
 The default definition of this macro returns false for all sizes.
 @end defmac
 
-@deftypefn {Target Hook} bool TARGET_VECTOR_OPAQUE_P (tree @var{type})
-This target hook should return @code{true} a vector is opaque.  That
-is, if no cast is needed when copying a vector value of type
-@var{type} into another vector lvalue of the same size.  Vector opaque
-types cannot be initialized.  The default is that there are no such
-types.
-@end deftypefn
-
 @deftypefn {Target Hook} bool TARGET_MS_BITFIELD_LAYOUT_P (tree @var{record_type})
 This target hook returns @code{true} if bit-fields in the given
 @var{record_type} are to be laid out following the rules of Microsoft
index 9e6693b..73e6943 100644 (file)
 #define TARGET_VECTOR_MODE_SUPPORTED_P hook_bool_mode_false
 #endif
 
-#ifndef TARGET_VECTOR_OPAQUE_P
-#define TARGET_VECTOR_OPAQUE_P hook_bool_const_tree_false
-#endif
-
 /* In hooks.c.  */
 #define TARGET_CANNOT_MODIFY_JUMPS_P hook_bool_void_false
 #define TARGET_BRANCH_TARGET_REGISTER_CLASS hook_int_void_no_regs
   TARGET_VALID_POINTER_MODE,                    \
   TARGET_SCALAR_MODE_SUPPORTED_P,              \
   TARGET_VECTOR_MODE_SUPPORTED_P,               \
-  TARGET_VECTOR_OPAQUE_P,                      \
   TARGET_RTX_COSTS,                            \
   TARGET_ADDRESS_COST,                         \
   TARGET_ALLOCATE_INITIAL_VALUE,               \
index a520e1c..608910a 100644 (file)
@@ -674,9 +674,6 @@ struct gcc_target
      for further details.  */
   bool (* vector_mode_supported_p) (enum machine_mode mode);
 
-  /* True if a vector is opaque.  */
-  bool (* vector_opaque_p) (const_tree);
-
   /* Compute a (partial) cost for rtx X.  Return true if the complete
      cost has been computed, and false if subexpressions should be
      scanned.  In either case, *TOTAL contains the cost result.  */
index a66479d..ac6c31e 100644 (file)
@@ -7970,6 +7970,19 @@ build_vector_type (tree innertype, int nunits)
   return make_vector_type (innertype, nunits, VOIDmode);
 }
 
+/* Similarly, but takes the inner type and number of units, which must be
+   a power of two.  */
+
+tree
+build_opaque_vector_type (tree innertype, int nunits)
+{
+  tree t;
+  innertype = build_distinct_type_copy (innertype);
+  t = make_vector_type (innertype, nunits, VOIDmode);
+  TYPE_VECTOR_OPAQUE (t) = true;
+  return t;
+}
+
 
 /* Build RESX_EXPR with given REGION_NUMBER.  */
 tree
index b191d43..e2423ee 100644 (file)
@@ -586,6 +586,9 @@ struct tree_common GTY(())
        STMT_IN_SSA_EDGE_WORKLIST in
            all expressions (tree-ssa-propagate.c)
 
+       TYPE_VECTOR_OPAQUE in
+          VECTOR_TYPE
+
    visited:
 
        TREE_VISITED in
@@ -2221,6 +2224,11 @@ extern enum machine_mode vector_type_mode (const_tree);
 #define SET_TYPE_VECTOR_SUBPARTS(VECTOR_TYPE, X) \
   (VECTOR_TYPE_CHECK (VECTOR_TYPE)->type.precision = exact_log2 (X))
 
+/* Nonzero in an IDENTIFIER_NODE if the name is a local alias, whose
+   uses are to be substituted for uses of the TREE_CHAINed identifier.  */
+#define TYPE_VECTOR_OPAQUE(NODE) \
+  (VECTOR_TYPE_CHECK (NODE)->base.deprecated_flag)
+
 /* Indicates that objects of this type must be initialized by calling a
    function when they are created.  */
 #define TYPE_NEEDS_CONSTRUCTING(NODE) \
@@ -3938,6 +3946,7 @@ extern tree build_reference_type_for_mode (tree, enum machine_mode, bool);
 extern tree build_reference_type (tree);
 extern tree build_vector_type_for_mode (tree, enum machine_mode);
 extern tree build_vector_type (tree innertype, int nunits);
+extern tree build_opaque_vector_type (tree innertype, int nunits);
 extern tree build_type_no_quals (tree);
 extern tree build_index_type (tree);
 extern tree build_index_2_type (tree, tree);