In trying to write a target for TinyCC, I've noticed the rest of the engine seems to want to do a fair bit of register/stack management. This is fine and dandy, but I am having a lot of difficulty understanding where the line between my target and the TCC register functions such as get_reg, gv, gv2, vpop, etc.
Most notably, I don't understand how to interact with it, to indicate specific values are already in registers. It seems the existing code can't assign registers externally. Additionally, even when using i386 with fastcall, on ARM and even on C67 ... I think it's pushing the registers from the fastcall onto the stack just to get it to fit into the TCC paradigm. Is this true or did I misunderstand?
A way around this would be to create a reg_classes which has little do do with my architecture's registers and only tell TCC about a few pretend registers. On Xtensa, calls are similar to fastcalls, using registers a2-a7 for the first several parameters, and I could keep track of what registers hold what and just re-use them.