aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2001-03-15 02:51:03 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2001-03-15 02:51:03 +0000
commit19e7881c81752c856edb9f71db93805ce0416be6 (patch)
treee937810f6aadde94067b96c8f65cc56fba667d87 /gcc
parentb894530e6d9633fc6497b3c404a3ec1bd1a341df (diff)
downloadgcc-19e7881c81752c856edb9f71db93805ce0416be6.zip
gcc-19e7881c81752c856edb9f71db93805ce0416be6.tar.gz
gcc-19e7881c81752c856edb9f71db93805ce0416be6.tar.bz2
varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME...
* varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME, not the contents of the RTL, to determine the name of the object. * tree.h (DECL_RTL): Allocate RTL lazily. (SET_DECL_RTL): New macro. (DECL_RTL_SET_P): Likewise. (COPY_DECL_RTL): Likewise. (DECL_RTL_IF_SET): Likewise. * varasm.c (make_decl_rtl): Add assertions about the kind of declaration we are processing. * c-decl.c (duplicate_decls): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc. (start_decl): Likewise. (finish_decl): Likewise. * c-semantics.c (emit_local_var): Likewise. * calls.c (expand_call): Likewise. * dbxout.c (dbxout_symbol): Likewise. * emit-rtl.c (unshare_all_rtl): Likewise. (unshare_all_decls): Likewise. (reset_used_decls): Likewise. * expr.c (store_constructor): Likewise. (safe_from_p): Likewise. (expand_expr): Likewise. * function.c (put_var_into_stack): Likewise. (instantiate_decls_1): Likewise. (assign_parms): Likewise. (expand_function_start): Likewise. (expand_function_end): Likewise. * ggc-common.c (gcc_mark_trees): Likewise. * integrate.c (function_cannot_inline_p): Likewise. (copy_decl_for_inlining): Likewise. (expand_inline_function): Likewise. (integrate_parm_decls): Likewise. (integrate_decl_tree): Likewise. * print-tree.c (print_node): Likewise. * reg-stack.c (stack_result): Likewise. * stmt.c (label_rtx): Likewise. (expand_return): Likewise. (expand_decl): Likewise. (expand_decl_cleanup): Likewise. (expand_anon_union_decl): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_decl_compilation): Likewise. * tree.c (simple_cst_equal): Likewise. * objc/objc-act.c (generate_static_references): Likewise. * class.c (build_clone): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc. * cp-tree.h (DECL_IN_MEMORY_P): Likewise. * decl.c (duplicate_decls): Likewise. (builtin_function): Likewise. (build_library_fn): Likewise. (build_cp_library_fn): Likewise. (check_initializer): Likewise. (cp_finish_decl): Likewise. * decl2.c (grokfield): Likewise. (grok_function_init): Remove #if 0'd code. (finish_anon_union): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc. * friend.c (do_friend): Likewise. * init.c (get_temp_regvar): Likewise. * method.c (make_thunk): Likewise. * pt.c (tsubst_friend_function): Likewise. (tsubst_decl): Likewise. (regenerate_decl_from_template): Likewise. * semantics.c (genrtl_named_return_value): Likewise. (expand_body): Likewise. (genrtl_finish_function): Likewise. * tree.c (cp_tree_equal): Likewise. * com.c (ffecom_member_phase_2): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc. (duplicate_decls): Likewise. (start_decl): Likewise. * class.c (build_static_field_ref): Likewise. (make_method_value): Likewise. (get_dispatch_table): Likewise. * decl.c (push_jvm_slot): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc. From-SVN: r40482
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog49
-rw-r--r--gcc/c-decl.c6
-rw-r--r--gcc/c-semantics.c2
-rw-r--r--gcc/calls.c5
-rw-r--r--gcc/cp/ChangeLog24
-rw-r--r--gcc/cp/class.c13
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/decl.c18
-rw-r--r--gcc/cp/decl2.c21
-rw-r--r--gcc/cp/friend.c1
-rw-r--r--gcc/cp/init.c2
-rw-r--r--gcc/cp/method.c2
-rw-r--r--gcc/cp/pt.c10
-rw-r--r--gcc/cp/semantics.c10
-rw-r--r--gcc/cp/tree.c4
-rw-r--r--gcc/dbxout.c4
-rw-r--r--gcc/emit-rtl.c8
-rw-r--r--gcc/expr.c16
-rw-r--r--gcc/f/ChangeLog7
-rw-r--r--gcc/f/com.c16
-rw-r--r--gcc/function.c63
-rw-r--r--gcc/ggc-common.c3
-rw-r--r--gcc/integrate.c27
-rw-r--r--gcc/java/ChangeLog8
-rw-r--r--gcc/java/class.c6
-rw-r--r--gcc/java/decl.c4
-rw-r--r--gcc/objc/objc-act.c2
-rw-r--r--gcc/print-tree.c2
-rw-r--r--gcc/reg-stack.c2
-rw-r--r--gcc/stmt.c37
-rw-r--r--gcc/toplev.c10
-rw-r--r--gcc/tree.c4
-rw-r--r--gcc/tree.h23
-rw-r--r--gcc/varasm.c40
34 files changed, 286 insertions, 165 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 401c241..12c04ef 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,52 @@
+2001-03-14 Mark Mitchell <mark@codesourcery.com>
+
+ * varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME, not the
+ contents of the RTL, to determine the name of the object.
+
+2001-03-14 Mark Mitchell <mark@codesourcery.com>
+
+ * tree.h (DECL_RTL): Allocate RTL lazily.
+ (SET_DECL_RTL): New macro.
+ (DECL_RTL_SET_P): Likewise.
+ (COPY_DECL_RTL): Likewise.
+ (DECL_RTL_IF_SET): Likewise.
+ * varasm.c (make_decl_rtl): Add assertions about the kind of
+ declaration we are processing.
+ * c-decl.c (duplicate_decls): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
+ (start_decl): Likewise.
+ (finish_decl): Likewise.
+ * c-semantics.c (emit_local_var): Likewise.
+ * calls.c (expand_call): Likewise.
+ * dbxout.c (dbxout_symbol): Likewise.
+ * emit-rtl.c (unshare_all_rtl): Likewise.
+ (unshare_all_decls): Likewise.
+ (reset_used_decls): Likewise.
+ * expr.c (store_constructor): Likewise.
+ (safe_from_p): Likewise.
+ (expand_expr): Likewise.
+ * function.c (put_var_into_stack): Likewise.
+ (instantiate_decls_1): Likewise.
+ (assign_parms): Likewise.
+ (expand_function_start): Likewise.
+ (expand_function_end): Likewise.
+ * ggc-common.c (gcc_mark_trees): Likewise.
+ * integrate.c (function_cannot_inline_p): Likewise.
+ (copy_decl_for_inlining): Likewise.
+ (expand_inline_function): Likewise.
+ (integrate_parm_decls): Likewise.
+ (integrate_decl_tree): Likewise.
+ * print-tree.c (print_node): Likewise.
+ * reg-stack.c (stack_result): Likewise.
+ * stmt.c (label_rtx): Likewise.
+ (expand_return): Likewise.
+ (expand_decl): Likewise.
+ (expand_decl_cleanup): Likewise.
+ (expand_anon_union_decl): Likewise.
+ * toplev.c (check_global_declarations): Likewise.
+ (rest_of_decl_compilation): Likewise.
+ * tree.c (simple_cst_equal): Likewise.
+ * objc/objc-act.c (generate_static_references): Likewise.
+
2001-03-14 Zack Weinberg <zackw@stanford.edu>
* aclocal.m4 (gcc_AC_C_CHARSET, gcc_AC_C_COMPILE_BIGENDIAN,
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index f114ab5..fead392 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1845,7 +1845,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
}
/* Keep the old rtl since we can safely use it. */
- DECL_RTL (newdecl) = DECL_RTL (olddecl);
+ COPY_DECL_RTL (olddecl, newdecl);
/* Merge the type qualifiers. */
if (TREE_CODE (olddecl) == FUNCTION_DECL
@@ -3455,7 +3455,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
/* But not if this is a duplicate decl
and we preserved the rtl from the previous one
(which may or may not happen). */
- && DECL_RTL (tem) == 0
+ && !DECL_RTL_SET_P (tem)
&& !DECL_CONTEXT (tem))
{
if (TREE_TYPE (tem) != error_mark_node
@@ -3598,7 +3598,7 @@ finish_decl (decl, init, asmspec_tree)
if (TREE_CODE (decl) == FUNCTION_DECL && asmspec)
{
DECL_BUILT_IN_CLASS (decl) = NOT_BUILT_IN;
- DECL_RTL (decl) = 0;
+ SET_DECL_RTL (decl, NULL_RTX);
DECL_ASSEMBLER_NAME (decl) = get_identifier (asmspec);
}
diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c
index 44d6b49..1c493e7 100644
--- a/gcc/c-semantics.c
+++ b/gcc/c-semantics.c
@@ -310,7 +310,7 @@ emit_local_var (decl)
tree decl;
{
/* Create RTL for this variable. */
- if (!DECL_RTL (decl))
+ if (!DECL_RTL_SET_P (decl))
{
if (DECL_C_HARD_REGISTER (decl))
/* The user specified an assembler name for this variable.
diff --git a/gcc/calls.c b/gcc/calls.c
index 9c77b87..f1eb3a80 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -2526,8 +2526,9 @@ expand_call (exp, target, ignore)
{
tree var = build_decl (VAR_DECL, NULL_TREE,
TREE_TYPE (args[i].tree_value));
- DECL_RTL (var) = expand_expr (args[i].tree_value, NULL_RTX,
- VOIDmode, EXPAND_NORMAL);
+ SET_DECL_RTL (var,
+ expand_expr (args[i].tree_value, NULL_RTX,
+ VOIDmode, EXPAND_NORMAL));
args[i].tree_value = var;
}
break;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 46871a9..c02b241 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,27 @@
+2001-03-14 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (build_clone): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
+ * cp-tree.h (DECL_IN_MEMORY_P): Likewise.
+ * decl.c (duplicate_decls): Likewise.
+ (builtin_function): Likewise.
+ (build_library_fn): Likewise.
+ (build_cp_library_fn): Likewise.
+ (check_initializer): Likewise.
+ (cp_finish_decl): Likewise.
+ * decl2.c (grokfield): Likewise.
+ (grok_function_init): Remove #if 0'd code.
+ (finish_anon_union): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
+ * friend.c (do_friend): Likewise.
+ * init.c (get_temp_regvar): Likewise.
+ * method.c (make_thunk): Likewise.
+ * pt.c (tsubst_friend_function): Likewise.
+ (tsubst_decl): Likewise.
+ (regenerate_decl_from_template): Likewise.
+ * semantics.c (genrtl_named_return_value): Likewise.
+ (expand_body): Likewise.
+ (genrtl_finish_function): Likewise.
+ * tree.c (cp_tree_equal): Likewise.
+
2001-03-12 Nathan Sidwell <nathan@codesourcery.com>
* call.c (convert_like_real): Add extra semantics to INNER
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 2fb75b2..0828852 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4265,7 +4265,7 @@ build_clone (fn, name)
set_mangled_name_for_decl (clone);
/* Create the RTL for this function. */
- DECL_RTL (clone) = NULL_RTX;
+ SET_DECL_RTL (clone, NULL_RTX);
rest_of_decl_compilation (clone, NULL, /*top_level=*/1, at_eof);
/* Make it easy to find the CLONE given the FN. */
@@ -5212,14 +5212,9 @@ finish_struct_1 (t)
/* Complete the rtl for any static member objects of the type we're
working on. */
for (x = TYPE_FIELDS (t); x; x = TREE_CHAIN (x))
- {
- if (TREE_CODE (x) == VAR_DECL && TREE_STATIC (x)
- && TREE_TYPE (x) == t)
- {
- DECL_MODE (x) = TYPE_MODE (t);
- make_decl_rtl (x, NULL);
- }
- }
+ if (TREE_CODE (x) == VAR_DECL && TREE_STATIC (x)
+ && TREE_TYPE (x) == t)
+ DECL_MODE (x) = TYPE_MODE (t);
/* Done with FIELDS...now decide whether to sort these for
faster lookups later.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index d948364..19bb167 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -1915,7 +1915,7 @@ struct lang_decl
here because on most RISC machines, a variable's address
is not, by itself, a legitimate address. */
#define DECL_IN_MEMORY_P(NODE) \
- (DECL_RTL (NODE) != NULL_RTX && GET_CODE (DECL_RTL (NODE)) == MEM)
+ (DECL_RTL_SET_P (NODE) && GET_CODE (DECL_RTL (NODE)) == MEM)
/* For FUNCTION_DECLs: return the language in which this decl
was declared. */
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index d3cb6a4..f917fc8 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3160,7 +3160,7 @@ duplicate_decls (newdecl, olddecl)
that all remnants of the builtin-ness of this function
will be banished. */
DECL_LANGUAGE (olddecl) = DECL_LANGUAGE (newdecl);
- DECL_RTL (olddecl) = DECL_RTL (newdecl);
+ SET_DECL_RTL (olddecl, DECL_RTL (newdecl));
DECL_ASSEMBLER_NAME (olddecl) = DECL_ASSEMBLER_NAME (newdecl);
SET_IDENTIFIER_GLOBAL_VALUE (DECL_ASSEMBLER_NAME (newdecl),
newdecl);
@@ -3533,7 +3533,7 @@ duplicate_decls (newdecl, olddecl)
DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl);
/* Keep the old rtl since we can safely use it. */
- DECL_RTL (newdecl) = DECL_RTL (olddecl);
+ COPY_DECL_RTL (olddecl, newdecl);
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
@@ -3634,7 +3634,7 @@ duplicate_decls (newdecl, olddecl)
{
DECL_LANGUAGE (olddecl) = DECL_LANGUAGE (newdecl);
DECL_ASSEMBLER_NAME (olddecl) = DECL_ASSEMBLER_NAME (newdecl);
- DECL_RTL (olddecl) = DECL_RTL (newdecl);
+ SET_DECL_RTL (olddecl, DECL_RTL (newdecl));
}
if (! types_match || new_defines_function)
{
@@ -3658,7 +3658,7 @@ duplicate_decls (newdecl, olddecl)
DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
/* If we're keeping the built-in definition, keep the rtl,
regardless of declaration matches. */
- DECL_RTL (newdecl) = DECL_RTL (olddecl);
+ SET_DECL_RTL (newdecl, DECL_RTL (olddecl));
}
else
DECL_FRAME_SIZE (newdecl) = DECL_FRAME_SIZE (olddecl);
@@ -6670,7 +6670,6 @@ builtin_function (name, type, code, class, libname)
function in the namespace. */
if (libname)
DECL_ASSEMBLER_NAME (decl) = get_identifier (libname);
- make_decl_rtl (decl, NULL);
/* Warn if a function in the namespace for users
is used without an occasion to consider it declared. */
@@ -6707,9 +6706,7 @@ build_library_fn (name, type)
tree name;
tree type;
{
- tree fn = build_library_fn_1 (name, ERROR_MARK, type);
- make_decl_rtl (fn, NULL);
- return fn;
+ return build_library_fn_1 (name, ERROR_MARK, type);
}
/* Returns the _DECL for a library function with C++ linkage. */
@@ -6724,7 +6721,6 @@ build_cp_library_fn (name, operator_code, type)
TREE_NOTHROW (fn) = TYPE_NOTHROW_P (type);
DECL_CONTEXT (fn) = FROB_CONTEXT (current_namespace);
set_mangled_name_for_decl (fn);
- make_decl_rtl (fn, NULL);
return fn;
}
@@ -7631,8 +7627,6 @@ check_initializer (decl, init)
}
else if (!DECL_EXTERNAL (decl) && TREE_CODE (type) == REFERENCE_TYPE)
{
- if (TREE_STATIC (decl))
- make_decl_rtl (decl, NULL_PTR);
grok_reference_init (decl, type, init);
init = NULL_TREE;
}
@@ -8038,7 +8032,7 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
{
/* This must override the asm specifier which was placed by
grokclassfn. Lay this out fresh. */
- DECL_RTL (TREE_TYPE (decl)) = NULL_RTX;
+ SET_DECL_RTL (TREE_TYPE (decl), NULL_RTX);
DECL_ASSEMBLER_NAME (decl) = get_identifier (asmspec);
make_decl_rtl (decl, asmspec);
}
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 000eb78..b60b669 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1775,7 +1775,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
{
/* This must override the asm specifier which was placed
by grokclassfn. Lay this out fresh. */
- DECL_RTL (value) = NULL_RTX;
+ SET_DECL_RTL (value, NULL_RTX);
DECL_ASSEMBLER_NAME (value) = get_identifier (asmspec);
}
cp_finish_decl (value, init, asmspec_tree, flags);
@@ -1928,25 +1928,8 @@ grok_function_init (decl, init)
if (TREE_CODE (type) == FUNCTION_TYPE)
cp_error ("initializer specified for non-member function `%D'", decl);
-#if 0
- /* We'll check for this in finish_struct_1. */
- else if (DECL_VINDEX (decl) == NULL_TREE)
- cp_error ("initializer specified for non-virtual member function `%D'", decl);
-#endif
else if (integer_zerop (init))
{
-#if 0
- /* Mark this function as being "defined". */
- DECL_INITIAL (decl) = error_mark_node;
- /* pure virtual destructors must be defined. */
- /* pure virtual needs to be defined (as abort) only when put in
- vtbl. For wellformed call, it should be itself. pr4737 */
- if (!DECL_DESTRUCTOR_P (decl)))
- {
- /* Give this node rtl from `abort'. */
- DECL_RTL (decl) = DECL_RTL (abort_fndecl);
- }
-#endif
DECL_PURE_VIRTUAL_P (decl) = 1;
if (DECL_OVERLOADED_OPERATOR_P (decl) == NOP_EXPR)
{
@@ -2206,7 +2189,7 @@ finish_anon_union (anon_union_decl)
if (static_p)
{
make_decl_rtl (main_decl, 0);
- DECL_RTL (anon_union_decl) = DECL_RTL (main_decl);
+ COPY_DECL_RTL (main_decl, anon_union_decl);
expand_anon_union_decl (anon_union_decl,
NULL_TREE,
DECL_ANON_UNION_ELEMS (anon_union_decl));
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index 170f63b..913ed9c 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -413,7 +413,6 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
}
}
- make_decl_rtl (decl, NULL_PTR);
add_friend (current_class_type,
is_friend_template ? DECL_TI_TEMPLATE (decl) : decl);
DECL_FRIEND_P (decl) = 1;
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 4d498aa..61e2d4f 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2779,7 +2779,7 @@ get_temp_regvar (type, init)
if (building_stmt_tree ())
add_decl_stmt (decl);
if (!building_stmt_tree ())
- DECL_RTL (decl) = assign_temp (type, 2, 0, 1);
+ SET_DECL_RTL (decl, assign_temp (type, 2, 0, 1));
finish_expr_stmt (build_modify_expr (decl, INIT_EXPR, init));
return decl;
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 75e713d..dad5f7d 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -373,8 +373,6 @@ make_thunk (function, delta, vcall_index, generate_with_vtable_p)
DECL_DEFERRED_FN (thunk) = 0;
/* So that finish_file can write out any thunks that need to be: */
pushdecl_top_level (thunk);
- /* Create RTL for this thunk so that its address can be taken. */
- make_decl_rtl (thunk, NULL);
}
return thunk;
}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 0994d67..3fa1cde 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -4617,8 +4617,7 @@ tsubst_friend_function (decl, args)
if (TREE_CODE (new_friend) != TEMPLATE_DECL)
{
set_mangled_name_for_decl (new_friend);
- DECL_RTL (new_friend) = 0;
- make_decl_rtl (new_friend, NULL_PTR);
+ SET_DECL_RTL (new_friend, NULL_RTX);
}
if (DECL_NAMESPACE_SCOPE_P (new_friend))
@@ -5870,8 +5869,7 @@ tsubst_decl (t, args, type)
set_mangled_name_for_template_decl (r);
}
- DECL_RTL (r) = 0;
- make_decl_rtl (r, NULL_PTR);
+ SET_DECL_RTL (r, NULL_RTX);
/* Like grokfndecl. If we don't do this, pushdecl will
mess up our TREE_CHAIN because it doesn't find a
@@ -6038,7 +6036,7 @@ tsubst_decl (t, args, type)
/* Don't try to expand the initializer until someone tries to use
this variable; otherwise we run into circular dependencies. */
DECL_INITIAL (r) = NULL_TREE;
- DECL_RTL (r) = 0;
+ SET_DECL_RTL (r, NULL_RTX);
DECL_SIZE (r) = DECL_SIZE_UNIT (r) = 0;
/* For __PRETTY_FUNCTION__ we have to adjust the initializer. */
@@ -9765,7 +9763,7 @@ regenerate_decl_from_template (decl, tmpl)
details. */
DECL_TI_TEMPLATE (new_decl) = DECL_TI_TEMPLATE (decl);
DECL_ASSEMBLER_NAME (new_decl) = DECL_ASSEMBLER_NAME (decl);
- DECL_RTL (new_decl) = DECL_RTL (decl);
+ COPY_DECL_RTL (decl, new_decl);
DECL_USE_TEMPLATE (new_decl) = DECL_USE_TEMPLATE (decl);
/* Call duplicate decls to merge the old and new declarations. */
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index c186b97..97f0103 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1006,7 +1006,7 @@ genrtl_named_return_value ()
SImode but the DECL_RTL for the DECL_RESULT has DImode. So,
here, we use the mode the back-end has already assigned for
the return value. */
- DECL_RTL (decl) = gen_reg_rtx (GET_MODE (DECL_RTL (decl)));
+ SET_DECL_RTL (decl, gen_reg_rtx (GET_MODE (DECL_RTL (decl))));
if (TREE_ADDRESSABLE (decl))
put_var_into_stack (decl);
}
@@ -2391,9 +2391,6 @@ expand_body (fn)
/* Or if this is a nested function. */
&& !decl_function_context (fn))
{
- /* Give the function RTL now so that we can assign it to a
- function pointer, etc. */
- make_decl_rtl (fn, NULL);
/* Set DECL_EXTERNAL so that assemble_external will be called as
necessary. We'll clear it again in finish_file. */
if (!DECL_EXTERNAL (fn))
@@ -2709,7 +2706,10 @@ genrtl_finish_function (fn)
was an actual function definition. */
DECL_INITIAL (fn) = error_mark_node;
for (t = DECL_ARGUMENTS (fn); t; t = TREE_CHAIN (t))
- DECL_RTL (t) = DECL_INCOMING_RTL (t) = NULL_RTX;
+ {
+ SET_DECL_RTL (t, NULL_RTX);
+ DECL_INCOMING_RTL (t) = NULL_RTX;
+ }
}
/* Let the error reporting routines know that we're outside a
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 608602a..6a3de30 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1955,10 +1955,10 @@ cp_tree_equal (t1, t2)
as being equivalent to anything. */
if ((TREE_CODE (TREE_OPERAND (t1, 0)) == VAR_DECL
&& DECL_NAME (TREE_OPERAND (t1, 0)) == NULL_TREE
- && DECL_RTL (TREE_OPERAND (t1, 0)) == 0)
+ && !DECL_RTL_SET_P (TREE_OPERAND (t1, 0)))
|| (TREE_CODE (TREE_OPERAND (t2, 0)) == VAR_DECL
&& DECL_NAME (TREE_OPERAND (t2, 0)) == NULL_TREE
- && DECL_RTL (TREE_OPERAND (t2, 0)) == 0))
+ && !DECL_RTL_SET_P (TREE_OPERAND (t2, 0))))
cmp = 1;
else
cmp = cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 05a95a4..73be0b0 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -1971,7 +1971,7 @@ dbxout_symbol (decl, local)
/* else it is something we handle like a normal variable. */
}
- DECL_RTL (decl) = eliminate_regs (DECL_RTL (decl), 0, NULL_RTX);
+ SET_DECL_RTL (decl, eliminate_regs (DECL_RTL (decl), 0, NULL_RTX));
#ifdef LEAF_REG_REMAP
if (current_function_uses_only_leaf_regs)
leaf_renumber_regs_insn (DECL_RTL (decl));
@@ -2307,7 +2307,7 @@ dbxout_parms (parms)
so that the debugging output will be accurate. */
DECL_INCOMING_RTL (parms)
= eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX);
- DECL_RTL (parms) = eliminate_regs (DECL_RTL (parms), 0, NULL_RTX);
+ SET_DECL_RTL (parms, eliminate_regs (DECL_RTL (parms), 0, NULL_RTX));
#ifdef LEAF_REG_REMAP
if (current_function_uses_only_leaf_regs)
{
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index d95df87..93f11f4 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -1741,7 +1741,7 @@ unshare_all_rtl (fndecl, insn)
/* Make sure that virtual parameters are not shared. */
for (decl = DECL_ARGUMENTS (fndecl); decl; decl = TREE_CHAIN (decl))
- DECL_RTL (decl) = copy_rtx_if_shared (DECL_RTL (decl));
+ SET_DECL_RTL (decl, copy_rtx_if_shared (DECL_RTL (decl)));
/* Make sure that virtual stack slots are not shared. */
unshare_all_decls (DECL_INITIAL (fndecl));
@@ -1816,7 +1816,8 @@ unshare_all_decls (blk)
/* Copy shared decls. */
for (t = BLOCK_VARS (blk); t; t = TREE_CHAIN (t))
- DECL_RTL (t) = copy_rtx_if_shared (DECL_RTL (t));
+ if (DECL_RTL_SET_P (t))
+ SET_DECL_RTL (t, copy_rtx_if_shared (DECL_RTL (t)));
/* Now process sub-blocks. */
for (t = BLOCK_SUBBLOCKS (blk); t; t = TREE_CHAIN (t))
@@ -1833,7 +1834,8 @@ reset_used_decls (blk)
/* Mark decls. */
for (t = BLOCK_VARS (blk); t; t = TREE_CHAIN (t))
- reset_used_flags (DECL_RTL (t));
+ if (DECL_RTL_SET_P (t))
+ reset_used_flags (DECL_RTL (t));
/* Now process sub-blocks. */
for (t = BLOCK_SUBBLOCKS (blk); t; t = TREE_CHAIN (t))
diff --git a/gcc/expr.c b/gcc/expr.c
index e7356ec..d8586b6 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -4777,10 +4777,10 @@ store_constructor (exp, target, align, cleared, size)
index = build_decl (VAR_DECL, NULL_TREE, domain);
- DECL_RTL (index) = index_r
+ index_r
= gen_reg_rtx (promote_mode (domain, DECL_MODE (index),
&unsignedp, 0));
-
+ SET_DECL_RTL (index, index_r);
if (TREE_CODE (value) == SAVE_EXPR
&& SAVE_EXPR_RTL (value) == 0)
{
@@ -5705,7 +5705,7 @@ safe_from_p (x, exp, top_p)
switch (TREE_CODE_CLASS (TREE_CODE (exp)))
{
case 'd':
- exp_rtl = DECL_RTL (exp);
+ exp_rtl = DECL_RTL_SET_P (exp) ? DECL_RTL (exp) : NULL_RTX;
break;
case 'c':
@@ -6586,7 +6586,7 @@ expand_expr (exp, target, tmode, modifier)
/* If VARS have not yet been expanded, expand them now. */
while (vars)
{
- if (DECL_RTL (vars) == 0)
+ if (!DECL_RTL_SET_P (vars))
{
vars_need_expansion = 1;
expand_decl (vars);
@@ -8325,7 +8325,7 @@ expand_expr (exp, target, tmode, modifier)
if (target == 0)
{
- if (DECL_RTL (slot) != 0)
+ if (DECL_RTL_SET_P (slot))
{
target = DECL_RTL (slot);
/* If we have already expanded the slot, so don't do
@@ -8338,7 +8338,7 @@ expand_expr (exp, target, tmode, modifier)
target = assign_temp (type, 2, 0, 1);
/* All temp slots at this level must not conflict. */
preserve_temp_slots (target);
- DECL_RTL (slot) = target;
+ SET_DECL_RTL (slot, target);
if (TREE_ADDRESSABLE (slot))
put_var_into_stack (slot);
@@ -8364,7 +8364,7 @@ expand_expr (exp, target, tmode, modifier)
/* If we have already assigned it space, use that space,
not target that we were passed in, as our target
parameter is only a hint. */
- if (DECL_RTL (slot) != 0)
+ if (DECL_RTL_SET_P (slot))
{
target = DECL_RTL (slot);
/* If we have already expanded the slot, so don't do
@@ -8374,7 +8374,7 @@ expand_expr (exp, target, tmode, modifier)
}
else
{
- DECL_RTL (slot) = target;
+ SET_DECL_RTL (slot, target);
/* If we must have an addressable slot, then make sure that
the RTL that we just stored in slot is OK. */
if (TREE_ADDRESSABLE (slot))
diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog
index edb7bb0..b275476 100644
--- a/gcc/f/ChangeLog
+++ b/gcc/f/ChangeLog
@@ -1,3 +1,10 @@
+Wed Mar 14 09:29:27 2001 Mark Mitchell <mark@codesourcery.com>
+
+ * com.c (ffecom_member_phase_2): Use COPY_DECL_RTL,
+ DECL_RTL_SET_P, etc.
+ (duplicate_decls): Likewise.
+ (start_decl): Likewise.
+
Fri Mar 9 22:52:55 2001 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* fini.c (main): Use really_call_malloc, not malloc.
diff --git a/gcc/f/com.c b/gcc/f/com.c
index 99ba60e..fda6ce3 100644
--- a/gcc/f/com.c
+++ b/gcc/f/com.c
@@ -7039,12 +7039,12 @@ ffecom_member_phase2_ (ffestorag mst, ffestorag st)
TREE_ASM_WRITTEN (t) = 1;
TREE_USED (t) = 1;
- DECL_RTL (t)
- = gen_rtx (MEM, TYPE_MODE (type),
- plus_constant (XEXP (DECL_RTL (mt), 0),
- ffestorag_modulo (mst)
- + ffestorag_offset (st)
- - ffestorag_offset (mst)));
+ SET_DECL_RTL (t,
+ gen_rtx (MEM, TYPE_MODE (type),
+ plus_constant (XEXP (DECL_RTL (mt), 0),
+ ffestorag_modulo (mst)
+ + ffestorag_offset (st)
+ - ffestorag_offset (mst))));
t = start_decl (t, FALSE);
@@ -13629,7 +13629,7 @@ duplicate_decls (tree newdecl, tree olddecl)
}
/* Keep the old rtl since we can safely use it. */
- DECL_RTL (newdecl) = DECL_RTL (olddecl);
+ COPY_DECL_RTL (newdecl, olddecl);
/* Merge the type qualifiers. */
if (DECL_BUILT_IN_NONANSI (olddecl) && TREE_THIS_VOLATILE (olddecl)
@@ -14273,7 +14273,7 @@ start_decl (tree decl, bool is_top_level)
if (!top_level
/* But not if this is a duplicate decl and we preserved the rtl from the
previous one (which may or may not happen). */
- && DECL_RTL (tem) == 0)
+ && !DECL_RTL_SET_P (tem))
{
if (TYPE_SIZE (TREE_TYPE (tem)) != 0)
expand_decl (tem);
diff --git a/gcc/function.c b/gcc/function.c
index dde5ee0..4df71ce 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1338,7 +1338,9 @@ put_var_into_stack (decl)
context = decl_function_context (decl);
/* Get the current rtl used for this object and its original mode. */
- reg = TREE_CODE (decl) == SAVE_EXPR ? SAVE_EXPR_RTL (decl) : DECL_RTL (decl);
+ reg = (TREE_CODE (decl) == SAVE_EXPR
+ ? SAVE_EXPR_RTL (decl)
+ : DECL_RTL_IF_SET (decl));
/* No need to do anything if decl has no rtx yet
since in that case caller is setting TREE_ADDRESSABLE
@@ -3606,8 +3608,10 @@ instantiate_decls_1 (let, valid_only)
tree t;
for (t = BLOCK_VARS (let); t; t = TREE_CHAIN (t))
- instantiate_decl (DECL_RTL (t), int_size_in_bytes (TREE_TYPE (t)),
- valid_only);
+ if (DECL_RTL_SET_P (t))
+ instantiate_decl (DECL_RTL (t),
+ int_size_in_bytes (TREE_TYPE (t)),
+ valid_only);
/* Process all subblocks. */
for (t = BLOCK_SUBBLOCKS (let); t; t = TREE_CHAIN (t))
@@ -4353,8 +4357,8 @@ assign_parms (fndecl)
|| TREE_CODE (parm) != PARM_DECL
|| passed_type == NULL)
{
- DECL_INCOMING_RTL (parm) = DECL_RTL (parm)
- = gen_rtx_MEM (BLKmode, const0_rtx);
+ SET_DECL_RTL (parm, gen_rtx_MEM (BLKmode, const0_rtx));
+ DECL_INCOMING_RTL (parm) = DECL_RTL (parm);
TREE_USED (parm) = 1;
continue;
}
@@ -4373,7 +4377,8 @@ assign_parms (fndecl)
and avoid the usual things like emit_move_insn that could crash. */
if (nominal_mode == VOIDmode)
{
- DECL_INCOMING_RTL (parm) = DECL_RTL (parm) = const0_rtx;
+ SET_DECL_RTL (parm, const0_rtx);
+ DECL_INCOMING_RTL (parm) = DECL_RTL (parm);
continue;
}
@@ -4669,7 +4674,7 @@ assign_parms (fndecl)
size_stored / UNITS_PER_WORD,
int_size_in_bytes (TREE_TYPE (parm)));
}
- DECL_RTL (parm) = stack_parm;
+ SET_DECL_RTL (parm, stack_parm);
}
else if (! ((! optimize
&& ! DECL_REGISTER (parm)
@@ -4701,13 +4706,14 @@ assign_parms (fndecl)
appropriately. */
if (passed_pointer)
{
- DECL_RTL (parm)
- = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (passed_type)), parmreg);
+ SET_DECL_RTL (parm,
+ gen_rtx_MEM (TYPE_MODE (TREE_TYPE (passed_type)),
+ parmreg));
set_mem_attributes (DECL_RTL (parm), parm, 1);
}
else
{
- DECL_RTL (parm) = parmreg;
+ SET_DECL_RTL (parm, parmreg);
maybe_set_unchanging (DECL_RTL (parm), parm);
}
@@ -4773,12 +4779,13 @@ assign_parms (fndecl)
if (GET_MODE (parmreg) != GET_MODE (DECL_RTL (parm)))
{
rtx tempreg = gen_reg_rtx (GET_MODE (DECL_RTL (parm)));
-
+ int unsigned_p = TREE_UNSIGNED (TREE_TYPE (parm));
push_to_sequence (conversion_insns);
emit_move_insn (tempreg, DECL_RTL (parm));
- DECL_RTL (parm)
- = convert_to_mode (GET_MODE (parmreg), tempreg,
- TREE_UNSIGNED (TREE_TYPE (parm)));
+ SET_DECL_RTL (parm,
+ convert_to_mode (GET_MODE (parmreg),
+ tempreg,
+ unsigned_p));
emit_move_insn (parmreg, DECL_RTL (parm));
conversion_insns = get_insns();
did_conversion = 1;
@@ -4786,7 +4793,7 @@ assign_parms (fndecl)
}
else
emit_move_insn (parmreg, DECL_RTL (parm));
- DECL_RTL (parm) = parmreg;
+ SET_DECL_RTL (parm, parmreg);
/* STACK_PARM is the pointer, not the parm, and PARMREG is
now the parm. */
stack_parm = 0;
@@ -5021,7 +5028,7 @@ assign_parms (fndecl)
conversion_insns = get_insns ();
end_sequence ();
}
- DECL_RTL (parm) = stack_parm;
+ SET_DECL_RTL (parm, stack_parm);
}
/* If this "parameter" was the place where we are receiving the
@@ -5030,8 +5037,8 @@ assign_parms (fndecl)
{
tree result = DECL_RESULT (fndecl);
- DECL_RTL (result)
- = gen_rtx_MEM (DECL_MODE (result), DECL_RTL (parm));
+ SET_DECL_RTL (result,
+ gen_rtx_MEM (DECL_MODE (result), DECL_RTL (parm)));
set_mem_attributes (DECL_RTL (result), result, 1);
}
@@ -5090,7 +5097,9 @@ assign_parms (fndecl)
to include tree.h. Do this here so it gets done when an inlined
function gets output. */
- current_function_return_rtx = DECL_RTL (DECL_RESULT (fndecl));
+ current_function_return_rtx
+ = (DECL_RTL_SET_P (DECL_RESULT (fndecl))
+ ? DECL_RTL (DECL_RESULT (fndecl)) : NULL_RTX);
}
/* Indicate whether REGNO is an incoming argument to the current function
@@ -6357,15 +6366,16 @@ expand_function_start (subr, parms_have_cleanups)
}
if (value_address)
{
- DECL_RTL (DECL_RESULT (subr))
- = gen_rtx_MEM (DECL_MODE (DECL_RESULT (subr)), value_address);
+ SET_DECL_RTL (DECL_RESULT (subr),
+ gen_rtx_MEM (DECL_MODE (DECL_RESULT (subr)),
+ value_address));
set_mem_attributes (DECL_RTL (DECL_RESULT (subr)),
DECL_RESULT (subr), 1);
}
}
else if (DECL_MODE (DECL_RESULT (subr)) == VOIDmode)
/* If return mode is void, this decl rtl should not be used. */
- DECL_RTL (DECL_RESULT (subr)) = 0;
+ SET_DECL_RTL (DECL_RESULT (subr), NULL_RTX);
else if (parms_have_cleanups || current_function_instrument_entry_exit)
{
/* If function will end with cleanup code for parms,
@@ -6382,13 +6392,14 @@ expand_function_start (subr, parms_have_cleanups)
mode = promote_mode (type, mode, &unsignedp, 1);
#endif
- DECL_RTL (DECL_RESULT (subr)) = gen_reg_rtx (mode);
+ SET_DECL_RTL (DECL_RESULT (subr), gen_reg_rtx (mode));
}
else
/* Scalar, returned in a register. */
{
- DECL_RTL (DECL_RESULT (subr))
- = hard_function_value (TREE_TYPE (DECL_RESULT (subr)), subr, 1);
+ SET_DECL_RTL (DECL_RESULT (subr),
+ hard_function_value (TREE_TYPE (DECL_RESULT (subr)),
+ subr, 1));
/* Mark this reg as the function's return value. */
if (GET_CODE (DECL_RTL (DECL_RESULT (subr))) == REG)
@@ -6846,7 +6857,7 @@ expand_function_end (filename, line, end_bindings)
/* If scalar return value was computed in a pseudo-reg, or was a named
return value that got dumped to the stack, copy that to the hard
return register. */
- if (DECL_RTL (DECL_RESULT (current_function_decl)) != 0)
+ if (DECL_RTL_SET_P (DECL_RESULT (current_function_decl)))
{
tree decl_result = DECL_RESULT (current_function_decl);
rtx decl_rtl = DECL_RTL (decl_result);
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index fff5614..ffbbe20 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -376,7 +376,8 @@ ggc_mark_trees ()
ggc_mark_tree (DECL_ASSEMBLER_NAME (t));
ggc_mark_tree (DECL_SECTION_NAME (t));
ggc_mark_tree (DECL_MACHINE_ATTRIBUTES (t));
- ggc_mark_rtx (DECL_RTL (t));
+ if (DECL_RTL_SET_P (t))
+ ggc_mark_rtx (DECL_RTL (t));
ggc_mark_rtx (DECL_LIVE_RANGE_RTL (t));
ggc_mark_tree (DECL_VINDEX (t));
lang_mark_tree (t);
diff --git a/gcc/integrate.c b/gcc/integrate.c
index 270a9c5..8ce8490 100644
--- a/gcc/integrate.c
+++ b/gcc/integrate.c
@@ -137,7 +137,6 @@ function_cannot_inline_p (fndecl)
register int ninsns = 0;
register tree parms;
- rtx result;
if (DECL_UNINLINABLE (fndecl))
return N_("function cannot be inline");
@@ -236,9 +235,12 @@ function_cannot_inline_p (fndecl)
}
/* We can't inline functions that return a PARALLEL rtx. */
- result = DECL_RTL (DECL_RESULT (fndecl));
- if (result && GET_CODE (result) == PARALLEL)
- return N_("inline functions not supported for this return value type");
+ if (DECL_RTL_SET_P (DECL_RESULT (fndecl)))
+ {
+ rtx result = DECL_RTL (DECL_RESULT (fndecl));
+ if (GET_CODE (result) == PARALLEL)
+ return N_("inline functions not supported for this return value type");
+ }
/* If the function has a target specific attribute attached to it,
then we assume that we should not inline it. This can be overriden
@@ -349,7 +351,7 @@ copy_decl_for_inlining (decl, from_fn, to_fn)
DECL_ABSTRACT_ORIGIN (copy) = DECL_ORIGIN (decl);
/* The new variable/label has no RTL, yet. */
- DECL_RTL (copy) = NULL_RTX;
+ SET_DECL_RTL (copy, NULL_RTX);
/* These args would always appear unused, if not for this. */
TREE_USED (copy) = 1;
@@ -952,7 +954,8 @@ expand_inline_function (fndecl, parms, target, ignore, type,
REG_FUNCTION_RETURN_VALUE_P. */
map->inline_target = 0;
- loc = DECL_RTL (DECL_RESULT (fndecl));
+ loc = (DECL_RTL_SET_P (DECL_RESULT (fndecl))
+ ? DECL_RTL (DECL_RESULT (fndecl)) : NULL_RTX);
if (TYPE_MODE (type) == VOIDmode)
/* There is no return value to worry about. */
@@ -1634,7 +1637,7 @@ integrate_parm_decls (args, map, arg_vector)
subst_constants. */
subst_constants (&new_decl_rtl, NULL_RTX, map, 1);
apply_change_group ();
- DECL_RTL (decl) = new_decl_rtl;
+ SET_DECL_RTL (decl, new_decl_rtl);
}
}
@@ -1664,15 +1667,19 @@ integrate_decl_tree (let, map)
d = copy_decl_for_inlining (t, map->fndecl, current_function_decl);
- if (DECL_RTL (t) != 0)
+ if (DECL_RTL_SET_P (t))
{
- DECL_RTL (d) = copy_rtx_and_substitute (DECL_RTL (t), map, 1);
+ rtx r;
+
+ SET_DECL_RTL (d, copy_rtx_and_substitute (DECL_RTL (t), map, 1));
/* Fully instantiate the address with the equivalent form so that the
debugging information contains the actual register, instead of the
virtual register. Do this by not passing an insn to
subst_constants. */
- subst_constants (&DECL_RTL (d), NULL_RTX, map, 1);
+ r = DECL_RTL (d);
+ subst_constants (&r, NULL_RTX, map, 1);
+ SET_DECL_RTL (d, r);
apply_change_group ();
}
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 8b40d94..e0fd390 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,11 @@
+2001-03-14 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (build_static_field_ref): Likewise.
+ (make_method_value): Likewise.
+ (get_dispatch_table): Likewise.
+
+ * decl.c (push_jvm_slot): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
+
2001-03-07 Tom Tromey <tromey@redhat.com>
* config-lang.in (lang_requires): Define.
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 698ca04..4de1330 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -983,7 +983,7 @@ build_static_field_ref (fdecl)
int is_compiled = is_compiled_class (fclass);
if (is_compiled)
{
- if (DECL_RTL (fdecl) == 0)
+ if (!DECL_RTL_SET_P (fdecl))
{
make_decl_rtl (fdecl, NULL);
if (is_compiled == 1)
@@ -1146,7 +1146,7 @@ make_method_value (mdecl)
#define ACC_TRANSLATED 0x4000
int accflags = get_access_flags_from_decl (mdecl) | ACC_TRANSLATED;
code = null_pointer_node;
- if (DECL_RTL (mdecl))
+ if (DECL_RTL_SET_P (mdecl))
code = build1 (ADDR_EXPR, nativecode_ptr_type_node, mdecl);
START_RECORD_CONSTRUCTOR (minit, method_type_node);
PUSH_FIELD_VALUE (minit, "name",
@@ -1220,7 +1220,7 @@ get_dispatch_table (type, this_class_addr)
}
else
{
- if (DECL_RTL (method) == 0)
+ if (!DECL_RTL_SET_P (method))
make_decl_rtl (method, NULL);
method = build1 (ADDR_EXPR, nativecode_ptr_type_node, method);
}
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 32e6976..d9bc2ee 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -110,13 +110,13 @@ push_jvm_slot (index, decl)
while (tmp != NULL_TREE)
{
if (TYPE_MODE (type) == TYPE_MODE (TREE_TYPE (tmp)))
- rtl = DECL_RTL (tmp);
+ rtl = DECL_RTL_IF_SET (tmp);
if (rtl != NULL)
break;
tmp = DECL_LOCAL_SLOT_CHAIN (tmp);
}
if (rtl != NULL)
- DECL_RTL (decl) = rtl;
+ SET_DECL_RTL (decl, rtl);
else
{
if (index >= DECL_MAX_LOCALS (current_function_decl))
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 0d2b804..d71ba59 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -1983,8 +1983,8 @@ generate_static_references ()
type = build_array_type (build_pointer_type (void_type_node), 0);
decl = build_decl (VAR_DECL, ident, type);
- make_decl_rtl (decl, 0);
TREE_USED (decl) = 1;
+ TREE_STATIC (decl) = 1;
decls
= tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, decl, 1), decls);
}
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 3bbea3f..459b55d 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -441,7 +441,7 @@ print_node (file, prefix, node, indent)
print_lang_decl (file, node, indent);
- if (DECL_RTL (node) != 0)
+ if (DECL_RTL_SET_P (node))
{
indent_to (file, indent + 4);
print_rtl (file, DECL_RTL (node));
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 2f00113..189fdca 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -785,7 +785,7 @@ stack_result (decl)
if (aggregate_value_p (DECL_RESULT (decl)))
return 0;
- result = DECL_RTL (DECL_RESULT (decl));
+ result = DECL_RTL_IF_SET (DECL_RESULT (decl));
if (result != 0)
{
#ifdef FUNCTION_OUTGOING_VALUE
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 4ca2c97..1786c20 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -675,12 +675,13 @@ label_rtx (label)
if (TREE_CODE (label) != LABEL_DECL)
abort ();
- if (DECL_RTL (label))
- return DECL_RTL (label);
+ if (!DECL_RTL_SET_P (label))
+ SET_DECL_RTL (label, gen_label_rtx ());
- return DECL_RTL (label) = gen_label_rtx ();
+ return DECL_RTL (label);
}
+
/* Add an unconditional jump to LABEL as the next sequential instruction. */
void
@@ -2920,7 +2921,7 @@ expand_return (retval)
run destructors on variables that might be used in the subsequent
computation of the return value. */
rtx last_insn = 0;
- rtx result_rtl = DECL_RTL (DECL_RESULT (current_function_decl));
+ rtx result_rtl;
register rtx val = 0;
tree retval_rhs;
int cleanups;
@@ -3000,6 +3001,8 @@ expand_return (retval)
return;
}
+ result_rtl = DECL_RTL (DECL_RESULT (current_function_decl));
+
/* If the result is an aggregate that is being returned in one (or more)
registers, load the registers here. The compiler currently can't handle
copying a BLKmode value into registers. We could put this code in a
@@ -3838,18 +3841,18 @@ expand_decl (decl)
/* Create the RTL representation for the variable. */
if (type == error_mark_node)
- DECL_RTL (decl) = gen_rtx_MEM (BLKmode, const0_rtx);
+ SET_DECL_RTL (decl, gen_rtx_MEM (BLKmode, const0_rtx));
else if (DECL_SIZE (decl) == 0)
/* Variable with incomplete type. */
{
if (DECL_INITIAL (decl) == 0)
/* Error message was already done; now avoid a crash. */
- DECL_RTL (decl) = gen_rtx_MEM (BLKmode, const0_rtx);
+ SET_DECL_RTL (decl, gen_rtx_MEM (BLKmode, const0_rtx));
else
/* An initializer is going to decide the size of this array.
Until we know the size, represent its address with a reg. */
- DECL_RTL (decl) = gen_rtx_MEM (BLKmode, gen_reg_rtx (Pmode));
+ SET_DECL_RTL (decl, gen_rtx_MEM (BLKmode, gen_reg_rtx (Pmode)));
set_mem_attributes (DECL_RTL (decl), decl, 1);
}
@@ -3868,7 +3871,7 @@ expand_decl (decl)
enum machine_mode reg_mode
= promote_mode (type, DECL_MODE (decl), &unsignedp, 0);
- DECL_RTL (decl) = gen_reg_rtx (reg_mode);
+ SET_DECL_RTL (decl, gen_reg_rtx (reg_mode));
mark_user_reg (DECL_RTL (decl));
if (POINTER_TYPE_P (type))
@@ -3895,7 +3898,7 @@ expand_decl (decl)
whose size was determined by the initializer.
The old address was a register; set that register now
to the proper address. */
- if (DECL_RTL (decl) != 0)
+ if (DECL_RTL_SET_P (decl))
{
if (GET_CODE (DECL_RTL (decl)) != MEM
|| GET_CODE (XEXP (DECL_RTL (decl), 0)) != REG)
@@ -3903,7 +3906,8 @@ expand_decl (decl)
oldaddr = XEXP (DECL_RTL (decl), 0);
}
- DECL_RTL (decl) = assign_temp (TREE_TYPE (decl), 1, 1, 1);
+ SET_DECL_RTL (decl,
+ assign_temp (TREE_TYPE (decl), 1, 1, 1));
/* Set alignment we actually gave this decl. */
DECL_ALIGN (decl) = (DECL_MODE (decl) == BLKmode ? BIGGEST_ALIGNMENT
@@ -3945,7 +3949,7 @@ expand_decl (decl)
TYPE_ALIGN (TREE_TYPE (decl)));
/* Reference the variable indirect through that rtx. */
- DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl), address);
+ SET_DECL_RTL (decl, gen_rtx_MEM (DECL_MODE (decl), address));
set_mem_attributes (DECL_RTL (decl), decl, 1);
@@ -4061,7 +4065,7 @@ expand_decl_cleanup (decl, cleanup)
emit_move_insn (flag, const1_rtx);
cond = build_decl (VAR_DECL, NULL_TREE, type_for_mode (word_mode, 1));
- DECL_RTL (cond) = flag;
+ SET_DECL_RTL (cond, flag);
/* Conditionalize the cleanup. */
cleanup = build (COND_EXPR, void_type_node,
@@ -4262,19 +4266,20 @@ expand_anon_union_decl (decl, cleanup, decl_elts)
if (GET_CODE (x) == MEM)
{
if (mode == GET_MODE (x))
- DECL_RTL (decl_elt) = x;
+ SET_DECL_RTL (decl_elt, x);
else
{
- DECL_RTL (decl_elt) = gen_rtx_MEM (mode, copy_rtx (XEXP (x, 0)));
+ SET_DECL_RTL (decl_elt,
+ gen_rtx_MEM (mode, copy_rtx (XEXP (x, 0))));
MEM_COPY_ATTRIBUTES (DECL_RTL (decl_elt), x);
}
}
else if (GET_CODE (x) == REG)
{
if (mode == GET_MODE (x))
- DECL_RTL (decl_elt) = x;
+ SET_DECL_RTL (decl_elt, x);
else
- DECL_RTL (decl_elt) = gen_rtx_SUBREG (mode, x, 0);
+ SET_DECL_RTL (decl_elt, gen_rtx_SUBREG (mode, x, 0));
}
else
abort ();
diff --git a/gcc/toplev.c b/gcc/toplev.c
index cfe797e..0fed3e9 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -2007,7 +2007,7 @@ check_global_declarations (vec, len)
/* Cancel the RTL for this decl so that, if debugging info
output for global variables is still to come,
this one will be omitted. */
- DECL_RTL (decl) = NULL;
+ SET_DECL_RTL (decl, NULL_RTX);
/* Warn about any function
declared static but not defined.
@@ -2578,7 +2578,8 @@ rest_of_decl_compilation (decl, asmspec, top_level, at_end)
|| TREE_CODE (decl) == FUNCTION_DECL)
{
timevar_push (TV_VARCONST);
- make_decl_rtl (decl, asmspec);
+ 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. */
@@ -2595,14 +2596,15 @@ rest_of_decl_compilation (decl, asmspec, top_level, at_end)
{
if (decode_reg_name (asmspec) >= 0)
{
- DECL_RTL (decl) = 0;
+ SET_DECL_RTL (decl, NULL_RTX);
make_decl_rtl (decl, asmspec);
}
else
{
error ("invalid register name `%s' for register variable", asmspec);
DECL_REGISTER (decl) = 0;
- make_decl_rtl (decl, NULL);
+ if (!top_level)
+ expand_decl (decl);
}
}
#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
diff --git a/gcc/tree.c b/gcc/tree.c
index ae7f005..3143db4 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3518,10 +3518,10 @@ simple_cst_equal (t1, t2)
as being equivalent to anything. */
if ((TREE_CODE (TREE_OPERAND (t1, 0)) == VAR_DECL
&& DECL_NAME (TREE_OPERAND (t1, 0)) == NULL_TREE
- && DECL_RTL (TREE_OPERAND (t1, 0)) == 0)
+ && !DECL_RTL_SET_P (TREE_OPERAND (t1, 0)))
|| (TREE_CODE (TREE_OPERAND (t2, 0)) == VAR_DECL
&& DECL_NAME (TREE_OPERAND (t2, 0)) == NULL_TREE
- && DECL_RTL (TREE_OPERAND (t2, 0)) == 0))
+ && !DECL_RTL_SET_P (TREE_OPERAND (t2, 0))))
cmp = 1;
else
cmp = simple_cst_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
diff --git a/gcc/tree.h b/gcc/tree.h
index 4ec4321..55e19c0 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1341,8 +1341,27 @@ struct tree_type
PROMOTED_MODE is defined, the mode of this expression may not be same
as DECL_MODE. In that case, DECL_MODE contains the mode corresponding
to the variable's data type, while the mode
- of DECL_RTL is the mode actually used to contain the data. */
-#define DECL_RTL(NODE) (DECL_CHECK (NODE)->decl.rtl)
+ of DECL_RTL is the mode actually used to contain the data.
+
+ This value can be evaluated lazily for functions, variables with
+ static storage duration, and labels. */
+#define DECL_RTL(NODE) \
+ (DECL_CHECK (NODE)->decl.rtl \
+ ? (NODE)->decl.rtl \
+ : (make_decl_rtl (NODE, NULL), (NODE)->decl.rtl))
+/* Set the DECL_RTL for NODE to RTL. */
+#define SET_DECL_RTL(NODE, RTL) \
+ (DECL_CHECK (NODE)->decl.rtl = (RTL))
+/* Returns non-zero if the DECL_RTL for NODE has already been set. */
+#define DECL_RTL_SET_P(NODE) \
+ (DECL_CHECK (NODE)->decl.rtl != NULL)
+/* Copy the RTL from NODE1 to NODE2. If the RTL was not set for
+ NODE1, it will not be set for NODE2; this is a lazy copy. */
+#define COPY_DECL_RTL(NODE1, NODE2) \
+ (DECL_CHECK (NODE2)->decl.rtl = DECL_CHECK (NODE1)->decl.rtl)
+/* The DECL_RTL for NODE, if it is set, or NULL, if it is not set. */
+#define DECL_RTL_IF_SET(NODE) \
+ (DECL_RTL_SET_P (NODE) ? DECL_RTL (NODE) : NULL)
/* Holds an INSN_LIST of all of the live ranges in which the variable
has been moved to a possibly different register. */
#define DECL_LIVE_RANGE_RTL(NODE) (DECL_CHECK (NODE)->decl.live_range_rtl)
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 1fee247..b5d5dfa 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -565,10 +565,15 @@ decode_reg_name (asmspec)
return -1;
}
-/* Create the DECL_RTL for a declaration for a static or external variable
- or static or external function.
- ASMSPEC, if not 0, is the string which the user specified
- as the assembler symbol name.
+/* Create the DECL_RTL for a VAR_DECL or FUNCTION_DECL. DECL should
+ have static storage duration. In other words, it should not be an
+ automatic variable, including PARM_DECLs.
+
+ 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. */
@@ -582,9 +587,22 @@ make_decl_rtl (decl, asmspec)
const char *new_name = 0;
int reg_number;
+ /* Check that we are not being given an automatic variable. */
+ if (TREE_CODE (decl) == PARM_DECL
+ || TREE_CODE (decl) == RESULT_DECL
+ || (TREE_CODE (decl) == VAR_DECL
+ && !TREE_STATIC (decl)
+ && !DECL_EXTERNAL (decl)
+ && !DECL_REGISTER (decl)))
+ abort ();
+ /* And that we were not given a type or a label. */
+ else if (TREE_CODE (decl) == TYPE_DECL
+ || TREE_CODE (decl) == LABEL_DECL)
+ abort ();
+
/* For a duplicate declaration, we can be called twice on the
same DECL node. Don't discard the RTL already made. */
- if (DECL_RTL (decl) != 0)
+ if (DECL_RTL_SET_P (decl))
{
/* If the old RTL had the wrong mode, fix the mode. */
if (GET_MODE (DECL_RTL (decl)) != DECL_MODE (decl))
@@ -652,8 +670,9 @@ make_decl_rtl (decl, asmspec)
usage is somewhat suspect, we nevertheless use the following
kludge to avoid setting DECL_RTL to frame_pointer_rtx. */
- DECL_RTL (decl)
- = gen_rtx_REG (DECL_MODE (decl), FIRST_PSEUDO_REGISTER);
+ SET_DECL_RTL (decl,
+ gen_rtx_REG (DECL_MODE (decl),
+ FIRST_PSEUDO_REGISTER));
REGNO (DECL_RTL (decl)) = reg_number;
REG_USERVAR_P (DECL_RTL (decl)) = 1;
@@ -731,8 +750,8 @@ make_decl_rtl (decl, asmspec)
&& (TREE_PUBLIC (decl) || TREE_STATIC (decl)))))
TREE_SIDE_EFFECTS (decl) = 1;
- DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl),
- gen_rtx_SYMBOL_REF (Pmode, name));
+ SET_DECL_RTL (decl, gen_rtx_MEM (DECL_MODE (decl),
+ gen_rtx_SYMBOL_REF (Pmode, name)));
if (TREE_CODE (decl) != FUNCTION_DECL)
set_mem_attributes (DECL_RTL (decl), decl, 1);
@@ -4785,8 +4804,7 @@ assemble_alias (decl, target)
{
const char *name;
- make_decl_rtl (decl, (char *) 0);
- name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
+ name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
#ifdef ASM_OUTPUT_DEF
/* Make name accessible from other files, if appropriate. */