This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
Hi,
I have a query on the usage of diable_inlining function.
I understand that for inlining a function, the code must be compiled with some level of optimization. I presume the function is not inlined with -Ooff even though I add inline keyword to the function. Please correct me if I am wrong.
Let say I have an inline function and the code is compiled with -O2. The same code, if I try to compile with -O2 and --disable_inlining option. Will there be any difference in the generated assembly code other than the added branch and return statements?
For example, func() which is an inline function that gets converted to assembly instructions X,Y,Z with -O2. Will same X,Y,Z be generted (with no added assmebly instructions) if compiled with -O2 and --disable_inlining?
Regards,
Veena
Veena Kamath said:Will same X,Y,Z be generted (with no added assmebly instructions) if compiled with -O2 and --disable_inlining?
No. At the level of a general concept, you show a correct illustration of function inlining. But it overlooks some details.
When the instructions X,Y,Z are inlined into the calling function, further optimization usually occurs. The instructions may be optimized away, mixed in with yet other instructions from the function, in a different order, and so on.
When func is not inlined, it often the case that X,Y,Z are surrounded by instructions which set up and tear down the function.
Thanks and regards,
-George