summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authordias@eecs.harvard.edu <unknown>2008-08-14 12:40:27 +0000
committerdias@eecs.harvard.edu <unknown>2008-08-14 12:40:27 +0000
commit176fa33f17dd78355cc572e006d2ab26898e2c69 (patch)
tree54f951a515eac57626f8f15d57f7bc75f1096a7a /includes
parente06951a75a1f519e8f015880c363a8dedc08ff9c (diff)
downloadhaskell-176fa33f17dd78355cc572e006d2ab26898e2c69.tar.gz
Merging in the new codegen branch
This merge does not turn on the new codegen (which only compiles a select few programs at this point), but it does introduce some changes to the old code generator. The high bits: 1. The Rep Swamp patch is finally here. The highlight is that the representation of types at the machine level has changed. Consequently, this patch contains updates across several back ends. 2. The new Stg -> Cmm path is here, although it appears to have a fair number of bugs lurking. 3. Many improvements along the CmmCPSZ path, including: o stack layout o some code for infotables, half of which is right and half wrong o proc-point splitting
Diffstat (limited to 'includes')
-rw-r--r--includes/Cmm.h9
-rw-r--r--includes/mkDerivedConstants.c35
2 files changed, 30 insertions, 14 deletions
diff --git a/includes/Cmm.h b/includes/Cmm.h
index c0b2fe991a..06a66a79ef 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -88,6 +88,7 @@
#define I16 bits16
#define I32 bits32
#define I64 bits64
+#define P_ gcptr
#if SIZEOF_VOID_P == 4
#define W_ bits32
@@ -254,10 +255,10 @@
#define ENTER() \
again: \
W_ info; \
- if (GETTAG(R1) != 0) { \
+ if (GETTAG(P1) != 0) { \
jump %ENTRY_CODE(Sp(0)); \
} \
- info = %INFO_PTR(R1); \
+ info = %INFO_PTR(P1); \
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] \
(TO_W_( %INFO_TYPE(%STD_INFO(info)) )) { \
case \
@@ -267,7 +268,7 @@
IND_OLDGEN_PERM, \
IND_STATIC: \
{ \
- R1 = StgInd_indirectee(R1); \
+ P1 = StgInd_indirectee(P1); \
goto again; \
} \
case \
@@ -562,7 +563,7 @@
bdescr_free(__bd) = free + WDS(1);
#define recordMutable(p, regs) \
- W_ __p; \
+ P_ __p; \
W_ __bd; \
W_ __gen; \
__p = p; \
diff --git a/includes/mkDerivedConstants.c b/includes/mkDerivedConstants.c
index 798c6e6ab0..116b2e9971 100644
--- a/includes/mkDerivedConstants.c
+++ b/includes/mkDerivedConstants.c
@@ -57,10 +57,19 @@
#if defined(GEN_HASKELL)
#define field_type_(str, s_type, field) /* nothing */
+#define field_type_gcptr_(str, s_type, field) /* nothing */
#else
+/* Defining REP_x to be b32 etc
+ These are both the C-- types used in a load
+ e.g. b32[addr]
+ and the names of the CmmTypes in the compiler
+ b32 :: CmmType
+*/
#define field_type_(str, s_type, field) \
- printf("#define REP_" str " I"); \
+ printf("#define REP_" str " b"); \
printf("%d\n", sizeof (__typeof__(((((s_type*)0)->field)))) * 8);
+#define field_type_gcptr_(str, s_type, field) \
+ printf("#define REP_" str " gcptr\n");
#endif
#define field_type(s_type, field) \
@@ -136,17 +145,23 @@
closure_payload_macro(str(s_type,field));
/* Byte offset and MachRep for a closure field, minus the header */
+#define closure_field_(str, s_type, field) \
+ closure_field_offset_(str,s_type,field) \
+ field_type_(str, s_type, field); \
+ closure_field_macro(str)
+
#define closure_field(s_type, field) \
- closure_field_offset(s_type,field) \
- field_type(s_type, field); \
- closure_field_macro(str(s_type,field))
+ closure_field_(str(s_type,field),s_type,field)
/* Byte offset and MachRep for a closure field, minus the header */
-#define closure_field_(str, s_type, field) \
+#define closure_field_gcptr_(str, s_type, field) \
closure_field_offset_(str,s_type,field) \
- field_type_(str, s_type, field); \
+ field_type_gcptr_(str, s_type, field); \
closure_field_macro(str)
+#define closure_field_gcptr(s_type, field) \
+ closure_field_gcptr_(str(s_type,field),s_type,field)
+
/* Byte offset for a TSO field, minus the header and variable prof bit. */
#define tso_payload_offset(s_type, field) \
def_offset(str(s_type,field), OFFSET(s_type,field) - sizeof(StgHeader) - sizeof(StgTSOProfInfo));
@@ -310,23 +325,23 @@ main(int argc, char *argv[])
closure_size(StgPAP);
closure_field(StgPAP, n_args);
- closure_field(StgPAP, fun);
+ closure_field_gcptr(StgPAP, fun);
closure_field(StgPAP, arity);
closure_payload(StgPAP, payload);
thunk_size(StgAP);
closure_field(StgAP, n_args);
- closure_field(StgAP, fun);
+ closure_field_gcptr(StgAP, fun);
closure_payload(StgAP, payload);
thunk_size(StgAP_STACK);
closure_field(StgAP_STACK, size);
- closure_field(StgAP_STACK, fun);
+ closure_field_gcptr(StgAP_STACK, fun);
closure_payload(StgAP_STACK, payload);
thunk_size(StgSelector);
- closure_field(StgInd, indirectee);
+ closure_field_gcptr(StgInd, indirectee);
closure_size(StgMutVar);
closure_field(StgMutVar, var);