This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Code size Increased Unreasonably!

Hi Everyone,

I'm using C251 compiler with optimization level 9 with 'size' emphasis. I've a function similar to one given below.

int * fun(short* param1, Boolean param2){

//..........code goes here
}

This function is being called as fun(someValue,TRUE) or fun(someValue, FALSE) across the souce code. I tried to replace these calls with the help of two new functions that knows beforehand second argument. This change was based on calling convention used by C251.
I assumed that C251 passes parameters similarly as C51,i.e. by using registers and memory locations (hence boolean parameter need not be passed at all).

Warpper functions are given below.

int * funTRUE(short* param){

return fun(param,TRUE);
}

int * funFALSE(short* param){

return fun(param,FALSE);
}

After this change code size has increased by around 3K rather than went down. Replacement are around 20 so we can not say that code of wrapper functions have added to increase in the code size more than reduction due to call replacements with calls to wrapper functions.
How can I've more insight in this phenomenon?

Parents
  • It might even be a direct bug in the optimizer, making it skipping an important optimization because your code no longer matches existing optimization rules and the rule list is missing some reasonable rules.

    It might be an idea to try to create as small program as possible that gives this problem and then contact Keil.

Reply
  • It might even be a direct bug in the optimizer, making it skipping an important optimization because your code no longer matches existing optimization rules and the rule list is missing some reasonable rules.

    It might be an idea to try to create as small program as possible that gives this problem and then contact Keil.

Children