Hi all, I am porting GCC to a weird architecture and I have stumbled over this small problem. The architecture has write-only registers (er0 - er7) for I/O operations, reading values from these registers is forbidden. For the following code:
register int ER0 asm("er0"); int main() { int a, b; ER0 = a; b = a +1; // copy propagation --> b = ER0 + 1; return b; } Regmove pass converts b = a +1 into b = ER0 + 1, which is not allowed as er0 is a write-only register. I went through the code in regmove.c and found that it was not properly checking whether such a transformation satisfies the instruction constraints. Currently, I have done a point fix to stop regmove to copy propogate if the destination register (er0) is write-only. I would like to ask the GCC gurus, if there is proper/nicer way to handle this problem? Or if this problem has already been solved in the latest version of GCC? We are using gcc-4.0.2. Thank you very much for your time, Best Regards, Manish --------------------------------------------------------- Dr. Manish Verma Altera European Technology Centre, High Wycombe, UK