/* -----------------------------------------------------------------------------
- * $Id: Assembler.h,v 1.14 2000/05/09 10:00:35 sewardj Exp $
+ * $Id: Assembler.h,v 1.18 2000/10/09 11:21:41 daan Exp $
*
* (c) The GHC Team 1994-1998.
*
typedef unsigned char AsmNat8;
typedef unsigned int AsmNat;
typedef signed int AsmInt;
-typedef signed long long int AsmInt64; /* ToDo: not portable! */
+typedef HsInt64_ AsmInt64;
typedef unsigned int AsmWord;
typedef void* AsmAddr;
typedef unsigned char AsmChar;
extern AsmSp asmBeginMkPAP ( AsmBCO bco );
extern void asmEndMkPAP ( AsmBCO bco, AsmVar v, AsmSp start );
+#ifdef XMLAMBDA
+/*------------------------------------------------------------------------
+ XMlambda primitives.
+------------------------------------------------------------------------*/
+typedef AsmWord AsmWitness;
+#define WITNESS_REP WORD_REP
+
+/* insert/remove primitives on rows */
+extern void asmEndPrimRowChainInsert( AsmBCO bco, AsmSp base, AsmWord n /* number of args */ );
+extern void asmEndPrimRowChainBuild ( AsmBCO bco, AsmSp base, AsmWord n /* number of args */ );
+extern void asmEndPrimRowChainRemove( AsmBCO bco, AsmSp base, AsmWord n /* number of args */ );
+extern void asmEndPrimRowChainSelect( AsmBCO bco, AsmSp base, AsmWord n /* number of args */ );
+
+/* pack/unpack instructions for rows */
+extern AsmVar asmAllocRow ( AsmBCO bco, AsmWord /*number of fields*/ n );
+extern AsmSp asmBeginPackRow ( AsmBCO bco );
+extern void asmEndPackRow ( AsmBCO bco, AsmVar v, AsmSp start,
+ AsmWord /*number of fields*/ n );
+
+extern void asmBeginUnpackRow( AsmBCO bco );
+extern void asmEndUnpackRow ( AsmBCO bco );
+
+extern void asmConstRowTriv ( AsmBCO bco );
+
+/* Inj primitives */
+extern AsmVar asmInjRel( AsmBCO bco, AsmVar var, AsmWitness w );
+extern AsmVar asmInjConst( AsmBCO bco, AsmWitness w );
+
+extern AsmPc asmTestInjRel( AsmBCO bco, AsmVar var, AsmWitness w );
+extern AsmPc asmTestInjConst( AsmBCO, AsmWitness w );
+
+extern void asmWitnessRel( AsmBCO bco, AsmVar var, AsmWitness w );
+extern void asmWitnessConst( AsmBCO bco, AsmWitness w );
+
+extern AsmVar asmUnInj( AsmBCO bco );
+
+#endif
+
/* --------------------------------------------------------------------------
* C-call and H-call
* ------------------------------------------------------------------------*/
CFunDescriptor* mkDescriptor( char* as, char* rs );
+#ifdef XMLAMBDA
+
+typedef enum _CallType
+{ CCall = 'c' /* C calling convention */
+, StdCall = 's' /* Standard calling convention */
+} CallType;
+
+/* The asmEndPrimCall*** functions call external functions.
+ Just start with "asmBeginPrim", push the arguments
+ and end with one of these functions. The argument and
+ result types are given as an argument string containing
+ the character representation of AsmRep's. */
+
+/* asmEndPrimCallDynamic calls a function defined in a dynamic link library.
+ If decorate is true, the funName will be decorated according to its
+ calling convention, for example, with CCall an underscore is prefixed */
+extern void asmEndPrimCallDynamic( AsmBCO bco
+ , AsmSp base
+ , const char* libName
+ , const char* funName
+ , const char* argTypes
+ , const char* resultTypes
+ , CallType callType
+ , int /*bool*/ decorate);
+
+/* asmEndPrimCallIndirect calls the function given by its first
+ argument. (ie. push the address just before calling) */
+extern void asmEndPrimCallIndirect( AsmBCO bco
+ , AsmSp base
+ , const char* argTypes
+ , const char* resultTypes
+ , CallType callType );
+
+
+#endif
+
/*-------------------------------------------------------------------------*/