3.4. Controlling Optimization

The following command-line options control optimization behavior.

armcl Option (and alias)

tiarmclang Option

--opt_level=<off|0|1|2|3> (-O<off|0|1|2|3>

-O<0|1|2|3|fast|g|s|z>

--opt_level=4 (-O4)

-flto -O<1|2|3|fast|s|z>

armcl Option (and alias)

tiarmclang Option

--opt_for_speed=<0|1|2|3|4|5>

(-mf=<0|1|2|3|4|5>)

-O<z|s|3|fast>

--opt_level=4

--opt_for_speed=<0|1|2|3|4|5>

(-mf=<0|1|2|3|4|5>)

-flto -O<z|s|3|fast>

armcl Option

tiarmclang Option

--sat_reassoc=off (default) --sat_reassoc=on

not supported

The armcl compiler provides a --sat_reassoc option to enable or disable reassociation of saturating arithmetic. It is off by default.

The tiarmclang compiler does not support an analogous option.

armcl Option (and alias)

tiarmclang Option

--auto_inline=<size> (-oi<size>

-finline-limit=<size>

The armcl compiler provides the --auto_inline option, which, when used in combination with --opt_level=3, allows you to specify a size threshold for automatic inlining of functions that are not explicitly declared as “inline.”

The tiarmclang compiler supports an analogous option, -finline-limit, which allows you to specify a size threshold for functions that can be inlined, where <size> is the number of pseudo instructions.

The tiarmclang compiler also supports the always_inline (“__attribute__((always_inline))”) and noinline ( “__attribute__((noinline))”) function attributes that provide a means for you to control inlining on a function-specific basis. The tiarmclang compiler’s -fno-inline-functions option can be used to disable all inlining.

armcl Option (and alias)

tiarmclang Option

--disable_inlining

-fno-inline-functions

The armcl compiler provides the --disable_inlining option, which allows you prevent any inlining from being performed.

To prevent inlining with the tiarmclang compiler, use the -fno-inline-functions option.

armcl Option (and alias)

tiarmclang Option

--call_assumptions=<n> (-op<n>)

not supported

The armcl compiler provides the --call_assumptions option, which, when used in combination with --program_level_compile and --opt_level=3, allows you to provide additional information to the compiler about whether the functions defined in a given module are called from other modules and whether global variable definitions in a given module are referenced from other modules.

armcl Option (and alias)

tiarmclang Option

--gen_opt_info=<0|1|2>

(-on=<0|1|2>

-fsave-optimization-record

-foptimization-record-file=<filename>

-Rpass=<expr>

-Rpass-missed=<expr>

-Rpass-analysis=<expr>

The armcl compiler provides the --gen_opt_info option, which, when used in combination with --opt_level=3, causes the compiler to emit a human-readable optimization information file. The higher the value of the argument specified, the more verbose the optimization information provided will be.

The tiarmclang compiler does not provide an option that matches the exact behavior of armcl’s --gen_opt_info, but tiarmclang reports optimization information via the following available options:

  • -fsave-optimization-record - writes optimization remarks to a YAML file

  • -foptimization-record-file - identifies the name of the YAML file written when using the -fsave-optimization-record option

  • -Rpass - given a regular expression string argument to identify the optimization pass(es) that you want information about, the -Rpass option writes informative remarks to stdout during compilation about when a specified optimization pass makes a transformation

  • -Rpass-missed - given a regular expression string argument to identify the optimization pass(es) that you want information about, the -Rpass-missed option writes informative remarks to stdout during compilation about when a specified optimization pass fails to make a transformation

  • -Rpass-analysis - given a regular expression string argument to identify the optimization pass(es) that you want information about, the -Rpass-analysis option writes informative remarks to stdout during compilation about why a specified optimization pass does or doesn’t perform a transformation

armcl Option (and alias)

tiarmclang Option

--optimizer_interlist (-os)

not supported

The armcl compiler provides the --optimizer_interlist option, which tells the compiler to keep an compiler-generated intermediate assembly source file that is annotated with interlisted comments corresponding C/C++ source code optimizations to the assembly code generated by the compiler.

The tiarmclang compiler does not provide an analogous option. However, you can use tiarmclang’s -Rpass, -Rpass-missed, and -Rpass-analysis options to gain more insight into which optimizations were performed and potential optimizations that were ruled out during compilation.

armcl Option (and alias)

tiarmclang Option

--program_level_compile (-pm)

-flto

The armcl compiler’s --program_level_compile option combines source files into a single compilation unit to enable the compiler’s program-level optimizations.

The tiarmclang -flto option enables inter-module optimizations via link-time optimization. The tiarmclang -flto option can be combined with the tiarmclang -O<1|2|3|fast|s|z> optimization level option to instruct the compiler whether to prioritize improving performance over reducing code size or vice versa.

armcl Option (and alias)

tiarmclang Option

--aliased_variables (-ma)

not supported

The armcl compiler’s -aliased_variables option instructs the compiler to assume that called functions are capable of creating hidden aliases. As a result, the compiler must assume worst-case aliasing. For example, the optimizer cannot assume that it knows the value stored in a local object if that local object might be accessed via a separate pointer.

The tiarmclang compiler does not provide an analogous option. However, tiarmclang’s -fstrict-aliasing and -fno-strict-aliasing options can be used to enable or disable optimizations based on type based alias analysis, but they don’t allow the compiler to violate the aliasing rules of C. Some aliasing behavior can also be controlled via tiarmclang’s optimization options.