SPRUIG8J January 2018 – March 2024
The compiler tools include a feature that interlists C/C++ source statements into the assembly language output of the compiler. The interlist feature enables you to inspect the assembly code generated for each C statement. The interlist behaves differently, depending on whether or not the optimizer is used, and depending on which options you specify.
The easiest way to invoke the interlist feature is to use the --c_src_interlist option. To compile and run the interlist on a program called function.c, enter:
cl7x --c_src_interlist function
The --c_src_interlist option prevents the compiler from deleting the interlisted assembly language output file. The output assembly file, function.asm, is assembled normally.
When you invoke the interlist feature without the optimizer, the interlist runs as a separate pass between the code generator and the assembler. It reads both the assembly and C/C++ source files, merges them, and writes the C/C++ statements into the assembly file as comments.
For information about using the interlist feature with the optimizer, see Section 4.12. Using the --c_src_interlist option can cause performance and/or code size degradation.
The C code for the foo() function in foo.c:
int foo(int a, int b, int c)
{
int d = a + b;
int e = d - c;
return e;
}
Is compiled with the following command:
cl7x foo.c --c_src_interlist --symdebug:none
Generates an assembly file, foo.asm, that contains in part:
;----------------------------------------------------------------------
; 1 | int foo(int a, int b, int c)
;----------------------------------------------------------------------
;******************************************************************************
;* FUNCTION NAME: foo *
;* *
;* Regs Modified : A4,A8,D0,SP *
;* Regs Used : A4,A5,A6,A8,D0,SP *
;* Local Frame Size : 0 Args + 0 Auto + 8 Save = 8 byte *
;******************************************************************************
||foo||:
;** --------------------------------------------------------------------------*
MVC .S1 RP,A8 ; [A_S1]
|| STD .D1 A8,*SP(8) ; [A_D1]
ADDD .D1 SP,0xfffffff8,SP ; [A_D1]
;----------------------------------------------------------------------
; 3 | int d = a + b;
;----------------------------------------------------------------------
ADDW .D1 A5,A4,D0 ; [A_D1] |3|
;----------------------------------------------------------------------
; 4 | int e = d - c;
;----------------------------------------------------------------------
SUBW .D1 D0,A6,A4 ; [A_D1] |4|
;----------------------------------------------------------------------
; 5 | return e;
;----------------------------------------------------------------------
MVC .S1 A8,RP ; [A_S1] BARRIER
LDD .D1 *SP(16),A8 ; [A_D1]
RET .B1 ; [A_B]
|| ADDD .D1 SP,0x8,SP ; [A_D1]
; RETURN OCCURS {RP} ; []