[project @ 2005-01-19 18:31:07 by wolfgang]
[ghc-hetmet.git] / ghc / includes / MachRegs.h
index 6f4b1ac..83a633b 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: MachRegs.h,v 1.17 2004/11/21 22:25:24 desrt Exp $
+ * $Id: MachRegs.h,v 1.20 2005/01/19 18:31:07 wolfgang Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
  * only in here please.
  */
 
-/* define NO_REGS to omit register declarations - used in RTS C code
- * that needs all the STG definitions but not the global register 
- * settings.
+/* 
+ * Defining NO_REGS causes no global registers to be used.  NO_REGS is
+ * typically defined by GHC, via a command-line option passed to gcc,
+ * when the -funregisterised flag is given.
+ *
+ * NB. When NO_REGS is on, calling & return conventions may be
+ * different.  For example, all function arguments will be passed on
+ * the stack, and components of an unboxed tuple will be returned on
+ * the stack rather than in registers.
  */
 #ifndef NO_REGS
 
 #endif
 #define REG_Sp     ebp
 
+#ifndef STOLEN_X86_REGS
+#define STOLEN_X86_REGS 4
+#endif
+
 #if STOLEN_X86_REGS >= 3
 # define REG_R1            esi
 #endif
 
    0           system glue?    (caller-save, volatile)
    1           SP              (callee-save, non-volatile)
-   2           RTOC            (callee-save, non-volatile)
+   2            AIX, powerpc64-linux:
+                    RTOC        (a strange special case)
+                darwin:         
+                                (caller-save, volatile)
+                powerpc32-linux:
+                                reserved for use by system
+                    
    3-10                args/return     (caller-save, volatile)
    11,12       system glue?    (caller-save, volatile)
-   13-31                       (callee-save, non-volatile)
+   13           on 64-bit:      reserved for thread state pointer
+                on 32-bit:      (callee-save, non-volatile)
+   14-31                       (callee-save, non-volatile)
    
    f0                          (caller-save, volatile)
    f1-f13      args/return     (caller-save, volatile)
    f14-f31                     (callee-save, non-volatile)
    
-   \tr{13}--\tr{31} are wonderful callee-save registers.
+   \tr{14}--\tr{31} are wonderful callee-save registers on all ppc OSes.
    \tr{0}--\tr{12} are caller-save registers.
    
    \tr{%f14}--\tr{%f31} are callee-save floating-point registers.
    
-   I think we can do the Whole Business with callee-save registers only!
+   We can do the Whole Business with callee-save registers only!
    -------------------------------------------------------------------------- */
 
 #if powerpc_TARGET_ARCH || powerpc64_TARGET_ARCH || rs6000_TARGET_ARCH