[commit: ghc] ghc-7.4: Hide STG register declarations for LLVM C compilers (a71edf5)
Ian Lynagh
igloo at earth.li
Mon Dec 19 18:44:02 CET 2011
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : ghc-7.4
http://hackage.haskell.org/trac/ghc/changeset/a71edf5f59574ccb7a1040c5fdbc3d85927525df
>---------------------------------------------------------------
commit a71edf5f59574ccb7a1040c5fdbc3d85927525df
Author: David M Peixotto <dmp at rice.edu>
Date: Wed Dec 7 08:20:47 2011 -0600
Hide STG register declarations for LLVM C compilers
This commit swaps the import order of Rts.h and Stg.h in
StgCRun.c for non-SPARC architectures. Swapping the import
order prevents the declaration of the global registers thus
allowing the GHC runtime to be compiled by LLVM-based C
compilers.
LLVM-base C compilers cannot use the global register
declarations (for R1, R2, etc.) because they use
GCC-specific extensions. The declarations are not needed in
StgCRun.c except for the SPARC architecture. The other
architectures use hand-written assembly that accesses the
appropriate register directly.
>---------------------------------------------------------------
rts/StgCRun.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/rts/StgCRun.c b/rts/StgCRun.c
index 7ae5bac..89aa0a3 100644
--- a/rts/StgCRun.c
+++ b/rts/StgCRun.c
@@ -29,12 +29,24 @@
#include "PosixSource.h"
#include "ghcconfig.h"
+#ifdef sparc_HOST_ARCH
/* include Stg.h first because we want real machine regs in here: we
* have to get the value of R1 back from Stg land to C land intact.
*/
#define IN_STGCRUN 1
#include "Stg.h"
#include "Rts.h"
+#else
+/* The other architectures do not require the actual register macro definitions
+ * here because they use hand written assembly to implement the StgRun
+ * function. Including Stg.h first will define the R1 values using GCC specific
+ * techniques, which we don't want for LLVM based C compilers. Since we don't
+ * actually need the real machine register definitions here, we include the
+ * headers in the opposite order to allow LLVM-based C compilers to work.
+ */
+#include "Rts.h"
+#include "Stg.h"
+#endif
#include "StgRun.h"
#include "Capability.h"
More information about the Cvs-ghc
mailing list