I'm using the CodeWarrior for Coldfire (6.3 build 14) for my C code and would like to know if there's a fastcall keyword available or some other equivalent __declspec parameter that I can use to indicate certain functions should pass their parameters by register rather than pushing them on the stack.
I know there's a global optimization flag to enable passing by register, but I don't want to use that. I only want to optimize certain functions this way by specifying them explicitly in the function declaration.
I noticed that __fastcall seems to be a keyword, as its color is blue in the IDE. However, when I specify __fastcall in a function declaration, I get a syntax error at compile time.
long __fastcall Plx_lSwapBytes(long Value);
Is there a list of valid __declspec parameters somewhere? I searched the documentation and could not find anything specifying what __declspec's are available.
It sounds like the #pragma you are referring to is a global option, just like the global option in the IDE. And here's a note from the PDF that you referenced that also leads me to believe this is a global setting.
NOTE: Be sure that all called functions have prototypes. When you compile and link, parameter passing should be the same for all files and libraries.
What I'm looking for is to individually specify functions to allow for register passing. I don't want to do that wholescale for the entire compilation.
The pragma works for your case. I did write some test code in the past in which just some function were using the register calling convention. Note that the pragma stays active until you switch to another calling convention (I think #pragma push/#pragma pop work too). Don't forget to switch back. Also do respect the warning, just putting the pragma before a function definition wont help code which just reads the declaration in a header file. The declaration and the definition have to have the same calling convention.