Tool/software: TI C/C++ Compiler
Hello!
We have observed a big increase of code size when moving from using CGT 7.3.23 to CGT 8.3.4. In both compilations, we are using the same compiler flags:
--mem_model:data=far -pdse9 -pdse48 -pdse190 -pdse225 -pdse262 -pdse849 -pdse994 -mi1000 -mv6600 -mo --strip_coff_underscore --disable_push_pop -o3 -ms0
One reason why binary's size is increased is that compiler adds unnecessary NOPs to the code, to align fetch packet boundaries.
And that is visible when it is using so called compact instructions, i.e.16-bit op-codes
CGT 8.3.x
840006f0 10102413 CALLP.S2 $Tramp$S$$AaMemCheckTag (PC+33056 = 0x84008800),B3
840006f4 0c6e || NOP 1
840006f6 0c6e || NOP 1
840006f8 0c6e || NOP 1
840006fa 0c6e || NOP 1
840006fc ec401c0c .fphead n, l, W, BU, nobr, nosat, 1100010b
84000700 $C$RL204:
84000700 2226 CMPEQ.L1 1,A4,A0
84000702 3a76 || MVK.D1 1,A4
84000704 0473902b || MVK.S2 0xffffe720,B8
84000708 04737c29 || MVK.S1 0xffffe6f8,A8
8400070c 0727 || MVK.L2 0,B6
CGT 7.3.x
821f616c 100c1612 CALLP.S2 $Tramp$S$$AaMemCheckTag (PC+24752 = 0x821fc210),B3
821f6170 2226 CMPEQ.L1 1,A4,A0
821f6172 48aa [ A0] BNOP.S1 $C$L63 (PC+68 = 0x821f61a4),2
821f6174 0446aca9 MVK.S1 0xffff8d59,A8
821f6178 020017aa || MVK.S2 0x002f,B4
821f617c e2208003 .fphead n, l, W, BU, br, nosat, 0010001b
And an another problem which is visible, which also adds unnecessary NOPs, which is NOT visible with CGT 7.3.x compilations either:
1081ec50 0fff6410 B.S1 odo_send_helper (PC-1248 = 0x1081e760) -> here we call "odo_send_helper" and the actual "return" is done inside odo_send_helper
1081ec54 71f7 LDW.D2T2 *++B15[2],B3
1081ec56 8047 MV.L2 B0,B4
1081ec58 1313 MVK.S2 16,B6
1081ec5a 16c6 MV.L1X B5,A8
1081ec5c ec000000 .fphead n, l, W, BU, nobr, nosat, 1100000b
1081ec60 00000000 NOP
And the compiler generates an extra return symbol + NOPs, which is never used!!
1081ec64 $C$RL24:
1081ec64 00000000 NOP
1081ec68 00000000 NOP
1081ec6c 00000000 NOP
1081ec70 00000000 NOP
1081ec74 00000000 NOP
1081ec78 00000000 NOP
1081ec7c 00000000 NOP
1081ec80 send:
1081ec80 .text:send:
1081ec80 01ab0228 MVK.S1 0x5604,A3
1081ec84 018843e8 MVKH.S1 0x10870000,A3
1081ec88 018c0264 LDW.D1T1 *+A3[0],A3
1081ec8c d246 MV.L1X B4,A6
1081ec8e cf27 MVK.L2 14,B6
1081ec90 0400a358 MVK.L1 0,A8
1081ec94 0fff5c10 B.S1 odo_send_helper (PC-1312 = 0x1081e760)
1081ec98 020c4266 LDW.D1T2 *+A3[2],B4
1081ec9c e1000000 .fphead n, l, W, BU, nobr, nosat, 0001000b
1081eca0 00006000 NOP 4
1081eca4 $C$RL26:
1081eca4 00000000 NOP
1081eca8 00000000 NOP
1081ecac 00000000 NOP
1081ecb0 00000000 NOP
1081ecb4 00000000 NOP
1081ecb8 00000000 NOP
1081ecbc 00000000 NOP
1081ecc0 odo_send_w_s_safe:
Would you be able to explain why the new compiler generates such unoptimal code?
Second problem is that we are seeing unnecessary symbols (visible in the code but used nowhere) in DWARF structure:
0x00000000 0x00000004 poolIdPrivate
0x00000000 0x00000004 DSP2ARMSender1_
0x00000000 0x00000004 DSP2ARMReceiver1_
0x00000000 0x00000019 $P$T1$2
0x00000000 0x00000004 ret_addr
0x00000000 0x00000004 bufferSize
0x00000000 0x00000004 bufferSize
0x00000000 0x00000004 CHIPDSP_MASK
0x00000000 0x00000800 fftcHostDesc
0x00000000 0x00000004 TEST_LENGTH_IN_SECS
0x00000000 0x00000004 HwSemProcess5_
0x00000000 0x00000004 TBTS_TEST_COMPLETE_IND_MSG
0x00000000 0x00000018 gEthernetLoopbackStatsLastPeriod
0x00000000 0x00000008 IpAddr
0x00000000 0x00000400 gEthFrameBuffer
0x00000000 0x00000002 fragmentIdentification
Br,
Risto Alasaarela