Romcc is coming along quite nicely. I keep fixing a corner case here and there but it quite usable and getting more so.
One area where it falls short is in it's handling of lots of small variables. The classic question is: If I declare my small variables to be chars will romcc be able to store them in both AL and AH?
And unfortunately the answer is no. Using the AH, BH, CH, and DH at least when I tried it did not work well. Treating all of the registers the same seems to work much better.
A similar question is can romcc pack 2 byte values in a random register? The answer again is no. But for a different reason extracting and reinserting the values requires an extra register, so it is not a transformation I want to perform automatically.
With that being said I do think it is worth having romcc support keeping multiple values in a register. Otherwise I will wind up writing a bunch of macros like:
#define LATENCY(MIN) (((MIN) >> 8) & 0xff) #define SET_LATENCY(MIN, LATENCY) ((MIN) = (((MIN) & ~(0xff << 8)) | (((LATENCY) & 0xFF) << 8))) #define CYCLE_TIME(MIN) ((MIN) & 0xff) #define SET_CYCLE_TIME(MIN, CYCLE_TIME) ((MIN) = (((MIN) & ~0xff) | #((CYCLE_TIME) & 0xFF)))
So many times while in your registers you have enough bits to hold everything you want to hold Theoretically