I have been doing high-performance optimization of complex algorithms for decades. I had not used CCS for more than a few years. I ALWAYS create a workstation or Windows emulation of any embedded code that I am working on, because when I start with working code, it is SOO muc faster and easier to modify and test it outside of any embedded development system that I have ever encountered.
This evening, I was slugging away at some code and making good progress. Then I went to compile it under CCS to look at the loop pipelining reports. The compilation time under CCS had been several minutes. (Using Version 3.3.28.2, IDE 5.95.0.219 OK: I just saw that the copyright on the compiler belonging to my employer says 2006... Hmm) But when the compiler hung for more then ten minutes, I started to believe that it was broken. Not so much. Several PAINFUL hours later, I discovered the problem.
I wish that I could figure out how to contact the CCS development team. But hell, it's 5:00 AM and I've had enough. Besides,. I don't know whether the problem persists in recent versions of CCS.
By declaring those local stack based pointers to be of type
unsigned short * restrict
instead of
unsigned short *
The compile time was suddenly MUCH, MUCH faster. (Maybe half of what it was before my changes made it unbearable)
(CAREFUL THERE CHILDREN: DON'T SAY "restrict" IF YOU DON'T MEAN IT!!)