guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 05/10] vm-engine: remove register assignments


From: Andy Wingo
Subject: [PATCH 05/10] vm-engine: remove register assignments
Date: Thu, 23 May 2013 15:30:58 +0200

* libguile/vm-engine.c: Remove the register assignments inherited from
  the 1990s.  GCC does seem to allocate reasonably on systems with
  enough registers (e.g. x86-64), and on system with too few (x86-32) we
  disabled manual allocation.  Anyway this code was never tested, so
  it's better to leave the compiler to do its own thing, until proven
  otherwise.  Also in the RTL VM we don't need to allocate a register to
  the SP, because it isn't accessed as much.
---
 libguile/vm-engine.c |   73 +++++++++-----------------------------------------
 1 file changed, 12 insertions(+), 61 deletions(-)

diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index 98e9837..b7e355d 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -26,80 +26,31 @@
 # error unknown debug engine VM_ENGINE
 #endif
 
-
-/* Register optimization. [ stolen from librep/src/lispmach.h,v 1.3 ]
-
-   Some compilers underestimate the use of the local variables representing
-   the abstract machine registers, and don't put them in hardware registers,
-   which slows down the interpreter considerably.
-   For GCC, I have hand-assigned hardware registers for several architectures.
-*/
-
+/* Assign some registers by hand.  There used to be a bigger list here,
+   but it was never tested, and in the case of x86-32, was a source of
+   compilation failures.  It can be revived if it's useful, but my naive
+   hope is that simply annotating the locals with "register" will be a
+   sufficient hint to the compiler.  */
 #ifdef __GNUC__
-#ifdef __mips__
-#define IP_REG asm("$16")
-#define SP_REG asm("$17")
-#define FP_REG asm("$18")
-#endif
-#ifdef __sparc__
-#define IP_REG asm("%l0")
-#define SP_REG asm("%l1")
-#define FP_REG asm("%l2")
-#endif
-#ifdef __alpha__
-#ifdef __CRAY__
-#define IP_REG asm("r9")
-#define SP_REG asm("r10")
-#define FP_REG asm("r11")
-#else
-#define IP_REG asm("$9")
-#define SP_REG asm("$10")
-#define FP_REG asm("$11")
-#endif
-#endif
-#ifdef __i386__
-/* too few registers! because of register allocation errors with various gcs,
-   just punt on explicit assignments on i386, hoping that the "register"
-   declaration will be sufficient. */
-#elif defined __x86_64__
+# if defined __x86_64__
 /* GCC 4.6 chooses %rbp for IP_REG and %rbx for SP_REG, which works
    well.  Tell it to keep the jump table in a r12, which is
    callee-saved.  */
-#define JT_REG asm ("r12")
-#endif
-#if defined(PPC) || defined(_POWER) || defined(_IBMR2)
-#define IP_REG asm("26")
-#define SP_REG asm("27")
-#define FP_REG asm("28")
-#endif
-#ifdef __hppa__
-#define IP_REG asm("%r18")
-#define SP_REG asm("%r17")
-#define FP_REG asm("%r16")
-#endif
-#ifdef __mc68000__
-#define IP_REG asm("a5")
-#define SP_REG asm("a4")
-#define FP_REG
-#endif
-#ifdef __arm__
-#define IP_REG asm("r9")
-#define SP_REG asm("r8")
-#define FP_REG asm("r7")
-#endif
+#  define JT_REG asm ("r12")
+# endif
 #endif
 
 #ifndef IP_REG
-#define IP_REG
+# define IP_REG
 #endif
 #ifndef SP_REG
-#define SP_REG
+# define SP_REG
 #endif
 #ifndef FP_REG
-#define FP_REG
+# define FP_REG
 #endif
 #ifndef JT_REG
-#define JT_REG
+# define JT_REG
 #endif
 
 #define VM_ASSERT(condition, handler)           \
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]