aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2010-05-27 11:46:06 +0000
committerUlrich Weigand <uweigand@gcc.gnu.org>2010-05-27 11:46:06 +0000
commit3ef0694cb173c80c3466885de23fa937c8903653 (patch)
tree7d09050af3ae6ae27846c43f8d5696a77c6f6d51 /gcc/c-common.c
parentade526578e2ee8bbf16574da2c99353aac71f1ec (diff)
downloadgcc-3ef0694cb173c80c3466885de23fa937c8903653.zip
gcc-3ef0694cb173c80c3466885de23fa937c8903653.tar.gz
gcc-3ef0694cb173c80c3466885de23fa937c8903653.tar.bz2
c-common.h (c_register_addr_space): Add prototype.
* 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. From-SVN: r159916
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c36
1 files changed, 24 insertions, 12 deletions
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. */