/* * Emit a language independent rep of the hash fn. */ void emit(void) { int i, j, t; printf("%d\n", emitbinary); emitint(gl.d); emitint(gl.n); emitint(gl.m); emitfloat(gl.c); emitint(maxlen); emitint(kp->minlen); emitint(kp->maxlen); emitint(kp->minchar); emitint(kp->maxchar); emitint(loop); emitint(numiter+1); emitint(sflag); emitint(seed); for (i=0; i<gl.n; i++) emitint(grnodevalue(gp, i)); for (t=0; t<gl.d; t++) for (i=0; i<tsize; i += ALPHASZ) for (j=0; j<ALPHASZ; j++) emitint(T[t][i+j]); }
void output_ins2fconst(char *instruction, char *ra, float fconstant) { OpcodeEntry *opc = LookupOpcodeByString(instruction); RegisterEntry *rega = LookupRegisterByName(ra); emit8(opc->OpCode); emit8(rega->Register); emitfloat(fconstant); }
void parse_asmdirective(char *dir, char *str, int integer, float fnum) { if (strcmp(dir, ".text") == 0) // deprecated { Warning("Deprecated assembler directive %s", dir); } else if (strcmp(dir, ".data") == 0) // deprecated { Warning("Deprecated assembler directive %s", dir); } else if (strcmp(dir, ".byte") == 0) { if (str) { Error("Unsupported data type for label"); } emit8(integer); } else if (strcmp(dir, ".word") == 0) { if (str) { Error("Unsupported data type for label"); } emit16(integer); } else if (strcmp(dir, ".dword") == 0) { if (str) { AddRelocEntry(str, codeptr); emit32(0); } else { emit32(integer); } } else if (strcmp(dir, ".float") == 0) { if (str) { Error("Unsupported data type for label"); } emitfloat(fnum); } else if (strcmp(dir, ".string") == 0) { assert(str != 0); output_string(str); } }