SPRUI04F july 2015 – april 2023
You control the output of the interlist feature when compiling with optimization (the --opt_level=n or -On option) with the --optimizer_interlist and --c_src_interlist options.
When you use the --optimizer_interlist option with optimization, the interlist feature does not run as a separate pass. Instead, the compiler inserts comments into the code, indicating how the compiler has rearranged and optimized the code. These comments appear in the assembly language file as comments starting with ;**. The C/C++ source code is not interlisted, unless you use the --c_src_interlist option also.
The interlist feature can affect optimized code because it might prevent some optimization from crossing C/C++ statement boundaries. Optimization makes normal source interlisting impractical, because the compiler extensively rearranges your program. Therefore, when you use the --optimizer_interlist option, the compiler writes reconstructed C/C++ statements.
When you use the --c_src_interlist and --optimizer_interlist options with optimization, the compiler inserts its comments and the interlist feature runs before the assembler, merging the original C/C++ source into the assembly file.
For example, suppose the following C code is compiled with optimization (--opt_level=2) and --optimizer_interlist options:
int copy (char *str, const char *s, int n)
{
int i;
for (i = 0; i < n; i ++)
*str++ = *s++;
}
The assembly file contains compiler comments interlisted with assembly code.
_main:
;** 5----------------------- printf("Hello, world\n");
;** 6----------------------- return 0;
STW .D2 B3,*SP--(12)
.line3
B .S1 _printf
NOP 2
MVKL .S1 SL1+0,A0
MVKH .S1 SL1+0,A0
|| MVKL .S2 RL0,B3
STW .D2 A0,*+SP(4)
|| MVKH .S2 RL0,B3
RL0: ; CALL OCCURS
.line4
ZERO .L1 A4
.line5
LDW .D2 *++SP(12),B3
NOP 4
B .S2 B3
NOP 5
; BRANCH OCCURS
If you add the --c_src_interlist option (compile with --opt_level=2, --c_src_interlist, and --optimizer_interlist), the assembly file contains compiler comments and C source interlisted with assembly code.
_main:
;** 5----------------------- printf("Hello, world\n");
;** 6----------------------- return 0;
STW .D2 B3,*SP--(12)
;------------------------------------------------------------------------------
; 5 | printf("Hello, world\n");
;------------------------------------------------------------------------------
B .S1 _printf
NOP 2
MVKL .S1 SL1+0,A0
MVKH .S1 SL1+0,A0
|| MVKL .S2 RL0,B3
STW .D2 A0,*+SP(4)
|| MVKH .S2 RL0,B3
RL0: ; CALL OCCURS
;------------------------------------------------------------------------------
; 6 | return 0;
;------------------------------------------------------------------------------
ZERO .L1 A4
LDW .D2 *++SP(12),B3
NOP 4
B .S2 B3
NOP 5
; BRANCH OCCURS