Commit 8839fca4 by Ian Lance Taylor

Add support for new target macro CONSTANT_AFTER_FUNCTION_P

From-SVN: r13489
parent 686fc141
/* Output variables, constants and external declarations, for GNU compiler. /* Output variables, constants and external declarations, for GNU compiler.
Copyright (C) 1987, 88, 89, 92-5, 1996 Free Software Foundation, Inc. Copyright (C) 1987, 88, 89, 92-6, 1997 Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -144,6 +144,7 @@ static struct constant_descriptor *record_constant_rtx PROTO((enum machine_mode, ...@@ -144,6 +144,7 @@ static struct constant_descriptor *record_constant_rtx PROTO((enum machine_mode,
rtx)); rtx));
static struct pool_constant *find_pool_constant PROTO((rtx)); static struct pool_constant *find_pool_constant PROTO((rtx));
static int output_addressed_constants PROTO((tree)); static int output_addressed_constants PROTO((tree));
static void output_after_function_constants PROTO((void));
static void bc_assemble_integer PROTO((tree, int)); static void bc_assemble_integer PROTO((tree, int));
static void output_constructor PROTO((tree, int)); static void output_constructor PROTO((tree, int));
...@@ -1025,6 +1026,9 @@ assemble_end_function (decl, fnname) ...@@ -1025,6 +1026,9 @@ assemble_end_function (decl, fnname)
#endif #endif
if (! CONSTANT_POOL_BEFORE_FUNCTION) if (! CONSTANT_POOL_BEFORE_FUNCTION)
output_constant_pool (fnname, decl); output_constant_pool (fnname, decl);
/* Output any constants which should appear after the function. */
output_after_function_constants ();
} }
/* Assemble code to leave SIZE bytes of zeros. */ /* Assemble code to leave SIZE bytes of zeros. */
...@@ -2737,6 +2741,10 @@ struct deferred_constant ...@@ -2737,6 +2741,10 @@ struct deferred_constant
static struct deferred_constant *deferred_constants; static struct deferred_constant *deferred_constants;
/* Another list of constants which should be output after the
function. */
static struct deferred_constant *after_function_constants;
/* Nonzero means defer output of addressed subconstants /* Nonzero means defer output of addressed subconstants
(i.e., those for which output_constant_def is called.) */ (i.e., those for which output_constant_def is called.) */
static int defer_addressed_constants_flag; static int defer_addressed_constants_flag;
...@@ -2772,6 +2780,23 @@ output_deferred_addressed_constants () ...@@ -2772,6 +2780,23 @@ output_deferred_addressed_constants ()
deferred_constants = 0; deferred_constants = 0;
} }
/* Output any constants which should appear after a function. */
static void
output_after_function_constants ()
{
struct deferred_constant *p, *next;
for (p = after_function_constants; p; p = next)
{
output_constant_def_contents (p->exp, p->reloc, p->labelno);
next = p->next;
free (p);
}
after_function_constants = 0;
}
/* Make a copy of the whole tree structure for a constant. /* Make a copy of the whole tree structure for a constant.
This handles the same types of nodes that compare_constant This handles the same types of nodes that compare_constant
and record_constant handle. */ and record_constant handle. */
...@@ -2925,7 +2950,15 @@ output_constant_def (exp) ...@@ -2925,7 +2950,15 @@ output_constant_def (exp)
output it (or defer its output for later). */ output it (or defer its output for later). */
if (found == 0) if (found == 0)
{ {
if (defer_addressed_constants_flag) int after_function = 0;
#ifdef CONSTANT_AFTER_FUNCTION_P
if (current_function_decl != 0
&& CONSTANT_AFTER_FUNCTION_P (exp))
after_function = 1;
#endif
if (defer_addressed_constants_flag || after_function)
{ {
struct deferred_constant *p; struct deferred_constant *p;
p = (struct deferred_constant *) xmalloc (sizeof (struct deferred_constant)); p = (struct deferred_constant *) xmalloc (sizeof (struct deferred_constant));
...@@ -2936,8 +2969,16 @@ output_constant_def (exp) ...@@ -2936,8 +2969,16 @@ output_constant_def (exp)
pop_obstacks (); pop_obstacks ();
p->reloc = reloc; p->reloc = reloc;
p->labelno = const_labelno++; p->labelno = const_labelno++;
p->next = deferred_constants; if (after_function)
deferred_constants = p; {
p->next = after_function_constants;
after_function_constants = p;
}
else
{
p->next = deferred_constants;
deferred_constants = p;
}
} }
else else
output_constant_def_contents (exp, reloc, const_labelno++); output_constant_def_contents (exp, reloc, const_labelno++);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment