Skip to content
Snippets Groups Projects
Commit f5fd4677 authored by Simon Marlow's avatar Simon Marlow
Browse files

[project @ 1999-10-15 09:50:22 by simonmar]

Add macros for two-register call/return convention, for experimentation.
parent ed2992a5
No related merge requests found
/* -----------------------------------------------------------------------------
* $Id: PrimOps.hc,v 1.31 1999/10/13 16:39:23 simonmar Exp $
* $Id: PrimOps.hc,v 1.32 1999/10/15 09:50:22 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -55,7 +55,7 @@ W_ GHC_ZCCReturnable_static_info[0];
*/
/*------ All Regs available */
#ifdef REG_R8
#if defined(REG_R8)
# define RET_P(a) R1.w = (W_)(a); JMP_(ENTRY_CODE(Sp[0]));
# define RET_N(a) RET_P(a)
......@@ -80,15 +80,60 @@ W_ GHC_ZCCReturnable_static_info[0];
R4.w = (W_)(d); R5.w = (W_)(e); R6.w = (W_)(f); \
JMP_(ENTRY_CODE(Sp[0]));
#else
#if defined(REG_R7) || defined(REG_R6) || defined(REG_R5) || \
defined(REG_R4) || defined(REG_R3) || defined(REG_R2)
#elif defined(REG_R7) || defined(REG_R6) || defined(REG_R5) || \
defined(REG_R4) || defined(REG_R3)
# error RET_n macros not defined for this setup.
#else
/*------ 2 Registers available */
#elif defined(REG_R2)
# define RET_P(a) R1.w = (W_)(a); JMP_(ENTRY_CODE(Sp[0]));
# define RET_N(a) RET_P(a)
# define RET_PP(a,b) R1.w = (W_)(a); R2.w = (W_)(b); \
JMP_(ENTRY_CODE(Sp[0]));
# define RET_NN(a,b) RET_PP(a,b)
# define RET_NP(a,b) RET_PP(a,b)
# define RET_PPP(a,b,c) \
R1.w = (W_)(a); R2.w = (W_)(b); Sp[-1] = (W_)(c); Sp -= 1; \
JMP_(ENTRY_CODE(Sp[1]));
# define RET_NNP(a,b,c) \
R1.w = (W_)(a); R2.w = (W_)(b); Sp[-1] = (W_)(c); Sp -= 1; \
JMP_(ENTRY_CODE(Sp[1]));
# define RET_NNNP(a,b,c,d) \
R1.w = (W_)(a); \
R2.w = (W_)(b); \
/* Sp[-3] = ARGTAG(1); */ \
Sp[-2] = (W_)(c); \
Sp[-1] = (W_)(d); \
Sp -= 3; \
JMP_(ENTRY_CODE(Sp[3]));
# define RET_NPNP(a,b,c,d) \
R1.w = (W_)(a); \
R2.w = (W_)(b); \
/* Sp[-3] = ARGTAG(1); */ \
Sp[-2] = (W_)(c); \
Sp[-1] = (W_)(d); \
Sp -= 3; \
JMP_(ENTRY_CODE(Sp[3]));
# define RET_NNPNNP(a,b,c,d,e,f) \
R1.w = (W_)(a); \
R2.w = (W_)(b); \
Sp[-6] = (W_)(c); \
/* Sp[-5] = ARGTAG(1); */ \
Sp[-4] = (W_)(d); \
/* Sp[-3] = ARGTAG(1); */ \
Sp[-2] = (W_)(e); \
Sp[-1] = (W_)(f); \
Sp -= 6; \
JMP_(ENTRY_CODE(Sp[6]));
/*------ 1 Register available */
#ifdef REG_R1
#elif defined(REG_R1)
# define RET_P(a) R1.w = (W_)(a); JMP_(ENTRY_CODE(Sp[0]));
# define RET_N(a) RET_P(a)
......@@ -176,9 +221,6 @@ W_ GHC_ZCCReturnable_static_info[0];
#endif
#endif
#endif
/*-----------------------------------------------------------------------------
Array Primitives
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment