GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
cobol Performance Win

COBOL: Use library routine for intermediate value moves

Improves COBOL middle-end performance by replacing direct moves with a library call.

This commit changes the COBOL compiler’s intermediate representation to call a library routine, __gg__move(), for moving intermediate values. Previously, the compiler generated many individual statements with conditional tests for such moves, leading to poor middle-end performance. Routing these operations through a dedicated library function significantly improves behavior, mitigating performance issues observed with thousands of such statements.

In Details

The COBOL frontend previously generated GENERIC nodes for moving intermediate_e values directly, which involved numerous conditional tests. This approach resulted in unsatisfactory middle-end performance, potentially exhibiting quadratic behavior in complex functions. By rerouting these moves to the library routine __gg__move(), the compiler reduces the overhead of explicit checks and consolidations, leading to a more efficient representation and better performance in the middle-end passes.

For Context
COBOL
A compiled programming language designed for business applications. It is known for its verbose syntax and focus on data handling and financial calculations.
intermediate value
A temporary value computed during the execution of a program. In compilers, intermediate values are often represented in an intermediate representation (IR) before being optimized and translated into machine code.
GENERIC
An intermediate representation (IR) used in GCC. It is a language-independent representation of the program's structure and operations, sitting between the frontend's parse tree and the optimization passes.
__gg__move
A library routine called by the GCC COBOL compiler to handle the movement of intermediate values. Using this routine instead of generating inline code improves middle-end performance.
Filed Under: cobolcompilerperformanceoptimization