re PR c/14516 (-fleading-underscore does not work correctly for file static variables)

2004-08-04  Geoffrey Keating  <geoffk@apple.com>

	PR 14516
	* c-common.c (c_expand_decl): Don't special-case static VAR_DECLs.
	* c-common.h (make_rtl_for_local_static): Delete.
	* c-decl.c (shadow_tag_warned): Clean up comment.
	(finish_decl): Clean up spacing.  Use set_user_assembler_name when
	appropriate.  Don't pass asmspec to rest_of_decl_compilation.
	* c-semantics.c (make_rtl_for_local_static): Delete.
	* expr.c (init_block_move_fn): Use set_user_assembler_name.
	(init_block_clear_fn): Likewise.
	* passes.c (rest_of_decl_compilation): Remove asmspec parameter,
	expect it to be in DECL_ASSEMBLER_NAME.  Update callers in many files.
	* toplev.h (rest_of_decl_compilation): Remove asmspec parameter.
	* tree.h (make_decl_rtl): Remove second parameter.
	(set_user_assembler_name): New.
	* varasm.c (set_user_assembler_name): New.
	(make_decl_rtl): Remove second parameter.  Update callers in many
	files.

Index: cp/ChangeLog
2004-08-04  Geoffrey Keating  <geoffk@apple.com>

	* decl.c (make_rtl_for_nonlocal_decl): Set DECL_ASSEMBLER_NAME rather
	than passing it as a parameter to rest_of_decl_compilation.
	* decl2.c (grokfield): Use set_user_assembler_name.

From-SVN: r85593
This commit is contained in:
Geoffrey Keating 2004-08-05 05:52:01 +00:00 committed by Geoffrey Keating
parent 99b1c586a5
commit 0e6df31e19
32 changed files with 216 additions and 266 deletions

View file

@ -1,3 +1,23 @@
2004-08-04 Geoffrey Keating <geoffk@apple.com>
PR 14516
* c-common.c (c_expand_decl): Don't special-case static VAR_DECLs.
* c-common.h (make_rtl_for_local_static): Delete.
* c-decl.c (shadow_tag_warned): Clean up comment.
(finish_decl): Clean up spacing. Use set_user_assembler_name when
appropriate. Don't pass asmspec to rest_of_decl_compilation.
* c-semantics.c (make_rtl_for_local_static): Delete.
* expr.c (init_block_move_fn): Use set_user_assembler_name.
(init_block_clear_fn): Likewise.
* passes.c (rest_of_decl_compilation): Remove asmspec parameter,
expect it to be in DECL_ASSEMBLER_NAME. Update callers in many files.
* toplev.h (rest_of_decl_compilation): Remove asmspec parameter.
* tree.h (make_decl_rtl): Remove second parameter.
(set_user_assembler_name): New.
* varasm.c (set_user_assembler_name): New.
(make_decl_rtl): Remove second parameter. Update callers in many
files.
2004-08-05 Adam Nemet <anemet@lnxw.com>
* config.gcc (case i[34567]86-*-lynxos*): Update to LynxOS 4.0.

View file

@ -1270,7 +1270,7 @@ create_type_decl (tree type_name, tree type, struct attrib *attr_list,
else if (code != ENUMERAL_TYPE && code != RECORD_TYPE
&& !((code == POINTER_TYPE || code == REFERENCE_TYPE)
&& TYPE_IS_DUMMY_P (TREE_TYPE (type))))
rest_of_decl_compilation (type_decl, NULL, global_bindings_p (), 0);
rest_of_decl_compilation (type_decl, global_bindings_p (), 0);
if (!TYPE_IS_DUMMY_P (type))
gnat_pushdecl (type_decl, gnat_node);
@ -1354,7 +1354,7 @@ create_var_decl (tree var_name, tree asm_name, tree type, tree var_init,
TREE_ADDRESSABLE (var_decl) = 1;
if (TREE_CODE (var_decl) != CONST_DECL)
rest_of_decl_compilation (var_decl, 0, global_bindings_p (), 0);
rest_of_decl_compilation (var_decl, global_bindings_p (), 0);
return var_decl;
}
@ -1707,7 +1707,7 @@ create_subprog_decl (tree subprog_name, tree asm_name,
gnat_pushdecl (subprog_decl, gnat_node);
/* Output the assembler code and/or RTL for the declaration. */
rest_of_decl_compilation (subprog_decl, 0, global_bindings_p (), 0);
rest_of_decl_compilation (subprog_decl, global_bindings_p (), 0);
return subprog_decl;
}
@ -2542,7 +2542,7 @@ update_pointer_to (tree old_type, tree new_type)
if (TYPE_NAME (ptr1)
&& TREE_CODE (TYPE_NAME (ptr1)) == TYPE_DECL
&& TREE_CODE (new_type) != ENUMERAL_TYPE)
rest_of_decl_compilation (TYPE_NAME (ptr1), NULL,
rest_of_decl_compilation (TYPE_NAME (ptr1),
global_bindings_p (), 0);
}
@ -2555,7 +2555,7 @@ update_pointer_to (tree old_type, tree new_type)
if (TYPE_NAME (ref1)
&& TREE_CODE (TYPE_NAME (ref1)) == TYPE_DECL
&& TREE_CODE (new_type) != ENUMERAL_TYPE)
rest_of_decl_compilation (TYPE_NAME (ref1), NULL,
rest_of_decl_compilation (TYPE_NAME (ref1),
global_bindings_p (), 0);
}
}

View file

@ -770,8 +770,6 @@ c_expand_decl (tree decl)
expand_anon_union_decl (decl, NULL_TREE,
DECL_ANON_UNION_ELEMS (decl));
}
else if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
make_rtl_for_local_static (decl);
else
return 0;

View file

@ -789,7 +789,6 @@ extern int anon_aggr_type_p (tree);
(DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) = 0)
extern void emit_local_var (tree);
extern void make_rtl_for_local_static (tree);
extern tree do_case (tree, tree);
extern tree build_stmt (enum tree_code, ...);
extern tree build_case_label (tree, tree, tree);

View file

