3.6. Controlling the Runtime Model

The following options can be used to dictate compiler behavior with regards to how code and data is organized in compiler generated object files, generating code to monitor stack usage at run-time, constraints on pointer alignment when generating code to access memory, and enabling a link-time dead-code removal optimization.

cl2000 Option

c29clang Option

--gen_func_subsections=on (default)

--gen_func_subsections=off

-ffunction-sections (default)

-fno-function-sections

The cl2000 compiler’s --gen_func_subsections option, which is on by default, places each function definition into a separate subsection.

The analogous c29clang option is -ffunction-sections, also on by default, which generates each function definition into its own section. You can further control section placement with the section function attribute, __attribute__((section(“<section name>”))), which can be added to the definition of a function to place it in a particular section.

Placing every function definition in its own section will enable the linker to remove unreferenced functions from the linked output file. As this can prove to have a significant impact on reducing the code size of a program without any impact on run-time performance, it is recommended that the default setting of -ffunction-sections be left intact.

cl2000 Option

c29clang Option

--gen_data_subsections=on (default)

--gen_data_subsections=off

-fdata-sections (default)

-fno-data-sections

The cl2000 compiler’s --gen_data_subsections option, which is on by default, places aggregate data (arrays, structs, and unions) into separate subsections.

The analogous c29clang option is -fdata-sections, also on by default, which generates a separate section for each variable, including non-aggregate variables. You can further control section placement with the section variable attribute, __attribute__((section(“<section name>”))), which can be added to the definition of a particular data object to place it in a particular section.

Placing every variable definition in its own section will enable the linker to remove unreferenced data objects from the linked output file. As this can prove to have a significant impact on reducing the amount of space allocated for variables in a program without impacting run-time performance, it is recommended that the default setting of -fdata-sections be left intact.

cl2000 Option (and alias)

c29clang Option

--no_rpt (-mi)

not supported

The cl2000 provides this option to prevent the compiler from generating repeat (RPT) instructions. By default, repeat instructions are generated for certain memcpy, division, and multiply-accumulate operations. However, repeat instructions are not interruptible.

The c29clang compiler does not provide an analogous option.

cl2000 Option

c29clang Option

--printf_support=<nofloat|full|minimal>

automatic

The cl2000’s --printf_support option allows you to limit the printf and scanf support required in the standard C runtime library. For example, if the you know that an application will never pass a floating-point value to be formatted by a printf- or scanf-family function, then using the --printf_support=nofloat option instructs the compiler to use a customized version of the printf- or scanf-family C/C++ runtime function that does not support floating-point and is therefore much smaller than a printf- or scanf-family function that provides full support for floating-point.

The c29clang compiler tools embed metadata in compiler-generated object code to help the linker automatically determine whether a smaller implementation of the printf support function can be used in the link step of an application build.

See Printf Support Optimization (no option) for additional information about this behavior.

cl2000 Option (and alias)

c29clang Option

--protect_volatile (-mv)

not supported

The cl2000 provides this option to enable volatile reference protection. Pipeline conflicts may occur between non-local variables that have been declared volatile. A conflict can occur between a write to one volatile variable that is followed by a read from a different volatile variable. The –protect_volatile option allows instructions to be placed between volatile references to ensure the write occurs before the read.

The c29clang compiler does not provide an analogous option.

cl2000 Option

c29clang Option

--ramfunc=off (default)

--ramfunc=on

not supported

The cl2000 compiler’s --ramfunc option, when it is on (default behavior is off), instructs the compiler to generate the code for the functions defined in a compilation unit into a special “.TI.ramfunc” section, which can then be placed in RAM memory at link time.

The c29clang compiler does not provide an analogous option. However, the code generated for a function can be directed into a specific section using a section function attribute, such as __attribute__((section(“<section name>”))), attached to the function definition in the C/C++ source file where it is defined.

cl2000 Option (and alias)

c29clang Option

--rpt_threshold=k

not supported

The cl2000 provides this option to set a maximum value on the number of times generated repeat (RPT) loops, which are not interruptible, may iterate.

The c29clang compiler does not provide an analogous option.