aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>1999-09-07 22:00:54 -0700
committerRichard Henderson <rth@gcc.gnu.org>1999-09-07 22:00:54 -0700
commit01439aeea597671b4e292002bc2b1ae2d7e3e82d (patch)
treeae00fa8433655136bf64936e369c9a43b7ba7401 /gcc
parent7d617b67c06b5bd615a20982da569aa1c563a00b (diff)
downloadgcc-01439aeea597671b4e292002bc2b1ae2d7e3e82d.zip
gcc-01439aeea597671b4e292002bc2b1ae2d7e3e82d.tar.gz
gcc-01439aeea597671b4e292002bc2b1ae2d7e3e82d.tar.bz2
alpha.h (alpha_eh_epilogue_sp_ofs): Remove.
* alpha.h (alpha_eh_epilogue_sp_ofs): Remove. (struct machine_function): Declare; add eh_epilogue_sp_ofs. (INIT_EXPANDERS): Remove. * alpha.c: Include ggc.h. (alpha_eh_epilogue_sp_ofs, alpha_return_addr_rtx): Remove. (alpha_init_machine_status, alpha_mark_machine_status): New. (override_options): Install them. (struct machine_function): Moved to alpha.h. (alpha_save_machine_status, alpha_restore_machine_status): Remove. (alpha_init_expanders): Remove. (alpha_return_addr): Adjust to use current_function->machine. (alpha_ra_ever_killed): Likewise. (alpha_expand_epilogue): Likewise. * alpha.md (eh_epilogue): Likewise. From-SVN: r29182
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/config/alpha/alpha.c95
-rw-r--r--gcc/config/alpha/alpha.h17
-rw-r--r--gcc/config/alpha/alpha.md2
4 files changed, 65 insertions, 66 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 15b8fbb..c5a8b17 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,20 @@
+Tue Sep 7 21:55:02 1999 Richard Henderson <rth@cygnus.com>
+
+ * alpha.h (alpha_eh_epilogue_sp_ofs): Remove.
+ (struct machine_function): Declare; add eh_epilogue_sp_ofs.
+ (INIT_EXPANDERS): Remove.
+ * alpha.c: Include ggc.h.
+ (alpha_eh_epilogue_sp_ofs, alpha_return_addr_rtx): Remove.
+ (alpha_init_machine_status, alpha_mark_machine_status): New.
+ (override_options): Install them.
+ (struct machine_function): Moved to alpha.h.
+ (alpha_save_machine_status, alpha_restore_machine_status): Remove.
+ (alpha_init_expanders): Remove.
+ (alpha_return_addr): Adjust to use current_function->machine.
+ (alpha_ra_ever_killed): Likewise.
+ (alpha_expand_epilogue): Likewise.
+ * alpha.md (eh_epilogue): Likewise.
+
Wed Sep 8 14:34:42 1999 Ian Piumarta <piumarta@prof.inria.fr>
Melissa O'Neill <oneill@cs.sfu.ca>
Geoffrey Keating <geoffk@cygnus.com>
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index e9da5db..37699ca 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -40,6 +40,7 @@ Boston, MA 02111-1307, USA. */
#include "except.h"
#include "function.h"
#include "toplev.h"
+#include "ggc.h"
/* External data. */
extern char *version_string;
@@ -79,19 +80,11 @@ const char *alpha_mlat_string; /* -mmemory-latency= */
rtx alpha_compare_op0, alpha_compare_op1;
int alpha_compare_fp_p;
-/* Define the information needed to modify the epilogue for EH. */
-
-rtx alpha_eh_epilogue_sp_ofs;
-
/* Non-zero if inside of a function, because the Alpha asm can't
handle .files inside of functions. */
static int inside_function = FALSE;
-/* If non-null, this rtx holds the return address for the function. */
-
-static rtx alpha_return_addr_rtx;
-
/* The number of cycles of latency we should assume on memory reads. */
int alpha_memory_latency = 3;
@@ -117,6 +110,10 @@ static void alpha_sa_mask
PROTO((unsigned long *imaskP, unsigned long *fmaskP));
static int alpha_does_function_need_gp
PROTO((void));
+static void alpha_init_machine_status
+ PROTO((struct function *p));
+static void alpha_mark_machine_status
+ PROTO((struct function *p));
/* Get the number of args of a function in one of two ways. */
@@ -319,6 +316,10 @@ override_options ()
/* Acquire a unique set number for our register saves and restores. */
alpha_sr_alias_set = new_alias_set ();
+
+ /* Set up function hooks. */
+ init_machine_status = alpha_init_machine_status;
+ mark_machine_status = alpha_mark_machine_status;
}
/* Returns 1 if VALUE is a mask that contains full bytes of zero or ones. */
@@ -2561,45 +2562,22 @@ alpha_adjust_cost (insn, link, dep_insn, cost)
/* Functions to save and restore alpha_return_addr_rtx. */
-struct machine_function
-{
- rtx ra_rtx;
-};
-
static void
-alpha_save_machine_status (p)
+alpha_init_machine_status (p)
struct function *p;
{
- struct machine_function *machine =
- (struct machine_function *) xmalloc (sizeof (struct machine_function));
-
- p->machine = machine;
- machine->ra_rtx = alpha_return_addr_rtx;
+ p->machine =
+ (struct machine_function *) xcalloc (1, sizeof (struct machine_function));
}
static void
-alpha_restore_machine_status (p)
+alpha_mark_machine_status (p)
struct function *p;
{
struct machine_function *machine = p->machine;
- alpha_return_addr_rtx = machine->ra_rtx;
-
- free (machine);
- p->machine = (struct machine_function *)0;
-}
-
-/* Do anything needed before RTL is emitted for each function. */
-
-void
-alpha_init_expanders ()
-{
- alpha_return_addr_rtx = NULL_RTX;
- alpha_eh_epilogue_sp_ofs = NULL_RTX;
-
- /* Arrange to save and restore machine status around nested functions. */
- save_machine_status = alpha_save_machine_status;
- restore_machine_status = alpha_restore_machine_status;
+ ggc_mark_rtx (machine->eh_epilogue_sp_ofs);
+ ggc_mark_rtx (machine->ra_rtx);
}
/* Start the ball rolling with RETURN_ADDR_RTX. */
@@ -2609,25 +2587,27 @@ alpha_return_addr (count, frame)
int count;
rtx frame ATTRIBUTE_UNUSED;
{
- rtx init;
+ rtx init, reg;
if (count != 0)
return const0_rtx;
- if (alpha_return_addr_rtx)
- return alpha_return_addr_rtx;
-
- /* No rtx yet. Invent one, and initialize it from $26 in the prologue. */
- alpha_return_addr_rtx = gen_reg_rtx (Pmode);
- init = gen_rtx_SET (VOIDmode, alpha_return_addr_rtx,
- gen_rtx_REG (Pmode, REG_RA));
-
- /* Emit the insn to the prologue with the other argument copies. */
- push_topmost_sequence ();
- emit_insn_after (init, get_insns ());
- pop_topmost_sequence ();
+ reg = current_function->machine->ra_rtx;
+ if (reg == NULL)
+ {
+ /* No rtx yet. Invent one, and initialize it from $26 in
+ the prologue. */
+ reg = gen_reg_rtx (Pmode);
+ current_function->machine->ra_rtx = reg;
+ init = gen_rtx_SET (VOIDmode, reg, gen_rtx_REG (Pmode, REG_RA));
+
+ /* Emit the insn to the prologue with the other argument copies. */
+ push_topmost_sequence ();
+ emit_insn_after (init, get_insns ());
+ pop_topmost_sequence ();
+ }
- return alpha_return_addr_rtx;
+ return reg;
}
static int
@@ -2639,7 +2619,7 @@ alpha_ra_ever_killed ()
if (current_function_is_thunk)
return 0;
#endif
- if (!alpha_return_addr_rtx)
+ if (!current_function->machine->ra_rtx)
return regs_ever_live[REG_RA];
push_topmost_sequence ();
@@ -3932,6 +3912,7 @@ alpha_expand_epilogue ()
int fp_is_frame_pointer, fp_offset;
rtx sa_reg, sa_reg_exp = NULL;
rtx sp_adj1, sp_adj2, mem;
+ rtx eh_ofs;
int i;
sa_size = alpha_sa_size ();
@@ -3958,6 +3939,7 @@ alpha_expand_epilogue ()
fp_is_frame_pointer = ((TARGET_OPEN_VMS && vms_is_stack_procedure)
|| (!TARGET_OPEN_VMS && frame_pointer_needed));
+ eh_ofs = current_function->machine->eh_epilogue_sp_ofs;
if (sa_size)
{
/* If we have a frame pointer, restore SP from it. */
@@ -3988,7 +3970,7 @@ alpha_expand_epilogue ()
/* Restore registers in order, excepting a true frame pointer. */
- if (! alpha_eh_epilogue_sp_ofs)
+ if (! eh_ofs)
{
mem = gen_rtx_MEM (DImode, plus_constant(sa_reg, reg_offset));
MEM_ALIAS_SET (mem) = alpha_sr_alias_set;
@@ -4021,16 +4003,15 @@ alpha_expand_epilogue ()
}
}
- if (frame_size || alpha_eh_epilogue_sp_ofs)
+ if (frame_size || eh_ofs)
{
sp_adj1 = stack_pointer_rtx;
- if (alpha_eh_epilogue_sp_ofs)
+ if (eh_ofs)
{
sp_adj1 = gen_rtx_REG (DImode, 23);
emit_move_insn (sp_adj1,
- gen_rtx_PLUS (Pmode, stack_pointer_rtx,
- alpha_eh_epilogue_sp_ofs));
+ gen_rtx_PLUS (Pmode, stack_pointer_rtx, eh_ofs));
}
/* If the stack size is large, begin computation into a temporary
diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h
index 233dae9..a18ad5f 100644
--- a/gcc/config/alpha/alpha.h
+++ b/gcc/config/alpha/alpha.h
@@ -1200,9 +1200,16 @@ extern struct rtx_def *alpha_emit_conditional_move ();
extern struct rtx_def *alpha_compare_op0, *alpha_compare_op1;
extern int alpha_compare_fp_p;
-/* Define the information needed to modify the epilogue for EH. */
+/* Machine specific function data. */
-extern struct rtx_def *alpha_eh_epilogue_sp_ofs;
+struct machine_function
+{
+ /* An offset to apply to the stack pointer when unwinding from EH. */
+ struct rtx_def *eh_epilogue_sp_ofs;
+
+ /* If non-null, this rtx holds the return address for the function. */
+ struct rtx_def *ra_rtx;
+};
/* Make (or fake) .linkage entry for function call.
IS_LOCAL is 0 if name is used in call, 1 if name is used in definition. */
@@ -1327,12 +1334,6 @@ extern struct rtx_def *alpha_return_addr ();
/* Before the prologue, RA lives in $26. */
#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 26)
-
-/* Initialize data used by insn expanders. This is called from insn_emit,
- once for every function before code is generated. */
-
-#define INIT_EXPANDERS alpha_init_expanders ()
-extern void alpha_init_expanders ();
/* Addressing modes, and classification of registers for them. */
diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md
index 6407b6c..456642f 100644
--- a/gcc/config/alpha/alpha.md
+++ b/gcc/config/alpha/alpha.md
@@ -5159,7 +5159,7 @@
"! TARGET_OPEN_VMS"
"
{
- alpha_eh_epilogue_sp_ofs = operands[1];
+ current_function->machine->eh_epilogue_sp_ofs = operands[1];
if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 26)
{
rtx ra = gen_rtx_REG (Pmode, 26);