What Kind of Optimization Is Being Performed?
Example 3−5. Inline Function Expansion
#include <string.h>
struct s { int a,b,c[10]; };
struct t { int x,y,z[10]; };
proc_str(struct s *ps, struct t *pt)
{
}
_proc_str:
TMS320C2x/C2xx/C5x C Compiler Output:
*
* AR5 assigned to variable 'memcpy_1_rfrom'
* AR6 assigned to variable 'memcpy_1_rto'
* BRCR
*
L4:
The compiler finds the intermediate file code for the C function memcpy() in the inline library
and copies it in place of the call. Note the creation of variables memcpy_1_from and
memcpy_1_to, corresponding to the parameters of memcpy. (Often, copy propagation can
eliminate such assignments to parameters of inlined functions when the arguments are not
referenced after the call.)
3-22
. . .
memcpy(ps,pt,sizeof(*ps));
. . .
. . .
assigned to temp var 'L$1'
. . .
LARK
AR2,−3+LF1 ; AR2 = &ps
MAR
*0+
LAR
AR6,*−
LAR
AR5,* ,AR5 ; AR5 = pt
LACK
11
SAMM
BRCR
RPTB
L4−1
LAC
*+,AR6
SACL
*+,AR5
NOP
. . .
; AR6 = ps, AR2 = &pt
; repeat 12 times
; *ps++ = *pt++
; must have 3 words in repeat block
Need help?
Do you have a question about the TMS320C2x and is the answer not in the manual?
Questions and answers