robfinch wrote:
An issue to resolve with having metadata associated with a register is how and whether to save and restore the metadata along with the register value.
Most ISAs with flags have an instruction way to test a condition code and get a 0 or 1 in a register from it. SETcc (x86), CINC (ARM). Otherwise people seem to get by without instructions for loading/storing flags..
Edit: Excuse me, I understand now that you meant how to save/restore registers
at context switches. I suppose they could be aliased to a control register. With 2 bits in 32 GPRs they would fit in a 64-bit register.
Spilled registers would be stripped of its flags, with filling just being regular loads -- which would naturally clear V and C.
jmp_bufs (setjmp/longjmp) should not contain register values. The C standard does not require variables not declared `volatile` to be preserved, but I think they should all be — on the stack, with the state of the last function call, not the last setjmp call. It is a non-local jump, not a checkpoint mechanism.
robfinch wrote:
Another piece of meta data that may be useful is a flag indicating if a pointer value is in the register.
I think such a segregation could belong in the front-end, and not in the register file.
Either have architectural address registers (like M68K) or make the register rename logic segregate pointers from data.
I'm otherwise a fan of capability machines, like CHERI where a pointer has access rights and bounds, and those would be even larger and therefore probably best stored in separate physical registers anyway.
robfinch wrote:
The My66000 discussed on comp.arch has an interesting way of dealing with carry. I believe it is passed along in pipeline registers where it is needed.
I've followed Mitch Alsup's posts there. I don't recall that the handling of the flag itself would be different than on other architectures, only that there is a "The next instruction uses Carry" instruction. I haven't seen how you would express the difference between "set carry" and "use and set carry" though.
BTW, the My 66000 has yet another way to handle conditions. The CMP instruction writes a bitfield to the destination register with a bit per condition code (LT, GT, etc.)