RISC-V: Move macro fusion logic to a separate file.
The RISC-V macro fusion logic was moved to riscv-fusion.cc to prevent riscv.cc from becoming too large.
The RISC-V backend’s macro fusion logic, specifically the riscv_macro_fusion_pair_p function, was moved from riscv.cc to a new file, riscv-fusion.cc. This change aims to improve code organization and maintainability as more fusion cases are added. New tests were added to verify existing fusion cases tied to specific microarchitecture tunings.
In Details
The commit refactors the RISC-V backend by moving the macro fusion logic from riscv.cc to riscv-fusion.cc. Specifically, riscv_macro_fusion_pair_p, riscv_macro_fusion_p and related functions are moved. The change involves updating config.gcc, riscv-protos.h, and t-riscv to reflect the new file. riscv_get_fusible_ops is added to access tune_param->fusible_ops from the new file. This is a non-functional change intended to improve code organization for future additions to the fusion logic.
For Context
Macro fusion is an optimization technique where the compiler combines multiple simple instructions into a single, more complex instruction. This can improve performance on processors that support it. This commit reorganizes the RISC-V compiler's implementation of macro fusion by moving the code that determines which instruction pairs can be fused into a dedicated file. This makes the codebase easier to maintain and extend as more fusion opportunities are identified.