Use rtx_sequence accessors instead of XVECEXP
Replaces low-level RTX sequence access with higher-level, safer functions.
This commit replaces the direct use of XVECEXP for accessing elements within RTX sequences with more robust and safer accessor functions. This change improves code maintainability and reduces the potential for errors by abstracting away the low-level details of RTX sequence manipulation. The affected areas include various target backends and internal compiler passes dealing with instruction sequences.
In Details
This commit replaces uses of the XVECEXP macro, which accesses elements within an RTX vector (often used for instruction sequences), with the more robust rtx_sequence accessor functions (e.g., next_insn, link_insn_into_chain, remove_insn). This is a code quality improvement that moves away from direct manipulation of the underlying RTX structure towards a cleaner API. It impacts numerous areas of the compiler, including emit-rtl, final, reorg, and several target backends, enhancing the safety and readability of instruction sequence handling.
- RTX
- Representation of intermediate values in GCC. It's a tree-like data structure used to represent expressions, instructions, and other program elements during compilation.
- XVECEXP
- A low-level macro used to access elements within an RTX vector, often representing a sequence of instructions.
- rtx_sequence
- A data structure or abstraction within GCC's RTL that represents a sequence of instructions or other RTX elements, providing a safer API for manipulation.
- RTL
- Register Transfer Language. GCC's internal intermediate representation used to represent the program before and during optimization and code generation.