aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/c-common.c36
-rw-r--r--gcc/c-common.h5
-rw-r--r--gcc/config/spu/spu.h4
-rw-r--r--gcc/doc/tm.texi13
5 files changed, 45 insertions, 27 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 52ab87e..b752ec0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2010-05-27 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * c-common.h (c_register_addr_space): Add prototype.
+ (ADDR_SPACE_KEYWORD): Remove.
+ * c-common.c (c_register_addr_space): New function.
+ (c_addr_space_name): Reimplement.
+ (c_common_reswords): Do not include TARGET_ADDR_SPACE_KEYWORDS.
+
+ * config/spu/spu.h (TARGET_ADDR_SPACE_KEYWORDS): Remove.
+ (REGISTER_TARGET_PRAGMAS): Call c_register_addr_space.
+
+ * doc/tm.texi (Named Address Spaces): Mention c_register_addr_space.
+ Remove TARGET_ADDR_SPACE_KEYWORDS.
+
2010-05-27 Joseph Myers <joseph@codesourcery.com>
* input.c: New file.
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 68fa9cf..b839030 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -718,11 +718,6 @@ const struct c_common_resword c_common_reswords[] =
{ "inout", RID_INOUT, D_OBJC },
{ "oneway", RID_ONEWAY, D_OBJC },
{ "out", RID_OUT, D_OBJC },
-
-#ifdef TARGET_ADDR_SPACE_KEYWORDS
- /* Any address space keywords recognized by the target. */
- TARGET_ADDR_SPACE_KEYWORDS,
-#endif
};
const unsigned int num_c_common_reswords =
@@ -857,17 +852,34 @@ const struct attribute_spec c_common_format_attribute_table[] =
{ NULL, 0, 0, false, false, false, NULL }
};
+
+/* Register reserved keyword WORD as qualifier for address space AS. */
+
+void
+c_register_addr_space (const char *word, addr_space_t as)
+{
+ int rid = RID_FIRST_ADDR_SPACE + as;
+ tree id;
+
+ /* Address space qualifiers are only supported
+ in C with GNU extensions enabled. */
+ if (c_dialect_cxx () || c_dialect_objc () || flag_no_asm)
+ return;
+
+ id = get_identifier (word);
+ C_SET_RID_CODE (id, rid);
+ C_IS_RESERVED_WORD (id) = 1;
+ ridpointers [rid] = id;
+}
+
/* Return identifier for address space AS. */
+
const char *
c_addr_space_name (addr_space_t as)
{
- unsigned int i;
-
- for (i = 0; i < num_c_common_reswords; i++)
- if (c_common_reswords[i].rid == RID_FIRST_ADDR_SPACE + as)
- return c_common_reswords[i].word;
-
- gcc_unreachable ();
+ int rid = RID_FIRST_ADDR_SPACE + as;
+ gcc_assert (ridpointers [rid]);
+ return IDENTIFIER_POINTER (ridpointers [rid]);
}
/* Push current bindings for the function name VAR_DECLS. */
diff --git a/gcc/c-common.h b/gcc/c-common.h
index d53fa0d..039edbe 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -288,10 +288,6 @@ struct c_common_resword
#define D_CXX_OBJC 0x100 /* In Objective C, and C++, but not C. */
#define D_CXXWARN 0x200 /* In C warn with -Wcxx-compat. */
-/* Macro for backends to define named address keywords. */
-#define ADDR_SPACE_KEYWORD(STRING, VALUE) \
- { STRING, RID_FIRST_ADDR_SPACE + (VALUE), D_CONLY | D_EXT }
-
/* The reserved keyword table. */
extern const struct c_common_resword c_common_reswords[];
@@ -803,6 +799,7 @@ extern const struct attribute_spec c_common_format_attribute_table[];
extern tree (*make_fname_decl) (location_t, tree, int);
+extern void c_register_addr_space (const char *str, addr_space_t as);
extern const char *c_addr_space_name (addr_space_t as);
extern tree identifier_global_value (tree);
extern void record_builtin_type (enum rid, const char *, tree);
diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h
index 6d6a306..c8b0e12 100644
--- a/gcc/config/spu/spu.h
+++ b/gcc/config/spu/spu.h
@@ -245,6 +245,7 @@ enum reg_class {
&& GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO))
#define REGISTER_TARGET_PRAGMAS() do { \
+c_register_addr_space ("__ea", ADDR_SPACE_EA); \
targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \
}while (0);
@@ -608,9 +609,6 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \
/* Address spaces. */
#define ADDR_SPACE_EA 1
-/* Named address space keywords. */
-#define TARGET_ADDR_SPACE_KEYWORDS ADDR_SPACE_KEYWORD ("__ea", ADDR_SPACE_EA)
-
/* Builtins. */
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index b0175ea..de56de6 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -9966,17 +9966,14 @@ Internally, address spaces are represented as a small integer in the
range 0 to 15 with address space 0 being reserved for the generic
address space.
-@defmac TARGET_ADDR_SPACE_KEYWORDS
-A list of @code{ADDR_SPACE_KEYWORD} macros to define each named
-address keyword. The @code{ADDR_SPACE_KEYWORD} macro takes two
-arguments, the keyword string and the number of the named address
-space. For example, the SPU port uses the following to declare
-@code{__ea} as the keyword for named address space #1:
+To register a named address space qualifier keyword with the C front end,
+the target may call the @code{c_register_addr_space} routine. For example,
+the SPU port uses the following to declare @code{__ea} as the keyword for
+named address space #1:
@smallexample
#define ADDR_SPACE_EA 1
-#define TARGET_ADDR_SPACE_KEYWORDS ADDR_SPACE_KEYWORD ("__ea", ADDR_SPACE_EA)
+c_register_addr_space ("__ea", ADDR_SPACE_EA);
@end smallexample
-@end defmac
@deftypefn {Target Hook} {enum machine_mode} TARGET_ADDR_SPACE_POINTER_MODE (addr_space_t @var{address_space})
Define this to return the machine mode to use for pointers to