* Copyright (c) 1994-1998.
*
* $RCSfile: Assembler.c,v $
- * $Revision: 1.17 $
- * $Date: 1999/11/19 13:54:53 $
+ * $Revision: 1.19 $
+ * $Date: 1999/11/29 18:59:40 $
*
* This module provides functions to construct BCOs and other closures
* required by the bytecode compiler.
return bco->sp;
}
-void asmEndPrim( AsmBCO bco, const AsmPrim* prim, AsmSp base )
+void asmEndPrim( AsmBCO bco, const AsmPrim* prim, AsmSp base )
{
emiti_8(bco,prim->prefix,prim->opcode);
setSp(bco, base);
}
+char* asmGetPrimopName ( AsmPrim* p )
+{
+ return p->name;
+}
+
/* Hugs used to let you add arbitrary primops with arbitrary types
* just by editing Prelude.hs or any other file you wanted.
* We deliberately avoided that approach because we wanted more
* control over which primops are provided.
*/
-const AsmPrim asmPrimOps[] = {
+AsmPrim asmPrimOps[] = {
/* Char# operations */
{ "primGtChar", "CC", "B", MONAD_Id, i_PRIMOP1, i_gtChar }
, { "primIsIEEEDouble", "", "B", MONAD_Id, i_PRIMOP1, i_isIEEEDouble }
/* Ref operations */
- , { "primNewRef", "a", "R", MONAD_IO, i_PRIMOP2, i_newRef }
- , { "primWriteRef", "Ra", "", MONAD_IO, i_PRIMOP2, i_writeRef }
- , { "primReadRef", "R", "a", MONAD_IO, i_PRIMOP2, i_readRef }
+ , { "primNewRef", "a", "R", MONAD_ST, i_PRIMOP2, i_newRef }
+ , { "primWriteRef", "Ra", "", MONAD_ST, i_PRIMOP2, i_writeRef }
+ , { "primReadRef", "R", "a", MONAD_ST, i_PRIMOP2, i_readRef }
, { "primSameRef", "RR", "B", MONAD_Id, i_PRIMOP2, i_sameRef }
/* PrimArray operations */
, { 0,0,0,0,0,0 }
};
-const AsmPrim ccall_ccall_Id
+AsmPrim ccall_ccall_Id
= { "ccall", 0, 0, MONAD_IO, i_PRIMOP2, i_ccall_ccall_Id };
-const AsmPrim ccall_ccall_IO
+AsmPrim ccall_ccall_IO
= { "ccall", 0, 0, MONAD_IO, i_PRIMOP2, i_ccall_ccall_IO };
-const AsmPrim ccall_stdcall_Id
+AsmPrim ccall_stdcall_Id
= { "ccall", 0, 0, MONAD_IO, i_PRIMOP2, i_ccall_stdcall_Id };
-const AsmPrim ccall_stdcall_IO
+AsmPrim ccall_stdcall_IO
= { "ccall", 0, 0, MONAD_IO, i_PRIMOP2, i_ccall_stdcall_IO };
-const AsmPrim* asmFindPrim( char* s )
+AsmPrim* asmFindPrim( char* s )
{
int i;
for (i=0; asmPrimOps[i].name; ++i) {
return 0;
}
-const AsmPrim* asmFindPrimop( AsmInstr prefix, AsmInstr op )
+AsmPrim* asmFindPrimop( AsmInstr prefix, AsmInstr op )
{
nat i;
for (i=0; asmPrimOps[i].name; ++i) {