working on vm

This commit is contained in:
Irmen de Jong
2022-03-27 11:48:44 +02:00
parent 0307f6b42c
commit 12712ef812
4 changed files with 56 additions and 21 deletions
@@ -226,15 +226,13 @@ internal class ExpressionGen(val codeGen: CodeGen) {
code += VmCodeInstruction(Instruction(Opcode.XOR, vmDt, reg1=resultRegister, reg2=leftResultReg, reg3=rightResultReg))
}
"<<" -> {
// TODO check if shift amount works
code += VmCodeInstruction(Instruction(Opcode.LSL, vmDt, reg1=resultRegister, reg2=leftResultReg, reg3=rightResultReg))
}
">>" -> {
// TODO check if shift amount works
code += VmCodeInstruction(Instruction(Opcode.LSR, vmDt, reg1=resultRegister, reg2=leftResultReg, reg3=rightResultReg))
}
"**" -> throw AssemblyError("** operator requires floating point ${binExpr.position}")
// TODO the other operators: "<<", ">>", "==", "!=", "<", ">", "<=", ">="
// TODO the other operators: "==", "!=", "<", ">", "<=", ">="
else -> TODO("operator ${binExpr.operator}")
}
return code