(save_386_machine_status): New functions.
authorRichard Stallman <rms@gnu.org>
Mon, 11 Oct 1993 03:03:34 +0000 (03:03 +0000)
committerRichard Stallman <rms@gnu.org>
Mon, 11 Oct 1993 03:03:34 +0000 (03:03 +0000)
(restore_386_machine_status)
(save_386_machine_status): New functions.
(clear_386_stack_locals): Store those functions in
save_machine_status, restore_machine_status.
(struct machine_function): New structure definition.

From-SVN: r5723

gcc/config/i386/i386.c

index 3ceede3fc9c6e9e5832f27ce526f190fcf3e56d6..8ef428910d0fb6d8654ea77eb9e26001d5f6faae 100644 (file)
@@ -31,6 +31,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "insn-attr.h"
 #include "tree.h"
 #include "flags.h"
+#include "function.h"
 
 #ifdef EXTRA_CONSTRAINT
 /* If EXTRA_CONSTRAINT is defined, then the 'S'
@@ -2052,9 +2053,37 @@ output_fp_cc0_set (insn)
 
 static rtx i386_stack_locals[(int) MAX_MACHINE_MODE][MAX_386_STACK_LOCALS];
 
+/* Define the structure for the machine field in struct function.  */
+struct machine_function
+{
+  rtx i386_stack_locals[(int) MAX_MACHINE_MODE][MAX_386_STACK_LOCALS];
+};
+
+/* Functions to save and restore i386_stack_locals.
+   These will be called, via pointer variables,
+   from push_function_context and pop_function_context.  */
+
+void
+save_386_machine_status (p)
+     struct function *p;
+{
+  p->machine = (struct machine_function *) xmalloc (sizeof i386_stack_locals);
+  bcopy (i386_stack_locals, p->machine->i386_stack_locals,
+        sizeof i386_stack_locals);
+}
+
+void
+restore_386_machine_status (p)
+     struct function *p;
+{
+  bcopy (p->machine->i386_stack_locals, i386_stack_locals,
+        sizeof i386_stack_locals);
+  free (p->machine);
+}
+
 /* Clear stack slot assignments remembered from previous functions.
    This is called from INIT_EXPANDERS once before RTL is emitted for each
-   function. */
+   function.  */
 
 void
 clear_386_stack_locals ()
@@ -2066,6 +2095,10 @@ clear_386_stack_locals ()
        mode = (enum machine_mode) ((int) mode + 1))
     for (n = 0; n < MAX_386_STACK_LOCALS; n++)
       i386_stack_locals[(int) mode][n] = NULL_RTX;
+
+  /* Arrange to save and restore i386_stack_locals around nested functions.  */
+  save_machine_status = save_386_machine_status;
+  restore_machine_status = restore_386_machine_status;
 }
 
 /* Return a MEM corresponding to a stack slot with mode MODE.