@ -1714,7 +1714,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
&& (TREE_CODE (olddecl) == FUNCTION_DECL
|| (TREE_CODE (olddecl) == VAR_DECL
&& TREE_STATIC (olddecl))))
make_decl_rtl (olddecl, NULL);
make_decl_rtl (olddecl);
}
/* Handle when a new declaration NEWDECL has the same name as an old
@ -2117,7 +2117,7 @@ implicitly_declare (tree functionid)
decl = pushdecl (decl);
/* No need to call objc_check_decl here - it's a function type. */
rest_of_decl_compilation (decl, NULL, 0, 0);
rest_of_decl_compilation (decl, 0, 0);
/* Write a record describing this implicit function declaration
to the prototypes file (if requested). */
@ -2552,12 +2552,10 @@ shadow_tag (tree declspecs)
shadow_tag_warned (declspecs, 0);
}
/* WARNED is 1 if we have done a pedwarn, 2 if we have done a warning,
but no pedwarn. */
void
shadow_tag_warned (tree declspecs, int warned)
/* 1 => we have done a pedwarn. 2 => we have done a warning, but
no pedwarn. */
{
int found_tag = 0;
tree link;
@ -2895,8 +2893,8 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
store_init_value (decl, init);
if (c_dialect_objc () && (TREE_CODE (decl) == VAR_DECL
|| TREE_CODE (decl) == FUNCTION_DECL
|| TREE_CODE (decl) == FIELD_DECL))
|| TREE_CODE (decl) == FUNCTION_DECL
|| TREE_CODE (decl) == FIELD_DECL))
objc_check_decl (decl);
/* Deduce size of array from initialization, if not already known. */
@ -2937,7 +2935,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
in the array, because we start counting at zero. Therefore,
warn only if the value is less than zero. */
else if (pedantic && TYPE_DOMAIN (type) != 0
&& tree_int_cst_sgn (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) < 0)
&& tree_int_cst_sgn (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) < 0)
error ("%Jzero or negative size array '%D'", decl, decl);
layout_decl (decl, 0);
@ -2953,22 +2951,20 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
/* Don't give an error if we already gave one earlier. */
&& TREE_TYPE (decl) != error_mark_node
&& (TREE_STATIC (decl)
?
/* A static variable with an incomplete type
is an error if it is initialized.
Also if it is not file scope.
Otherwise, let it through, but if it is not `extern'
then it may cause an error message later. */
(DECL_INITIAL (decl) != 0
/* A static variable with an incomplete type
is an error if it is initialized.
Also if it is not file scope.
Otherwise, let it through, but if it is not `extern'
then it may cause an error message later. */
? (DECL_INITIAL (decl) != 0
|| !DECL_FILE_SCOPE_P (decl))
:
/* An automatic variable with an incomplete type
is an error. */
!DECL_EXTERNAL (decl)))
{
error ("%Jstorage size of '%D' isn't known", decl, decl);
TREE_TYPE (decl) = error_mark_node;
}
/* An automatic variable with an incomplete type
is an error. */
: !DECL_EXTERNAL (decl)))
{
error ("%Jstorage size of '%D' isn't known", decl, decl);
TREE_TYPE (decl) = error_mark_node;
}
if ((DECL_EXTERNAL (decl) || TREE_STATIC (decl))
&& DECL_SIZE (decl) != 0)
@ -2988,24 +2984,16 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
was a normal built-in. */
if (TREE_CODE (decl) == FUNCTION_DECL && asmspec)
{
/* ASMSPEC is given, and not the name of a register. Mark the
name with a star so assemble_name won't munge it. */
char *starred = (char *) alloca (strlen (asmspec) + 2);
starred[0] = '*';
strcpy (starred + 1, asmspec);
if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
{
tree builtin = built_in_decls [DECL_FUNCTION_CODE (decl)];
SET_DECL_RTL (builtin, NULL_RTX);
change_decl_assembler_name (builtin, get_identifier (starred));
if (DECL_FUNCTION_CODE (decl) == BUILT_IN_MEMCPY)
init_block_move_fn (starred);
else if (DECL_FUNCTION_CODE (decl) == BUILT_IN_MEMSET)
init_block_clear_fn (starred);
}
SET_DECL_RTL (decl, NULL_RTX);
change_decl_assembler_name (decl, get_identifier (starred));
set_user_assembler_name (builtin, asmspec);
if (DECL_FUNCTION_CODE (decl) == BUILT_IN_MEMCPY)
init_block_move_fn (asmspec);
else if (DECL_FUNCTION_CODE (decl) == BUILT_IN_MEMSET)
init_block_clear_fn (asmspec);
}
set_user_assembler_name (decl, asmspec);
}
/* If #pragma weak was used, mark the decl weak now. */
@ -3022,6 +3010,25 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
if (c_dialect_objc ())
objc_check_decl (decl);
if (asmspec)
{
/* If this is not a static variable, issue a warning.
It doesn't make any sense to give an ASMSPEC for an
ordinary, non-register local variable. Historically,
GCC has accepted -- but ignored -- the ASMSPEC in
this case. */
if (! DECL_FILE_SCOPE_P (decl)
&& TREE_CODE (decl) == VAR_DECL
&& !C_DECL_REGISTER (decl)
&& !TREE_STATIC (decl))
warning ("%Jignoring asm-specifier for non-static local "
"variable '%D'", decl, decl);
else if (C_DECL_REGISTER (decl))
change_decl_assembler_name (decl, get_identifier (asmspec));
else
set_user_assembler_name (decl, asmspec);
}
if (DECL_FILE_SCOPE_P (decl))
{
if (DECL_INITIAL (decl) == NULL_TREE
@ -3030,44 +3037,27 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
when a tentative file-scope definition is seen.
But at end of compilation, do output code for them. */
DECL_DEFER_OUTPUT (decl) = 1;
rest_of_decl_compilation (decl, asmspec, true, 0);
rest_of_decl_compilation (decl, true, 0);
}
else
{
/* This is a local variable. If there is an ASMSPEC, the
user has requested that we handle it specially. */
if (asmspec)
/* In conjunction with an ASMSPEC, the `register'
keyword indicates that we should place the variable
in a particular register. */
if (asmspec && C_DECL_REGISTER (decl))
{
/* In conjunction with an ASMSPEC, the `register'
keyword indicates that we should place the variable
in a particular register. */
if (C_DECL_REGISTER (decl))
{
DECL_HARD_REGISTER (decl) = 1;
/* This cannot be done for a structure with volatile
fields, on which DECL_REGISTER will have been
reset. */
if (!DECL_REGISTER (decl))
error ("cannot put object with volatile field into register");
}
/* If this is not a static variable, issue a warning.
It doesn't make any sense to give an ASMSPEC for an
ordinary, non-register local variable. Historically,
GCC has accepted -- but ignored -- the ASMSPEC in
this case. */
if (TREE_CODE (decl) == VAR_DECL
&& !C_DECL_REGISTER (decl)
&& !TREE_STATIC (decl))
warning ("%Jignoring asm-specifier for non-static local "
"variable '%D'", decl, decl);
else
change_decl_assembler_name (decl, get_identifier (asmspec));
DECL_HARD_REGISTER (decl) = 1;
/* This cannot be done for a structure with volatile
fields, on which DECL_REGISTER will have been
reset. */
if (!DECL_REGISTER (decl))
error ("cannot put object with volatile field into register");
}
if (TREE_CODE (decl) != FUNCTION_DECL)
add_stmt (build_stmt (DECL_EXPR, decl));
}
if (!DECL_FILE_SCOPE_P (decl))
{
@ -3095,7 +3085,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
&& variably_modified_type_p (TREE_TYPE (decl), NULL_TREE))
add_stmt (build_stmt (DECL_EXPR, decl));
rest_of_decl_compilation (decl, NULL, DECL_FILE_SCOPE_P (decl), 0);
rest_of_decl_compilation (decl, DECL_FILE_SCOPE_P (decl), 0);
}
/* At the end of a declaration, throw away any variable type sizes
@ -3232,7 +3222,7 @@ build_compound_literal (tree type, tree init)
DECL_COMDAT (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
pushdecl (decl);
rest_of_decl_compilation (decl, NULL, 1, 0);
rest_of_decl_compilation (decl, 1, 0);
}
return complit;
@ -5408,7 +5398,7 @@ finish_struct (tree t, tree fieldlist, tree attributes)
layout_decl (decl, 0);
if (c_dialect_objc ())
objc_check_decl (decl);
rest_of_decl_compilation (decl, NULL, toplevel, 0);
rest_of_decl_compilation (decl, toplevel, 0);
if (! toplevel)
expand_decl (decl);
}

View file

@ -195,41 +195,6 @@ build_stmt (enum tree_code code, ...)
return ret;
}
/* Create RTL for the local static variable DECL. */
void
make_rtl_for_local_static (tree decl)
{
const char *asmspec = NULL;
/* If we inlined this variable, we could see it's declaration
again. */
if (TREE_ASM_WRITTEN (decl))
return;
/* If the DECL_ASSEMBLER_NAME is not the same as the DECL_NAME, then
either we already created RTL for this DECL (and since it was a
local variable, its DECL_ASSEMBLER_NAME got hacked up to prevent
clashes with other local statics with the same name by a previous
call to make_decl_rtl), or the user explicitly requested a
particular assembly name for this variable, using the GNU
extension for this purpose:
int i asm ("j");
There's no way to know which case we're in, here. But, it turns
out we're safe. If there's already RTL, then
rest_of_decl_compilation ignores the ASMSPEC parameter, so we
may as well not pass it in. If there isn't RTL, then we didn't
already create RTL, which means that the modification to
DECL_ASSEMBLER_NAME came only via the explicit extension. */
if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl)
&& !DECL_RTL_SET_P (decl))
asmspec = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
rest_of_decl_compilation (decl, asmspec, /*top_level=*/0, /*at_end=*/0);
}
/* Let the back-end know about DECL. */
void
@ -241,9 +206,7 @@ emit_local_var (tree decl)
if (DECL_HARD_REGISTER (decl))
/* The user specified an assembler name for this variable.
Set that up now. */
rest_of_decl_compilation
(decl, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
/*top_level=*/0, /*at_end=*/0);
rest_of_decl_compilation (decl, 0, 0);
else
expand_decl (decl);
}

View file

@ -1,3 +1,9 @@
2004-08-04 Geoffrey Keating <geoffk@apple.com>
* decl.c (make_rtl_for_nonlocal_decl): Set DECL_ASSEMBLER_NAME rather
than passing it as a parameter to rest_of_decl_compilation.
* decl2.c (grokfield): Use set_user_assembler_name.
2004-08-04 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (complete_array_type): Don't gratuitously copy

View file

@ -6516,7 +6516,7 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup)
}
else
{
rest_of_decl_compilation (var, NULL, /*toplev=*/1, at_eof);
rest_of_decl_compilation (var, /*toplev=*/1, at_eof);
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
static_aggregates = tree_cons (NULL_TREE, var,
static_aggregates);

View file

@ -3832,7 +3832,7 @@ build_clone (tree fn, tree name)
/* Create the RTL for this function. */
SET_DECL_RTL (clone, NULL_RTX);
rest_of_decl_compilation (clone, NULL, /*top_level=*/1, at_eof);
rest_of_decl_compilation (clone, /*top_level=*/1, at_eof);
/* Make it easy to find the CLONE given the FN. */
TREE_CHAIN (clone) = TREE_CHAIN (fn);

View file

@ -1954,7 +1954,7 @@ duplicate_decls (tree newdecl, tree olddecl)
&& (TREE_CODE (olddecl) == FUNCTION_DECL
|| (TREE_CODE (olddecl) == VAR_DECL
&& TREE_STATIC (olddecl))))
make_decl_rtl (olddecl, NULL);
make_decl_rtl (olddecl);
return olddecl;
}
@ -4512,10 +4512,25 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
int toplev = toplevel_bindings_p ();
int defer_p;
/* Set the DECL_ASSEMBLER_NAME for the object. */
if (asmspec)
{
/* The `register' keyword, when used together with an
asm-specification, indicates that the variable should be
placed in a particular register. */
if (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
{
change_decl_assembler_name (decl, get_identifier (asmspec));
DECL_HARD_REGISTER (decl) = 1;
}
else
set_user_assembler_name (decl, asmspec);
}
/* Handle non-variables up front. */
if (TREE_CODE (decl) != VAR_DECL)
{
rest_of_decl_compilation (decl, asmspec, toplev, at_eof);
rest_of_decl_compilation (decl, toplev, at_eof);
return;
}
@ -4530,17 +4545,6 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
my_friendly_assert (DECL_EXTERNAL (decl), 20000723);
}
/* Set the DECL_ASSEMBLER_NAME for the variable. */
if (asmspec)
{
change_decl_assembler_name (decl, get_identifier (asmspec));
/* The `register' keyword, when used together with an
asm-specification, indicates that the variable should be
placed in a particular register. */
if (DECL_REGISTER (decl))
DECL_HARD_REGISTER (decl) = 1;
}
/* We don't create any RTL for local variables. */
if (DECL_FUNCTION_SCOPE_P (decl) && !TREE_STATIC (decl))
return;
@ -4574,16 +4578,9 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
&& DECL_IMPLICIT_INSTANTIATION (decl))
defer_p = 1;
/* If we're deferring the variable, we only need to make RTL if
there's an ASMSPEC. Otherwise, we'll lazily create it later when
we need it. (There's no way to lazily create RTL for things that
have assembly specs because the information about the specifier
isn't stored in the tree, yet) */
if (defer_p && asmspec)
make_decl_rtl (decl, asmspec);
/* If we're not deferring, go ahead and assemble the variable. */
else if (!defer_p)
rest_of_decl_compilation (decl, asmspec, toplev, at_eof);
if (!defer_p)
rest_of_decl_compilation (decl, toplev, at_eof);
}
/* Generate code to initialize DECL (a local variable). */
@ -4744,8 +4741,8 @@ cp_finish_decl (tree decl, tree init, tree asmspec_tree, int flags)
&& !COMPLETE_TYPE_P (TREE_TYPE (decl)))
TYPE_DECL_SUPPRESS_DEBUG (decl) = 1;
rest_of_decl_compilation (decl, NULL,
DECL_CONTEXT (decl) == NULL_TREE, at_eof);
rest_of_decl_compilation (decl, DECL_CONTEXT (decl) == NULL_TREE,
at_eof);
goto finish_end;
}

View file

@ -975,12 +975,7 @@ grokfield (const cp_declarator *declarator,
if (TREE_CODE (value) == FUNCTION_DECL)
{
if (asmspec)
{
/* This must override the asm specifier which was placed
by grokclassfn. Lay this out fresh. */
SET_DECL_RTL (value, NULL_RTX);
change_decl_assembler_name (value, get_identifier (asmspec));
}
set_user_assembler_name (value, asmspec);
if (!DECL_FRIEND_P (value))
grok_special_member_properties (value);
@ -1229,7 +1224,7 @@ finish_anon_union (tree anon_union_decl)
&& at_function_scope_p ())
add_decl_expr (anon_union_decl);
else if (!processing_template_decl)
rest_of_decl_compilation (anon_union_decl, NULL,
rest_of_decl_compilation (anon_union_decl,
toplevel_bindings_p (), at_eof);
}
@ -1601,7 +1596,7 @@ maybe_emit_vtables (tree ctype)
/* Write it out. */
DECL_EXTERNAL (vtbl) = 0;
rest_of_decl_compilation (vtbl, NULL, 1, 1);
rest_of_decl_compilation (vtbl, 1, 1);
/* Because we're only doing syntax-checking, we'll never end up
actually marking the variable as written. */
@ -2548,7 +2543,7 @@ write_out_vars (tree vars)
if (!var_finalized_p (var))
{
import_export_decl (var);
rest_of_decl_compilation (var, 0, 1, 1);
rest_of_decl_compilation (var, 1, 1);
}
}
}

View file

@ -1728,7 +1728,7 @@ build_java_class_ref (tree type)
DECL_ARTIFICIAL (class_decl) = 1;
DECL_IGNORED_P (class_decl) = 1;
pushdecl_top_level (class_decl);
make_decl_rtl (class_decl, NULL);
make_decl_rtl (class_decl);
}
return class_decl;
}

View file

@ -1024,8 +1024,7 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p)
TYPE_UNQUALIFIED);
grok_special_member_properties (fn);
set_linkage_according_to_type (type, fn);
rest_of_decl_compilation (fn, /*asmspec=*/NULL,
toplevel_bindings_p (), at_eof);
rest_of_decl_compilation (fn, toplevel_bindings_p (), at_eof);
DECL_IN_AGGR_P (fn) = 1;
DECL_ARTIFICIAL (fn) = 1;
DECL_NOT_REALLY_EXTERN (fn) = 1;

View file

@ -1368,10 +1368,7 @@ init_block_move_fn (const char *asmspec)
}
if (asmspec)
{
SET_DECL_RTL (block_move_fn, NULL_RTX);
SET_DECL_ASSEMBLER_NAME (block_move_fn, get_identifier (asmspec));
}
set_user_assembler_name (block_move_fn, asmspec);
}
static tree
@ -1385,7 +1382,7 @@ emit_block_move_libcall_fn (int for_call)
if (for_call && !emitted_extern)
{
emitted_extern = true;
make_decl_rtl (block_move_fn, NULL);
make_decl_rtl (block_move_fn);
assemble_external (block_move_fn);
}
@ -2432,10 +2429,7 @@ init_block_clear_fn (const char *asmspec)
}
if (asmspec)
{
SET_DECL_RTL (block_clear_fn, NULL_RTX);
SET_DECL_ASSEMBLER_NAME (block_clear_fn, get_identifier (asmspec));
}
set_user_assembler_name (block_clear_fn, asmspec);
}
static tree
@ -2449,7 +2443,7 @@ clear_storage_libcall_fn (int for_call)
if (for_call && !emitted_extern)
{
emitted_extern = true;
make_decl_rtl (block_clear_fn, NULL);
make_decl_rtl (block_clear_fn);
assemble_external (block_clear_fn);
}
@ -6044,7 +6038,7 @@ expand_var (tree var)
else if (TREE_CODE (var) == VAR_DECL && !TREE_STATIC (var))
expand_decl (var);
else if (TREE_CODE (var) == VAR_DECL && TREE_STATIC (var))
rest_of_decl_compilation (var, NULL, 0, 0);
rest_of_decl_compilation (var, 0, 0);
else if (TREE_CODE (var) == TYPE_DECL
|| TREE_CODE (var) == CONST_DECL
|| TREE_CODE (var) == FUNCTION_DECL

View file

@ -684,7 +684,7 @@ builtin_function (const char *name,
TREE_PUBLIC (decl) = 1;
if (library_name)
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
make_decl_rtl (decl, NULL);
make_decl_rtl (decl);
pushdecl (decl);
DECL_BUILT_IN_CLASS (decl) = class;
DECL_FUNCTION_CODE (decl) = function_code;

View file

@ -1318,7 +1318,7 @@ gfc_build_library_function_decl (tree name, tree rettype, int nargs, ...)
pushdecl (fndecl);
rest_of_decl_compilation (fndecl, NULL, 1, 0);
rest_of_decl_compilation (fndecl, 1, 0);
return fndecl;
}
@ -1802,7 +1802,7 @@ gfc_create_module_variable (gfc_symbol * sym)
/* Create the variable. */
pushdecl (decl);
rest_of_decl_compilation (decl, NULL, 1, 0);
rest_of_decl_compilation (decl, 1, 0);
/* Also add length of strings. */
if (sym->ts.type == BT_CHARACTER)
@ -1813,7 +1813,7 @@ gfc_create_module_variable (gfc_symbol * sym)
if (!INTEGER_CST_P (length))
{
pushdecl (length);
rest_of_decl_compilation (length, NULL, 1, 0);
rest_of_decl_compilation (length, 1, 0);
}
}
}
@ -1969,11 +1969,11 @@ gfc_generate_function_code (gfc_namespace * ns)
if (DECL_CONTEXT (fndecl) == NULL_TREE)
{
/* create RTL for function declaration */
rest_of_decl_compilation (fndecl, NULL, 1, 0);
rest_of_decl_compilation (fndecl, 1, 0);
}
/* create RTL for function definition */
make_decl_rtl (fndecl, NULL);
make_decl_rtl (fndecl);
/* Set the line and filename. sym->decalred_at seems to point to the last
statement for subroutines, but it'll do for now. */
@ -2135,9 +2135,9 @@ gfc_generate_constructors (void)
current_function_decl = fndecl;
rest_of_decl_compilation (fndecl, NULL, 1, 0);
rest_of_decl_compilation (fndecl, 1, 0);
make_decl_rtl (fndecl, NULL);
make_decl_rtl (fndecl);
init_function_start (fndecl, input_filename, input_line);

View file

@ -547,7 +547,7 @@ gfc_get_intrinsic_lib_fndecl (gfc_intrinsic_map_t * m, gfc_expr * expr)
/* Mark it __attribute__((const)), if possible. */
TREE_READONLY (fndecl) = m->is_constant;
rest_of_decl_compilation (fndecl, NULL, 1, 0);
rest_of_decl_compilation (fndecl, 1, 0);
(*pdecl) = fndecl;
return fndecl;

View file

@ -993,7 +993,7 @@ gfc_finish_type (tree type)
TYPE_STUB_DECL (type) = decl;
layout_type (type);
rest_of_type_compilation (type, 1);
rest_of_decl_compilation (decl, NULL, 1, 0);
rest_of_decl_compilation (decl, 1, 0);
}
/* Add a field of given NAME and TYPE to the context of a UNION_TYPE

View file

@ -144,7 +144,7 @@ define_builtin (enum built_in_function val,
DECL_EXTERNAL (decl) = 1;
TREE_PUBLIC (decl) = 1;
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (libname));
make_decl_rtl (decl, NULL);
make_decl_rtl (decl);
pushdecl (decl);
DECL_BUILT_IN_CLASS (decl) = BUILT_IN_NORMAL;
DECL_FUNCTION_CODE (decl) = val;

View file

@ -920,9 +920,9 @@ build_utf8_ref (tree name)
TREE_CHAIN (decl) = utf8_decl_list;
layout_decl (decl, 0);
pushdecl (decl);
rest_of_decl_compilation (decl, (char*) 0, global_bindings_p (), 0);
rest_of_decl_compilation (decl, global_bindings_p (), 0);
utf8_decl_list = decl;
make_decl_rtl (decl, (char*) 0);
make_decl_rtl (decl);
ref = build1 (ADDR_EXPR, utf8const_ptr_type, decl);
IDENTIFIER_UTF8_REF (name) = ref;
return ref;
@ -985,7 +985,7 @@ build_class_ref (tree type)
SET_DECL_ASSEMBLER_NAME (decl,
java_mangle_class_field
(&temporary_obstack, type));
make_decl_rtl (decl, NULL);
make_decl_rtl (decl);
pushdecl_top_level (decl);
}
}
@ -1037,7 +1037,7 @@ build_class_ref (tree type)
TREE_STATIC (decl) = 1;
TREE_PUBLIC (decl) = 1;
DECL_EXTERNAL (decl) = 1;
make_decl_rtl (decl, NULL);
make_decl_rtl (decl);
pushdecl_top_level (decl);
}
}
@ -1073,7 +1073,7 @@ build_static_field_ref (tree fdecl)
{
if (is_compiled == 1)
DECL_EXTERNAL (fdecl) = 1;
make_decl_rtl (fdecl, NULL);
make_decl_rtl (fdecl);
}
return fdecl;
}
@ -1311,7 +1311,7 @@ make_method_value (tree mdecl)
TREE_STATIC (array) = 1;
DECL_ARTIFICIAL (array) = 1;
DECL_IGNORED_P (array) = 1;
rest_of_decl_compilation (array, (char*) 0, 1, 0);
rest_of_decl_compilation (array, 1, 0);
table = build1 (ADDR_EXPR, ptr_type_node, array);
}
@ -1385,7 +1385,7 @@ get_dispatch_table (tree type, tree this_class_addr)
else
{
if (!DECL_RTL_SET_P (method))
make_decl_rtl (method, NULL);
make_decl_rtl (method);
if (TARGET_VTABLE_USES_DESCRIPTORS)
for (j = 0; j < TARGET_VTABLE_USES_DESCRIPTORS; ++j)
@ -1528,7 +1528,7 @@ make_class_data (tree type)
if (initial != NULL_TREE
&& TREE_TYPE (initial) == string_ptr_type_node)
DECL_INITIAL (field) = NULL_TREE;
rest_of_decl_compilation (field, (char*) 0, 1, 1);
rest_of_decl_compilation (field, 1, 1);
DECL_INITIAL (field) = initial;
}
else
@ -1552,7 +1552,7 @@ make_class_data (tree type)
TREE_STATIC (fields_decl) = 1;
DECL_ARTIFICIAL (fields_decl) = 1;
DECL_IGNORED_P (fields_decl) = 1;
rest_of_decl_compilation (fields_decl, (char*) 0, 1, 0);
rest_of_decl_compilation (fields_decl, 1, 0);
}
else
fields_decl = NULL_TREE;
@ -1578,7 +1578,7 @@ make_class_data (tree type)
TREE_STATIC (methods_decl) = 1;
DECL_ARTIFICIAL (methods_decl) = 1;
DECL_IGNORED_P (methods_decl) = 1;
rest_of_decl_compilation (methods_decl, (char*) 0, 1, 0);
rest_of_decl_compilation (methods_decl, 1, 0);
if (supers_all_compiled (type) && ! CLASS_INTERFACE (type_decl)
&& !flag_indirect_dispatch)
@ -1590,7 +1590,7 @@ make_class_data (tree type)
DECL_ARTIFICIAL (dtable_decl) = 1;
DECL_IGNORED_P (dtable_decl) = 1;
TREE_PUBLIC (dtable_decl) = 1;
rest_of_decl_compilation (dtable_decl, (char*) 0, 1, 0);
rest_of_decl_compilation (dtable_decl, 1, 0);
if (type == class_type_node)
class_dtable_decl = dtable_decl;
}
@ -1603,7 +1603,7 @@ make_class_data (tree type)
DECL_IGNORED_P (class_dtable_decl) = 1;
if (is_compiled_class (class_type_node) != 2)
DECL_EXTERNAL (class_dtable_decl) = 1;
rest_of_decl_compilation (class_dtable_decl, (char*) 0, 1, 0);
rest_of_decl_compilation (class_dtable_decl, 1, 0);
}
super = CLASSTYPE_SUPER (type);
@ -1658,7 +1658,7 @@ make_class_data (tree type)
DECL_ARTIFICIAL (idecl) = 1;
DECL_IGNORED_P (idecl) = 1;
interfaces = build1 (ADDR_EXPR, ptr_type_node, idecl);
rest_of_decl_compilation (idecl, (char*) 0, 1, 0);
rest_of_decl_compilation (idecl, 1, 0);
}
constant_pool_constructor = build_constants_constructor ();
@ -1781,7 +1781,7 @@ make_class_data (tree type)
if (flag_hash_synchronization && POINTER_SIZE < 64)
DECL_ALIGN (decl) = 64;
rest_of_decl_compilation (decl, (char*) 0, 1, 0);
rest_of_decl_compilation (decl, 1, 0);
}
void
@ -1792,7 +1792,7 @@ finish_class (void)
current_function_decl = NULL_TREE;
make_class_data (current_class);
register_class ();
rest_of_decl_compilation (TYPE_NAME (current_class), (char*) 0, 1, 0);
rest_of_decl_compilation (TYPE_NAME (current_class), 1, 0);
}
/* Return 2 if CLASS is compiled by this compilation job;
@ -2189,7 +2189,7 @@ layout_class_method (tree this_class, tree super_class,
if (! METHOD_ABSTRACT (method_decl)
|| (CLASS_INTERFACE (TYPE_NAME (this_class))
&& (DECL_CLINIT_P (method_decl))))
make_decl_rtl (method_decl, NULL);
make_decl_rtl (method_decl);
if (ID_INIT_P (method_name))
{
@ -2388,7 +2388,7 @@ emit_symbol_table (tree name, tree the_table, tree decl_list,
DECL_INITIAL (the_syms_decl) = table;
DECL_ARTIFICIAL (the_syms_decl) = 1;
DECL_IGNORED_P (the_syms_decl) = 1;
rest_of_decl_compilation (the_syms_decl, NULL, 1, 0);
rest_of_decl_compilation (the_syms_decl, 1, 0);
/* Now that its size is known, redefine the table as an
uninitialized static array of INDEX + 1 elements. The extra entry
@ -2399,7 +2399,7 @@ emit_symbol_table (tree name, tree the_table, tree decl_list,
the_table = build_decl (VAR_DECL, name, the_array_type);
TREE_STATIC (the_table) = 1;
TREE_READONLY (the_table) = 1;
rest_of_decl_compilation (the_table, NULL, 1, 0);
rest_of_decl_compilation (the_table, 1, 0);
return the_table;
}
@ -2446,7 +2446,7 @@ emit_catch_table (tree this_class)
TREE_STATIC (table) = 1;
TREE_READONLY (table) = 1;
DECL_IGNORED_P (table) = 1;
rest_of_decl_compilation (table, NULL, 1, 0);
rest_of_decl_compilation (table, 1, 0);
return table;
}

View file

@ -411,7 +411,7 @@ build_constant_data_ref (void)
decl = build_decl (VAR_DECL, decl_name, type);
TREE_STATIC (decl) = 1;
make_decl_rtl (decl, NULL);
make_decl_rtl (decl);
TYPE_CPOOL_DATA_REF (output_class) = decl;
}
@ -468,7 +468,7 @@ build_constants_constructor (void)
data_list);
DECL_SIZE (data_decl) = TYPE_SIZE (TREE_TYPE (data_decl));
DECL_SIZE_UNIT (data_decl) = TYPE_SIZE_UNIT (TREE_TYPE (data_decl));
rest_of_decl_compilation (data_decl, (char *) 0, 1, 0);
rest_of_decl_compilation (data_decl, 1, 0);
data_value = build_address_of (data_decl);
tags_type = build_array_type (unsigned_byte_type_node, index_type);
@ -477,7 +477,7 @@ build_constants_constructor (void)
tags_type);
TREE_STATIC (tags_decl) = 1;
DECL_INITIAL (tags_decl) = build_constructor (tags_type, tags_list);
rest_of_decl_compilation (tags_decl, (char*) 0, 1, 0);
rest_of_decl_compilation (tags_decl, 1, 0);
tags_value = build_address_of (tags_decl);
}
else

View file

@ -506,7 +506,7 @@ builtin_function (const char *name,
TREE_PUBLIC (decl) = 1;
if (library_name)
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
make_decl_rtl (decl, NULL);
make_decl_rtl (decl);
pushdecl (decl);
DECL_BUILT_IN_CLASS (decl) = cl;
DECL_FUNCTION_CODE (decl) = function_code;
@ -1983,7 +1983,7 @@ java_mark_decl_local (tree decl)
/* If we've already constructed DECL_RTL, give encode_section_info
a second chance, now that we've changed the flags. */
if (DECL_RTL_SET_P (decl))
make_decl_rtl (decl, NULL);
make_decl_rtl (decl);
}
void

