1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-26 08:20:27 +00:00

More work on the sys-ir.

This commit is contained in:
Calvin Rose 2023-04-08 10:51:46 -05:00
parent 6b74400f2a
commit fd7579dd07

View File

@ -600,7 +600,7 @@ void janet_sys_ir_lower_to_c(JanetSysIR *ir, JanetBuffer *buffer) {
break; break;
} }
case JANET_SYSOP_ADDRESS: case JANET_SYSOP_ADDRESS:
janet_formatb(buffer, "_r%u = &_r%u;\n", instruction.two.dest, instruction.two.src); janet_formatb(buffer, "_r%u = (char *) &_r%u;\n", instruction.two.dest, instruction.two.src);
break; break;
case JANET_SYSOP_JUMP: case JANET_SYSOP_JUMP:
janet_formatb(buffer, "goto _i%u;\n", instruction.jump.to); janet_formatb(buffer, "goto _i%u;\n", instruction.jump.to);
@ -679,10 +679,10 @@ void janet_sys_ir_lower_to_c(JanetSysIR *ir, JanetBuffer *buffer) {
janet_formatb(buffer, "_r%u = ~_r%u;\n", instruction.two.dest, instruction.two.src); janet_formatb(buffer, "_r%u = ~_r%u;\n", instruction.two.dest, instruction.two.src);
break; break;
case JANET_SYSOP_LOAD: case JANET_SYSOP_LOAD:
janet_formatb(buffer, "_r%u = *_r%u", instruction.two.dest, instruction.two.src); janet_formatb(buffer, "_r%u = *((%s *) _r%u)", instruction.two.dest, c_prim_names[ir->types[instruction.two.dest]], instruction.two.src);
break; break;
case JANET_SYSOP_STORE: case JANET_SYSOP_STORE:
janet_formatb(buffer, "*_r%u = _r%u", instruction.two.dest, instruction.two.src); janet_formatb(buffer, "*((%s *) _r%u) = _r%u", c_prim_names[ir->types[instruction.two.src]], instruction.two.dest, instruction.two.src);
break; break;
} }
} }