Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-11085

Using CODE_SECTION pragma prevents function aliasing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • Code Generation Tools
    • CODEGEN-10953
    • C6000_8.3.12
    • default
    • Use the FUNC_ALWAYS_INLINE pragma on the function to be inlined. This will prevent the aliasing optimization and allow inlining, which is not impacted by the CODE_SECTION pragma.

      Use of the CODE_SECTION pragma does not prevent inlining of functions. However, it does prevent the compiler from completely removing one function and making that function's symbol a reference to a different function-- a different optimization known as aliasing. Aliasing happens when the two functions have identical prototypes, and one function simply returns the other without doing any additional work. In this case, since the first function call can simply reference the second function, there is no reason to keep both function bodies around. However, if the function to be eliminated has a CODE_SECTION pragma on it, the compiler will not remove it. It will also no longer inline because of the order in which optimizations were performed and the fact that the decision not to generate the alias happens after the other transformations have already occurred.

      However, if the ALWAYS_INLINE pragma is used on the function to be inlined, then the aliasing optimization will not occur and the function will be inlined instead. Note that aliasing is preferable to inlining because it reduces the object size of the program. But if the CODE_SECTION pragma must be used, then use of the ALWAYS_INLINE pragma ensures that function call overhead will at least be avoided when possible.

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: