+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.
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);
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;
}
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;
}
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);
}
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);
}
}
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;
(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);
&& (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
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). */
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;
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. */
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);
/* 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)
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. */
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
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))
{
&& 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
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;
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);
}
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
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);
}
+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
}
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);
/* 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);
&& (TREE_CODE (olddecl) == FUNCTION_DECL
|| (TREE_CODE (olddecl) == VAR_DECL
&& TREE_STATIC (olddecl))))
- make_decl_rtl (olddecl, NULL);
+ make_decl_rtl (olddecl);
return olddecl;
}
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;
}
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;
&& 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). */
&& !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;
}
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);
&& 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);
}
\f
/* 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. */
if (!var_finalized_p (var))
{
import_export_decl (var);
- rest_of_decl_compilation (var, 0, 1, 1);
+ rest_of_decl_compilation (var, 1, 1);
}
}
}
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;
}
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;
}
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
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);
}
}
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
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);
}
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
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;
pushdecl (fndecl);
- rest_of_decl_compilation (fndecl, NULL, 1, 0);
+ rest_of_decl_compilation (fndecl, 1, 0);
return fndecl;
}
/* 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)
if (!INTEGER_CST_P (length))
{
pushdecl (length);
- rest_of_decl_compilation (length, NULL, 1, 0);
+ rest_of_decl_compilation (length, 1, 0);
}
}
}
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. */
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);
/* 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;
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);
}
\f
/* Add a field of given NAME and TYPE to the context of a UNION_TYPE
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;
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;
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);
}
}
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);
}
}
{
if (is_compiled == 1)
DECL_EXTERNAL (fdecl) = 1;
- make_decl_rtl (fdecl, NULL);
+ make_decl_rtl (fdecl);
}
return fdecl;
}
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);
}
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)
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
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;
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)
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;
}
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);
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 ();
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
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;
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))
{
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
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;
}
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;
}
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;
}
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);
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
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;
/* 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
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;
}
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);
}
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);
if (code == VAR_DECL)
{
TREE_STATIC (decl) = 1;
- make_decl_rtl (decl, 0);
+ make_decl_rtl (decl);
pushdecl (decl);
DECL_ARTIFICIAL (decl) = 1;
}
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));
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);} */
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. */
DECL_ARTIFICIAL (decl) = 1;
DECL_CONTEXT (decl) = 0;
- make_decl_rtl (decl, 0);
+ make_decl_rtl (decl);
pushdecl_top_level (decl);
return decl;
DECL_CONTEXT (decl) = 0;
DECL_ARTIFICIAL (decl) = 1;
- make_decl_rtl (decl, 0);
+ make_decl_rtl (decl);
pushdecl_top_level (decl);
return decl;
DECL_CONTEXT (decl) = 0;
DECL_ARTIFICIAL (decl) = 1;
- make_decl_rtl (decl, 0);
+ make_decl_rtl (decl);
pushdecl_top_level (decl);
return decl;
TREE_USED (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
- make_decl_rtl (decl, 0);
+ make_decl_rtl (decl);
pushdecl_top_level (decl);
}
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",
TREE_USED (decl) = 1;
pushdecl (decl);
- rest_of_decl_compilation (decl, 0, 0, 0);
+ rest_of_decl_compilation (decl, 0, 0);
}
static void
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)
{
}
}
+ /* 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)
{
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.
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);
if (needed)
{
reconsider = 1;
- rest_of_decl_compilation (decl, NULL, 1, 1);
+ rest_of_decl_compilation (decl, 1, 1);
}
}
}
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);
#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. */
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);
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);
}
/* 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;
}
/* 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);
/* 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);
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;
return name;
}
\f
+/* 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);
+}
+\f
/* 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,
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;
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
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. */
/* 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
/* 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));