|
|||||||||||
|
Technical Support Support Resources
Product Information |
C51: Expected LCALL But See LJMPInformation in this article applies to:
QUESTIONWhen I compile my program, and look at the disassembly, I see an LJMP at a location where I call a function, instead of an LCALL. Why, and what effect does this have on the execution of my program? ANSWERThe optimizer can rearrange code to minimize resource usage. For example, in order to avoid the use of two bytes of stack space, the compiler uses an LJMP into a function, if it's the last instruction in another function. unoptimized
optimized
The first example uses four bytes of stack space, two for the return address from fn1, and two for the return address from fn2. The optimized code uses only two bytes of stack space for the return address pushed onto the stack when fn1 gets called. fn2 will return to the address that called fn1 when it finishes. This optimized code also executes faster and uses less program space. MORE INFORMATION
Last Reviewed: Thursday, February 25, 2021 | ||||||||||
|
|||||||||||
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.