(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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159916
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
{ "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 =
{ 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. */
#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[];
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);
&& 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);
/* Address spaces. */
#define ADDR_SPACE_EA 1
-/* Named address space keywords. */
-#define TARGET_ADDR_SPACE_KEYWORDS ADDR_SPACE_KEYWORD ("__ea", ADDR_SPACE_EA)
-
/* Builtins. */
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