diff options
author | Geoffrey Keating <geoffk@apple.com> | 2003-07-17 21:52:51 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2003-07-17 21:52:51 +0000 |
commit | 26e0dcb3262e0b0dae53d60ef6a8ea3cce6b2e40 (patch) | |
tree | 29814f71f7c3a3908af1f0248cd905e9f4e13d0f /gcc/varasm.c | |
parent | 89e9faee226678f1298961f6ef75243f2c1b3b2c (diff) | |
download | gcc-26e0dcb3262e0b0dae53d60ef6a8ea3cce6b2e40.zip gcc-26e0dcb3262e0b0dae53d60ef6a8ea3cce6b2e40.tar.gz gcc-26e0dcb3262e0b0dae53d60ef6a8ea3cce6b2e40.tar.bz2 |
re PR middle-end/11498 (asm can't be used to give a variable its own name)
PR 11498
* Makefile.in (c-opts.o): Add $(LANGHOOKS_DEF_H).
(langhooks.o): Add $(GGC_H), gt-langhooks.h.
(GTFILES): Add langhooks.c.
(gt-langhooks.h): New.
* c-common.h (c_static_assembler_name): Prototype.
* c-lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): Define.
* objc/objc-lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): Define.
* c-opts.c: Include langhooks-def.h.
(c_static_assembler_name): New.
* langhooks.c: Include ggc.h. Include gt-langhooks.h.
(var_labelno): New.
(lhd_set_decl_assembler_name): Give static objects with context
unique names.
* varasm.c (var_labelno): Delete.
(make_decl_rtl): Don't change the assembler name once it's set.
From-SVN: r69527
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 6b02b34..9b02fe0 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -114,11 +114,6 @@ struct varasm_status GTY(()) static GTY(()) int const_labelno; -/* Number for making the label on the next - static variable internal to a function. */ - -static GTY(()) int var_labelno; - /* Carry information from ASM_DECLARE_OBJECT_NAME to ASM_FINISH_DECLARE_OBJECT. */ @@ -750,11 +745,7 @@ decode_reg_name (const char *asmspec) void make_decl_rtl (tree decl, const char *asmspec) { - int top_level = (DECL_CONTEXT (decl) == NULL_TREE - || (TREE_CODE (DECL_CONTEXT (decl)) - == TRANSLATION_UNIT_DECL)); const char *name = 0; - const char *new_name = 0; int reg_number; rtx x; @@ -794,8 +785,6 @@ make_decl_rtl (tree decl, const char *asmspec) return; } - new_name = name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - reg_number = decode_reg_name (asmspec); if (reg_number == -2) { @@ -804,9 +793,11 @@ make_decl_rtl (tree decl, const char *asmspec) char *starred = alloca (strlen (asmspec) + 2); starred[0] = '*'; strcpy (starred + 1, asmspec); - new_name = starred; + SET_DECL_ASSEMBLER_NAME (decl, get_identifier (starred)); } + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); + if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl)) { /* First detect errors in declaring global registers. */ @@ -878,28 +869,6 @@ make_decl_rtl (tree decl, const char *asmspec) if (TREE_CODE (decl) == VAR_DECL && DECL_WEAK (decl)) DECL_COMMON (decl) = 0; - /* Can't use just the variable's own name for a variable - whose scope is less than the whole file, unless it's a member - of a local class (which will already be unambiguous). - Concatenate a distinguishing number. */ - if (!top_level && !TREE_PUBLIC (decl) - && ! (DECL_CONTEXT (decl) && TYPE_P (DECL_CONTEXT (decl))) - && asmspec == 0 - && name == IDENTIFIER_POINTER (DECL_NAME (decl))) - { - char *label; - - ASM_FORMAT_PRIVATE_NAME (label, name, var_labelno); - var_labelno++; - new_name = label; - } - - if (name != new_name) - { - SET_DECL_ASSEMBLER_NAME (decl, get_identifier (new_name)); - name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - } - x = gen_rtx_SYMBOL_REF (Pmode, name); SYMBOL_REF_WEAK (x) = DECL_WEAK (decl); SYMBOL_REF_DECL (x) = decl; |