aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2006-04-05 02:46:02 +0000
committerEric Christopher <echristo@gcc.gnu.org>2006-04-05 02:46:02 +0000
commit77ccdfed20be3181783f90ab5045a0e433c0078e (patch)
tree9cbed5afb27c4d297627b51948fda590b6a52689
parentb3c2c547989a7070295df1fc2dbe4cca62f40c61 (diff)
downloadgcc-77ccdfed20be3181783f90ab5045a0e433c0078e.zip
gcc-77ccdfed20be3181783f90ab5045a0e433c0078e.tar.gz
gcc-77ccdfed20be3181783f90ab5045a0e433c0078e.tar.bz2
rs6000.c (TARGET_MS_BITFIELD_LAYOUT_P): Define.
2006-04-04 Eric Christopher <echristo@apple.com> * config/rs6000/rs6000.c (TARGET_MS_BITFIELD_LAYOUT_P): Define. (TARGET_USE_MS_BITFIELD_LAYOUT): Ditto. (rs6000_handle_struct_attribute): New. (rs6000_ms_bitfield_layout_p): Ditto. From-SVN: r112693
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/rs6000/rs6000.c59
2 files changed, 64 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 98a9a52..e9c21ad 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2006-04-04 Eric Christopher <echristo@apple.com>
+
+ * config/rs6000/rs6000.c (TARGET_MS_BITFIELD_LAYOUT_P): Define.
+ (TARGET_USE_MS_BITFIELD_LAYOUT): Ditto.
+ (rs6000_handle_struct_attribute): New.
+ (rs6000_ms_bitfield_layout_p): Ditto.
+
2006-04-04 Geoffrey Keating <geoffk@apple.com>
* config/darwin-crt3.c (atexit): Pass &__dso_handle rather than
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 63ee622..085fa72 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -602,6 +602,8 @@ static void rs6000_assemble_visibility (tree, int);
static int rs6000_ra_ever_killed (void);
static tree rs6000_handle_longcall_attribute (tree *, tree, tree, int, bool *);
static tree rs6000_handle_altivec_attribute (tree *, tree, tree, int, bool *);
+static bool rs6000_ms_bitfield_layout_p (tree);
+static tree rs6000_handle_struct_attribute (tree *, tree, tree, int, bool *);
static void rs6000_eliminate_indexed_memrefs (rtx operands[2]);
static const char *rs6000_mangle_fundamental_type (tree);
extern const struct attribute_spec rs6000_attribute_table[];
@@ -932,6 +934,9 @@ static const char alt_reg_names[][8] =
#define TARGET_BINDS_LOCAL_P darwin_binds_local_p
#endif
+#undef TARGET_MS_BITFIELD_LAYOUT_P
+#define TARGET_MS_BITFIELD_LAYOUT_P rs6000_ms_bitfield_layout_p
+
#undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK rs6000_output_mi_thunk
@@ -2104,7 +2109,7 @@ num_insns_constant (rtx op, enum machine_mode mode)
}
-/* Return true if OP can be synthesized with a particular vspltisb, vspltish
+/* Return true if OP can be synthesized with a particular vspltisb, vspltish
or vspltisw instruction. OP is a CONST_VECTOR. Which instruction is used
depends on STEP and COPIES, one of which will be 1. If COPIES > 1,
all items are set to the same value and contain COPIES replicas of the
@@ -2171,7 +2176,7 @@ vspltis_constant (rtx op, unsigned step, unsigned copies)
}
-/* Return true if OP is of the given MODE and can be synthesized
+/* Return true if OP is of the given MODE and can be synthesized
with a vspltisb, vspltish or vspltisw. */
bool
@@ -17349,6 +17354,8 @@ const struct attribute_spec rs6000_attribute_table[] =
{ "altivec", 1, 1, false, true, false, rs6000_handle_altivec_attribute },
{ "longcall", 0, 0, false, true, true, rs6000_handle_longcall_attribute },
{ "shortcall", 0, 0, false, true, true, rs6000_handle_longcall_attribute },
+ { "ms_struct", 0, 0, false, false, false, rs6000_handle_struct_attribute },
+ { "gcc_struct", 0, 0, false, false, false, rs6000_handle_struct_attribute },
#ifdef SUBTARGET_ATTRIBUTE_TABLE
SUBTARGET_ATTRIBUTE_TABLE,
#endif
@@ -17547,6 +17554,54 @@ rs6000_longcall_ref (rtx call_ref)
return force_reg (Pmode, call_ref);
}
+#ifndef TARGET_USE_MS_BITFIELD_LAYOUT
+#define TARGET_USE_MS_BITFIELD_LAYOUT 0
+#endif
+
+/* Handle a "ms_struct" or "gcc_struct" attribute; arguments as in
+ struct attribute_spec.handler. */
+static tree
+rs6000_handle_struct_attribute (tree *node, tree name,
+ tree args ATTRIBUTE_UNUSED,
+ int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
+{
+ tree *type = NULL;
+ if (DECL_P (*node))
+ {
+ if (TREE_CODE (*node) == TYPE_DECL)
+ type = &TREE_TYPE (*node);
+ }
+ else
+ type = node;
+
+ if (!(type && (TREE_CODE (*type) == RECORD_TYPE
+ || TREE_CODE (*type) == UNION_TYPE)))
+ {
+ warning (OPT_Wattributes, "%qs attribute ignored", IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ }
+
+ else if ((is_attribute_p ("ms_struct", name)
+ && lookup_attribute ("gcc_struct", TYPE_ATTRIBUTES (*type)))
+ || ((is_attribute_p ("gcc_struct", name)
+ && lookup_attribute ("ms_struct", TYPE_ATTRIBUTES (*type)))))
+ {
+ warning (OPT_Wattributes, "%qs incompatible attribute ignored",
+ IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
+static bool
+rs6000_ms_bitfield_layout_p (tree record_type)
+{
+ return (TARGET_USE_MS_BITFIELD_LAYOUT &&
+ !lookup_attribute ("gcc_struct", TYPE_ATTRIBUTES (record_type)))
+ || lookup_attribute ("ms_struct", TYPE_ATTRIBUTES (record_type));
+}
+
#ifdef USING_ELFOS_H
/* A get_unnamed_section callback, used for switching to toc_section. */