Hello,
The document SPRU514E states in section 3.11.7 that
The compiler recognizes a function whose definition contains only a call to another function. If the two
functions have the same signature (same return value and same number of parameters with the same
type, in the same order), then the compiler can make the calling function an alias of the called function.
I'm trying to observe this optimization with my code but it seems I can't get it to work.
I'm trying to alias the SFO function. Its signature is int SFO(void); so I created a function called PWM_calibrateMep like so:
extern int PWM_calibrateMep(void); // declaration in pwm.h
int PWM_calibrateMep(void) { // definition in pwm.c
return SFO();
}
However, the asm file generated with --optimizer_interlist looks like this:
.sect ".text"
.global _PWM_calibrateMep
;***************************************************************
;* FNAME: _PWM_calibrateMep FR SIZE: 0 *
;* *
;* FUNCTION ENVIRONMENT *
;* *
;* FUNCTION PROPERTIES *
;* 0 Parameter, 0 Auto, 0 SOE *
;***************************************************************
_PWM_calibrateMep:
;*** 57 ----------------------- return SFO();
LCR #_SFO ; [CPU_] |57|
; call occurs [#_SFO] ; [] |57|
LRETR ; [CPU_]
; return occurs ; []
It seems as though the call still occurs within the function. The asm file where PWM_calibrateMep is called also looks like this:
LCR #_PWM_calibrateMep ; [CPU_] |31|
; call occurs [#_PWM_calibrateMep] ; [] |31|
So it appears function symbol aliasing is not performed after all. How do I get it to work?
Regards,
Pierre
P.S: below is the command line used to compile my source code
"C:/Program Files (x86)/Texas Instruments/C2000 Code Generation Tools 6.0.2/bin/cl2000"
-v28
-ml
-mt
--cla_support=cla0
-O3
--symdebug:none
--include_path="C:/Program Files (x86)/Texas Instruments/C2000 Code Generation Tools 6.0.2/include"
--strict_ansi
--super_quiet
--verbose_diagnostics
--display_error_number
--emit_warnings_as_errors
--issue_remarks
--optimizer_interlist
--printf_support=full
--asm_listing
--output_all_syms
--preproc_with_compile
--preproc_dependency="Sources/pwm.pp"
--obj_directory="Sources" "../Sources/pwm.c"