3.2. C/C++ Source Migration Aid Diagnostics

When migrating an Arm C/C++ application project from using the armcl compiler to using the tiarmclang compiler you may have instances of TI-specific pragmas, pre-defined macro symbols, or intrinsics that are supported by the armcl compiler, but not the tiarmclang compiler. To make your C/C++ source code more portable, you will need to locate instances of TI-specific pragmas, pre-defined macro symbols, and intrinsics in your source code and convert them into their ACLE (Arm C Language Extensions) counterparts.

Please refer to the Arm C Language Extensions - Release ACLE Q2 2018 specification for details about ACLE.

To help with this process, the tiarmclang compiler will emit a diagnostic when it encounters the use of a legacy TI pre-defined macro symbol, pragma, or intrinsic and provide information about how that use can be safely transformed into a functionally equivalent ACLE alternative, if one exists. In cases where there is no functionally equivalent ACLE alternative to replace an instance of a legacy TI pre-defined macro symbol, pragma, or intrinsic, the tiarmclang compiler will emit a diagnostic to inform you about the presence of that legacy TI mechanism.

Let’s consider a couple of examples …

3.2.1. Legacy TI Pragmas

The legacy TI pragma FUNC_CANNOT_INLINE has a valid ACLE alternative, so if the tiarmclang compiler encounters the following line of code:

#pragma FUNC_CANNOT_INLINE

The tiarmclang compiler will emit the following diagnostic:

warning: pragma FUNC_CANNOT_INLINE is a legacy TI pragma and not
supported in clang compilers. use '__attribute__((always_inline))'
instead

For more information about how many of the commonly occurring legacy TI pragmas can be converted into attribute form, please see the Pragmas and Attributes section.

3.2.2. Legacy TI Pre-Defined Macro Symbols

The legacy TI pre-defined macro symbol __TI_ARM_V7M4__ is an example of a pre-defined macro symbol that can be used to configure Cortex-m4 specific code in an application, but this pre-defined macro symbol is not supported in tiarmclang and needs to be replaced by a functionally equivalent ACLE expression. Specifically, when the following line of code is encountered by the tiarmclang compiler:

#if defined(__TI_ARM_V7M4__)
...
#endif

the tiarmclang compiler will emit the following diagnostic:

warning: __TI_ARM_V7M4__ is a legacy TI macro that is not defined
in clang compilers and will evaluate to 0, use '(__ARM_ARCH == 7) &&
(__ARM_ARCH_PROFILE == 'M') && defined(__ARM_FEATURE_SIMD32)'
instead [-Wti-macros]

The warning can then be averted by replacing the __TI_ARM_V7M4__ symbol reference with the following:

#if (__ARM_ARCH == 7) && (__ARM_ARCH_PROFILE == 'M') && defined(__ARM_FEATURE_SIMD32)

However, there are other legacy TI pre-defined macro symbols, like __TI_ARM_V4__, that do not have a viable ACLE alternative, so the following code:

#if defined(__TI_ARM_V4__)

will yield the following diagnostic when encountered by the tiarmclang compiler:

warning: '__TI_ARM_V4__' is a legacy TI macro and not supported in clang
compilers

For more information about how many of the legacy TI pre-defined macro symbols can be converted into their functionally equivalent ACLE form, please refer to the Pre-Defined Macro Symbols section.

3.2.3. Legacy TI Intrinsics

The legacy TI intrinsic “_smulbt” is an example of an armcl compiler intrinsic that has a viable ACLE alternative form, so when the tiarmclang compiler encounters the following function:

int foo(int x, int y) {
  return _smulbt(x,y);
}

the tiarmclang compiler will emit the following diagnostic:

warning: _smulbt is a legacy TI intrinsic and is not supported in clang
compilers, use '__smulbt' declared in arm_acle.h [-Wti-intrinsics]

Note that while the armcl version of the “_smulbt” is prefixed with a single underscore, the ACLE version of the same intrinsic is prefixed by two underscores, “__smulbt”, so transforming the armcl version of the intrinsic into its ACLE form is as easy as adding an extra underscore.

Note also that unlike the armcl intrinsics, which are declared implicitly within the armcl compiler, the tiarmclang compiler requires that the ACLE intrinsics be explicitly declared by including the arm_acle.h include file in your source before the first use of an ACLE intrinsic.

Not all armcl intrinsics are as easy as “_smulbt” to migrate to a functionally equivalent ACLE form. For more details on how specific armcl intrinsics can be migrated, please refer to the Intrinsics and Built-in Functions section.

3.2.4. Turning Off the Migration Aid Diagnostics

The migration aid diagnostics for use of legacy TI macro symbols, pragmas, and intrinsics are enabled by default in the tiarmclang compiler. The following tiarmclang compiler options can be specified to selectively turn off the migration aid diagnostic categories:

  • -Wno-ti-pragmas : to suppress migration aid diagnostics for legacy TI pragmas

  • -Wno-ti-macros : to suppress migration aid diagnostics for legacy TI pre-defined macro symbols

  • -Wno-ti-intrinsics : to suppress migration aid diagnostics for legacy TI intrinsics