GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
sh

SH removes can_create_pseudo_p check

This commit removes a redundant `can_create_pseudo_p` check from the SH backend, simplifying optab instruction definitions.

The can_create_pseudo_p check in the bswapsi instruction pattern for the SH architecture has been removed. This check proved redundant because optab instruction conditions are cached and do not adapt to different compilation phases. General-purpose arithmetic optabs like bswap can only be used when can_create_pseudo_p is logically true, making the explicit check unnecessary and simplifying the instruction definition.

In Details

The bswapsi optab in sh.md previously included a can_create_pseudo_p() check. This check is now removed because optab instruction conditions are not dynamic; they are cached and do not automatically adjust to different compilation phases. Since such general-purpose arithmetic optabs can only be enabled when can_create_pseudo_p is true, the explicit check was redundant and unnecessarily complicated the instruction definition. This simplifies the SH backend's instruction matching logic.

For Context

In GCC, each architecture (like SH) has specific rules for generating machine code from the compiler's internal representation. These rules are defined in "optabs." One such rule for the SH architecture deals with byte-swapping integers (bswapsi). The compiler used to have an extra check (can_create_pseudo_p) to ensure it was in a phase where it could create temporary internal variables. However, this check was redundant because the conditions for using these instruction patterns are fixed and don't change throughout the compilation process. This commit removes that unnecessary check, making the compiler's code for the SH architecture a bit cleaner and simpler.

Filed Under: shrefactorbackend