//----------------------------------------- int mult(int left, int right) { int temp; emitLoad(left); emitInstructionSI("mult", right); freeTemp(left); freeTemp(right); temp = getTemp(); emitInstructionSI("st", temp); return temp; }
//----------------------------------------- void println(int expVal) { emitLoad(expVal); freeTemp(expVal); emitInstruction1("dout"); emitInstructionSS("ldc", "'\\n'"); emitInstruction1("aout"); }
void moveCR2(Context* con, unsigned size, lir::Constant* src, lir::Register* dst, Promise* callOffset) { if (isFpr(dst)) { // floating-point lir::Register tmp = size > 4 ? makeTemp64(con) : makeTemp(con); moveCR(con, size, src, size, &tmp); moveRR(con, size, &tmp, size, dst); freeTemp(con, tmp); } else if (size > 4) { uint64_t value = (uint64_t)src->value->value(); ResolvedPromise loBits(value & MASK_LO32); lir::Constant srcLo(&loBits); ResolvedPromise hiBits(value >> 32); lir::Constant srcHi(&hiBits); lir::Register dstHi(dst->high); moveCR(con, 4, &srcLo, 4, dst); moveCR(con, 4, &srcHi, 4, &dstHi); } else if (src->value->resolved() and isOfWidth(getValue(src), 8)) {
//----------------------------------------- void assign(int left, int expVal) { emitLoad(expVal); freeTemp(expVal); emitInstructionSI("st", left); }