View file

@ -386,7 +386,7 @@ expand_catch_class (void **entry, void *x ATTRIBUTE_UNUSED)
tree decl;
STRIP_NOPS (addr);
decl = TREE_OPERAND (addr, 0);
rest_of_decl_compilation (decl, (char*) 0, global_bindings_p (), 0);
rest_of_decl_compilation (decl, global_bindings_p (), 0);
return true;
}

View file

@ -1829,7 +1829,7 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED,
if (!flag_indirect_dispatch
|| (!TREE_PUBLIC (method) && DECL_CONTEXT (method)))
{
make_decl_rtl (method, NULL);
make_decl_rtl (method);
func = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (method)),
method);
}

View file

@ -91,8 +91,8 @@ compile_resource_data (const char *name, const char *buffer, int length)
DECL_INITIAL (decl) = rinit;
layout_decl (decl, 0);
pushdecl (decl);
rest_of_decl_compilation (decl, (char*) 0, global_bindings_p (), 0);
make_decl_rtl (decl, (char*) 0);
rest_of_decl_compilation (decl, global_bindings_p (), 0);
make_decl_rtl (decl);
assemble_variable (decl, 1, 0, 0);
resources = tree_cons (NULL_TREE, decl, resources);

View file

@ -1091,7 +1091,7 @@ create_builtin_decl (enum tree_code code, tree type, const char *name)
if (code == VAR_DECL)
{
TREE_STATIC (decl) = 1;
make_decl_rtl (decl, 0);
make_decl_rtl (decl);
pushdecl (decl);
DECL_ARTIFICIAL (decl) = 1;
}
@ -1488,7 +1488,7 @@ objc_add_static_instance (tree constructor, tree class_decl)
Postpone till end of input. */
DECL_DEFER_OUTPUT (decl) = 1;
pushdecl_top_level (decl);
rest_of_decl_compilation (decl, 0, 1, 0);
rest_of_decl_compilation (decl, 1, 0);
/* Add the DECL to the head of this CLASS' list. */
TREE_PURPOSE (*chain) = tree_cons (NULL_TREE, decl, TREE_PURPOSE (*chain));
@ -1892,7 +1892,7 @@ build_module_descriptor (void)
DECL_ARTIFICIAL (execclass_decl) = 1;
TREE_PUBLIC (execclass_decl) = 1;
pushdecl (execclass_decl);
rest_of_decl_compilation (execclass_decl, 0, 0, 0);
rest_of_decl_compilation (execclass_decl, 0, 0);
assemble_external (execclass_decl);
/* void _GLOBAL_$I$<gnyf> () {objc_execClass (&L_OBJC_MODULES);} */
@ -2022,7 +2022,7 @@ generate_static_references (void)
expr = objc_build_constructor (TREE_TYPE (static_instances_decl),
nreverse (decls));
finish_decl (static_instances_decl, expr, NULL_TREE);
rest_of_decl_compilation (static_instances_decl, 0, 0, 0);
rest_of_decl_compilation (static_instances_decl, 0, 0);
}
/* Output all strings. */
@ -2102,7 +2102,7 @@ build_selector_reference_decl (void)
DECL_ARTIFICIAL (decl) = 1;
DECL_CONTEXT (decl) = 0;
make_decl_rtl (decl, 0);
make_decl_rtl (decl);
pushdecl_top_level (decl);
return decl;
@ -2309,7 +2309,7 @@ build_class_reference_decl (void)
DECL_CONTEXT (decl) = 0;
DECL_ARTIFICIAL (decl) = 1;
make_decl_rtl (decl, 0);
make_decl_rtl (decl);
pushdecl_top_level (decl);
return decl;
@ -2459,7 +2459,7 @@ build_objc_string_decl (enum string_section section)
DECL_CONTEXT (decl) = 0;
DECL_ARTIFICIAL (decl) = 1;
make_decl_rtl (decl, 0);
make_decl_rtl (decl);
pushdecl_top_level (decl);
return decl;
@ -5951,7 +5951,7 @@ build_protocol_reference (tree p)
TREE_USED (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
make_decl_rtl (decl, 0);
make_decl_rtl (decl);
pushdecl_top_level (decl);
}
@ -8954,7 +8954,7 @@ handle_class_ref (tree chain)
TREE_PUBLIC (decl) = 1;
pushdecl (decl);
rest_of_decl_compilation (decl, 0, 0, 0);
rest_of_decl_compilation (decl, 0, 0);
/* Make a decl for the address. */
sprintf (string, "%sobjc_class_ref_%s",
@ -8966,7 +8966,7 @@ handle_class_ref (tree chain)
TREE_USED (decl) = 1;
pushdecl (decl);
rest_of_decl_compilation (decl, 0, 0, 0);
rest_of_decl_compilation (decl, 0, 0);
}
static void

View file

@ -320,18 +320,16 @@ close_dump_file (enum dump_file_index index,
and TYPE_DECL nodes.
This does nothing for local (non-static) variables, unless the
variable is a register variable with an ASMSPEC. In that case, or
if the variable is not an automatic, it sets up the RTL and
outputs any assembler code (label definition, storage allocation
and initialization).
variable is a register variable with DECL_ASSEMBLER_NAME set. In
that case, or if the variable is not an automatic, it sets up the
RTL and outputs any assembler code (label definition, storage
allocation and initialization).
DECL is the declaration. If ASMSPEC is nonzero, it specifies
the assembler symbol name to be used. TOP_LEVEL is nonzero
DECL is the declaration. TOP_LEVEL is nonzero
if this declaration is not within a function. */
void
rest_of_decl_compilation (tree decl,
const char *asmspec,
int top_level,
int at_end)
{
@ -348,6 +346,11 @@ rest_of_decl_compilation (tree decl,
}
}
/* Can't defer this, because it needs to happen before any
later function definitions are processed. */
if (DECL_REGISTER (decl) && DECL_ASSEMBLER_NAME_SET_P (decl))
make_decl_rtl (decl);
/* Forward declarations for nested functions are not "external",
but we need to treat them as if they were. */
if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
@ -355,9 +358,6 @@ rest_of_decl_compilation (tree decl,
{
timevar_push (TV_VARCONST);
if (asmspec)
make_decl_rtl (decl, asmspec);
/* Don't output anything when a tentative file-scope definition
is seen. But at end of compilation, do output code for them.
@ -393,22 +393,6 @@ rest_of_decl_compilation (tree decl,
timevar_pop (TV_VARCONST);
}
else if (DECL_REGISTER (decl) && asmspec != 0)
{
if (decode_reg_name (asmspec) >= 0)
{
SET_DECL_RTL (decl, NULL_RTX);
make_decl_rtl (decl, asmspec);
}
else
{
error ("%Hinvalid register name `%s' for register variable",
&DECL_SOURCE_LOCATION (decl), asmspec);
DECL_REGISTER (decl) = 0;
if (!top_level)
expand_decl (decl);
}
}
else if (TREE_CODE (decl) == TYPE_DECL)
{
timevar_push (TV_SYMOUT);

View file

@ -783,7 +783,7 @@ wrapup_global_declarations (tree *vec, int len)
if (needed)
{
reconsider = 1;
rest_of_decl_compilation (decl, NULL, 1, 1);
rest_of_decl_compilation (decl, 1, 1);
}
}
}

View file

@ -73,7 +73,7 @@ extern void pedwarn (const char *, ...) ATTRIBUTE_GCC_FE_DIAG(1,2);
extern void sorry (const char *, ...) ATTRIBUTE_GCC_FE_DIAG(1,2);
extern void inform (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void rest_of_decl_compilation (tree, const char *, int, int);
extern void rest_of_decl_compilation (tree, int, int);
extern void rest_of_type_compilation (tree, int);
extern void rest_of_compilation (void);
extern void tree_rest_of_compilation (tree, bool);

View file

@ -1862,7 +1862,7 @@ struct tree_binfo GTY (())
#define DECL_RTL(NODE) \
(DECL_CHECK (NODE)->decl.rtl \
? (NODE)->decl.rtl \
: (make_decl_rtl (NODE, NULL), (NODE)->decl.rtl))
: (make_decl_rtl (NODE), (NODE)->decl.rtl))
/* Set the DECL_RTL for NODE to RTL. */
#define SET_DECL_RTL(NODE, RTL) set_decl_rtl (NODE, RTL)
/* Returns nonzero if the DECL_RTL for NODE has already been set. */
@ -3603,7 +3603,7 @@ extern void internal_reference_types (void);
extern unsigned int update_alignment_for_field (record_layout_info, tree,
unsigned int);
/* varasm.c */
extern void make_decl_rtl (tree, const char *);
extern void make_decl_rtl (tree);
extern void make_decl_one_only (tree);
extern int supports_one_only (void);
extern void variable_section (tree, int);
@ -3612,6 +3612,7 @@ extern void resolve_unique_section (tree, int, int);
extern void mark_referenced (tree);
extern void mark_decl_referenced (tree);
extern void notice_global_symbol (tree);
extern void set_user_assembler_name (tree, const char *);
/* In stmt.c */
extern void emit_nop (void);

View file

@ -347,7 +347,7 @@ tree_code_create_function_prototype (unsigned char* chars,
}
/* Process declaration of function defined elsewhere. */
rest_of_decl_compilation (fn_decl, NULL, 1, 0);
rest_of_decl_compilation (fn_decl, 1, 0);
return fn_decl;
}
@ -439,7 +439,7 @@ tree_code_create_function_initial (tree prev_saved,
/* Output the decl rtl (not the rtl for the function code). ???.
If the function is not defined in this file, when should you
execute this? */
make_decl_rtl (fn_decl, NULL);
make_decl_rtl (fn_decl);
init_function_start (fn_decl);
@ -616,7 +616,7 @@ tree_code_create_variable (unsigned int storage_class,
/* Expand declaration and initial value if any. */
if (TREE_STATIC (var_decl))
rest_of_decl_compilation (var_decl, 0, 0, 0);
rest_of_decl_compilation (var_decl, 0, 0);
else
{
expand_decl (var_decl);
@ -1358,7 +1358,7 @@ builtin_function (const char *name, tree type, int function_code,
TREE_PUBLIC (decl) = 1;
if (library_name)
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
make_decl_rtl (decl, NULL);
make_decl_rtl (decl);
pushdecl (decl);
DECL_BUILT_IN_CLASS (decl) = class;
DECL_FUNCTION_CODE (decl) = function_code;

View file

@ -668,6 +668,19 @@ strip_reg_name (const char *name)
return name;
}
/* The user has asked for a DECL to have a particular name. Set (or
change) it in such a way that we don't prefix an underscore to
it. */
void
set_user_assembler_name (tree decl, const char *name)
{
char *starred = alloca (strlen (name) + 2);
starred[0] = '*';
strcpy (starred + 1, name);
change_decl_assembler_name (decl, get_identifier (starred));
SET_DECL_RTL (decl, NULL_RTX);
}
/* Decode an `asm' spec for a declaration as a register name.
Return the register number, or -1 if nothing specified,
or -2 if the ASMSPEC is not `cc' or `memory' and is not recognized,
@ -734,13 +747,10 @@ decode_reg_name (const char *asmspec)
There is, however, one exception: this function handles variables
explicitly placed in a particular register by the user.
ASMSPEC, if not 0, is the string which the user specified as the
assembler symbol name.
This is never called for PARM_DECL nodes. */
void
make_decl_rtl (tree decl, const char *asmspec)
make_decl_rtl (tree decl)
{
const char *name = 0;
int reg_number;
@ -770,6 +780,9 @@ make_decl_rtl (tree decl, const char *asmspec)
SET_DECL_RTL (decl, adjust_address_nv (DECL_RTL (decl),
DECL_MODE (decl), 0));
if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl))
return;
/* ??? Another way to do this would be to maintain a hashed
table of such critters. Instead of adding stuff to a DECL
to give certain attributes to it, we could use an external
@ -787,19 +800,10 @@ make_decl_rtl (tree decl, const char *asmspec)
return;
}
reg_number = decode_reg_name (asmspec);
if (reg_number == -2)
{
/* ASMSPEC is given, and not the name of a register. Mark the
name with a star so assemble_name won't munge it. */
char *starred = alloca (strlen (asmspec) + 2);
starred[0] = '*';
strcpy (starred + 1, asmspec);
change_decl_assembler_name (decl, get_identifier (starred));
}
name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
reg_number = decode_reg_name (name);
if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl))
{
/* First detect errors in declaring global registers. */
@ -855,7 +859,7 @@ make_decl_rtl (tree decl, const char *asmspec)
/* Now handle ordinary static variables and functions (in memory).
Also handle vars declared register invalidly. */
if (reg_number >= 0 || reg_number == -3)
if (name[0] == '*' && (reg_number >= 0 || reg_number == -3))
error ("%Jregister name given for non-register variable '%D'", decl, decl);
/* Specifying a section attribute on a variable forces it into a
@ -4191,7 +4195,7 @@ assemble_alias (tree decl, tree target ATTRIBUTE_UNUSED)
/* We must force creation of DECL_RTL for debug info generation, even though
we don't use it here. */
make_decl_rtl (decl, NULL);
make_decl_rtl (decl);
name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));