i386: Introduce `x86_64_eightbyte_aligned_p` for argument classification
A new helper function `x86_64_eightbyte_aligned_p` improves clarity and correctness in classifying x86-64 function arguments based on alignment.
This commit introduces x86_64_eightbyte_aligned_p to determine if a bit offset aligns with an eightbyte boundary, a key concept in the x86-64 System V ABI. The function is used within classify_argument to replace manual bitwise checks, leading to cleaner code. Additionally, the promotion of partial argument classes in ARRAY_TYPE cases has been refactored using a switch statement and GET_MODE_SIZE, improving readability and correctness by directly using scalar mode sizes instead of hardcoded values.
In Details
The i386 backend introduces x86_64_eightbyte_aligned_p in config/i386/i386.cc to test if a bit offset aligns with an eightbyte boundary, as defined by the x86-64 psABI. This function replaces open-coded % 64 tests within classify_argument. Concurrently, the promotion of partial integer classes for array types is refactored from if/else if chains to a switch(subclasses[0]) statement, using GET_MODE_SIZE of the scalar mode for clarity and correctness, replacing hardcoded 4 and 2 values.
- x86-64 System V ABI
- The Application Binary Interface (ABI) standard for 64-bit x86 processors, defining how functions are called, how arguments are passed, and how data is laid out in memory.
- eightbyte
- A unit of 8 bytes, significant for alignment and argument passing in the x86-64 ABI.
- classify_argument
- A compiler function that determines how a function argument should be passed (e.g., in a register or on the stack) according to the target ABI.
- psABI
- Processor-specific Application Binary Interface. For x86-64, this typically refers to the System V ABI.
- GET_MODE_SIZE
- A GCC internal macro that returns the size in bits of a given machine mode (data type).