C– – Efficiency

C to ASM function return

 

 

––––––––––––––

––––––––––––––

 

 

––––––––––––––

––––––––––––––

 

 

––––––––––––––

––––––––––––––

 

 

––––––––––––––

––––––––––––––

 

 

––––––––––––––

––––––––––––––

 

Return Addr

Return Addr

 

––––––––––––––

––––––––––––––

 

Return Addr

Return Addr

 

––––––––––––––

––––––––––––––

R7

Param 2

Param 2

 

––––––––––––––

––––––––––––––

 

Param 2

Param 2

 

––––––––––––––

––––––––––––––

 

Param 1

Param 1

 

––––––––––––––

––––––––––––––

 

Param 1

Param 1

 

––––––––––––––

––––––––––––––

R5

Stack data

R7,R5

Stack data

 

 

––––––––––––––

––––––––––––––

 

RET

 

SUBB R7, 4

 

5.7 C– – Efficiency

C–– allows top-level control code to be written in a C-like language. It does have limitations though. Assembly routines are needed to support C function calls for operations such as reading/writing ports and speaking. The assembly code produced by the C–– compiler is not optimized and will not be as efficient as hand written assembly. Because C–– is not optimized, time critical operations should always be written in assembly.

Since the compiler does not optimize the assembly, writing C–– code in different ways results in different levels of overhead. While and do-while loops have similar overhead (one conditional jump and 1 unconditional jump per

Code Development Tools

5-37

Page 333
Image 333
Texas Instruments MSP50C6xx manual Efficiency, To ASM function return