Use numbers instead of characters for genextract path steps
Replaces character-based path encoding in genextract with numbers, improving clarity and removing limitations.
The genextract tool previously used characters to encode path steps for locating operands within patterns. This commit replaces the character encoding (digits for XEXP, lowercase letters for XVECEXP, uppercase for out-of-range indices) with a numerical encoding. This change makes the path representation more explicit, removes limitations on index values, and leads to a moderate increase in the size of the generated code.
In Details
The genextract pass uses a string literal to encode traversal steps into a pattern's structure (XEXP, XVECEXP). This commit refactors this encoding from character-based (e.g., '0'-'9', 'a'-'z') to a byte-based numerical representation (2*index+1 for XEXP, 2*index+2 for XVECEXP). This resolves implicit limits on indices and makes the encoding more robust, albeit at the cost of slightly larger generated tables in files like insn-extract.cc.
- genextract
- A GCC internal tool or pass responsible for extracting information from instruction patterns, often used in backend code generation.
- XEXP
- Represents an expression operand in GCC's internal representation, typically a simple value.
- XVECEXP
- Represents an element within a vector (or 'vec') expression in GCC's internal representation. It includes a vector index.
- insn-extract.cc
- A GCC source file that likely contains code related to the genextract pass and the definitions of instruction patterns.