This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Optimizer information file for link-time optimization

Other Parts Discussed in Thread: MSP430F2618

Hi,

I'm debugging optimized code for a MSP430F2618 with MSPCGT v4.1.3 and CCSv5.3. Using compiler option -O3 the program passes all tests and works as expected.

Unfortunately I am not very successful with enabled link-time optimization (-O4) so far. With help of the debugger I've narrowed down the problem to only one function. If I open the disassembly view of the debugger it shows the function in question is inlined and more optimized. The map file confirmes that the symbol of that global function disappears.

I have enabled diagnostic messages, optimizer information files and assembler listings to understand how the compiler tries to optimze that part of my code. Looking at the generated *.asm or *.lst files the function is not inlined and there's still a call to that function present. The file-level analysis summary in the *.nfo file does not mark the function inlineable. ofd430 shows a reference to the function for the corresponding *.obj file.

My compiler flags are (without include search path):

-vmspx --abi=eabi --code_model=small --data_model=small -O4 --opt_for_speed=4 -g --optimize_with_debug=on  --gen_acp_xref --gen_acp_raw --define=__MSP430F2618__ --diag_warning=225 --display_error_number --issue_remarks --optimizer_interlist --gen_opt_info=2 --printf_support=minimal -k --src_interlist --asm_listing --cross_reference

My linker flags are (without library search path):

-vmspx --abi=eabi --code_model=small --data_model=small -O4 --opt_for_speed=4 -g --optimize_with_debug=on --gen_acp_xref --gen_acp_raw --define=__MSP430F2618__ --diag_warning=225 --display_error_number --issue_remarks --optimizer_interlist --gen_opt_info=2 --printf_support=minimal -k --src_interlist --asm_listing --cross_reference -z --stack_size=80 -m"msp430f2618.map" --heap_size=0 --use_hw_mpy=16 --reread_libs --verbose_diagnostics --warn_sections --display_error_number --issue_remarks --rom_model

Am I fatally wrong? I have the strange feeling that my brain is probably still on vacation. Where do I find the resulting assembly listing files after link-time optimization? Is it possible to make the optimizer information file more garrulous for -O4?

Best regards,
Christian

  • Christian Steffen said:
    Where do I find the resulting assembly listing files after link-time optimization?

    It is only one assembly file.  It is deleted by default.  To defeat that, use the undocumented link option --keep_lto_files.  I presume you have a linker command file in your CCS project with a name like lnk_cc430something.cmd.  Edit that file and add this line towards the beginning ...

    --keep_lto_files=asm

    After you build, the Debug directory (or whatever the current configuration is named) contains a file named lto_project_name.asm.  That's the file you want.  Besides asm for assembly files, other choices are obj for object file, lst for assembler listing file, and tmps for temporary file.

    By the way, lto stands for link time optimization.  That is a more garrulous way of talking about optimization level 4.

    Hope this helps ...

    -George

  • Thank you very much George!