thtk
thtk copied to clipboard
Properly handle resolution of [-1], [-2], etc in thecl10.c's expressions.
There's a couple cases we can't handle, and we don't handle any of them particularly well:
- Some opcodes directly pop values off the stack when they read [-1] through [-100], regardless of the exact value. To my knowledge (someone please verify), this is the only kind of opcode from TH10-13. Others read an offset from the current stack pointer for [-1] through [-100], then subtract
th10_instr_t->zerofrom the stack pointer. - For the second kind of opcode, instruction([-1], [-1]) will need to be handled somehow. While the transformation from, say,
1 + 2; ins_XXX([-1], [-1])toins_XXX(1 + 2, 1 + 2)will not change the semantics of ECL code, it will make the output and input no longer bit-for-but identical.
Currently, the handling covers this corner case poorly, and neither kind of opcode perfectly.