binutils Newspaper
JUNE 15, 2026
aarch64 Proposed

Aarch64: Add F_REQUIRES_SP and eliminate QLF_SP and QLF_WSP

Enforce stack pointer requirements using opcode flags instead of operand qualifiers, simplifying the code.

This patch replaces the QLF_SP and QLF_WSP operand qualifiers with a new opcode flag, F_REQUIRES_SP. This flag enforces the requirement for at least one stack pointer operand in the mov (to/from SP) opcode. By using an opcode flag instead of operand qualifiers, the code for switching between SP and non-SP qualifiers is removed, resulting in a simpler and less confusing implementation.

In Details

This patch refactors the handling of stack pointer requirements in the AArch64 backend. By introducing F_REQUIRES_SP and removing QLF_SP and QLF_WSP in include/opcode/aarch64.h and opcodes/aarch64-asm.c, the code simplifies the qualifier matching process and makes the stack pointer requirement more explicit at the opcode level.

For Context

When the assembler translates code, it needs to ensure that instructions are used correctly. This patch changes how the assembler enforces the rule that certain instructions must use the stack pointer. By using a special flag instead of extra qualifiers, the assembler's code becomes simpler and easier to understand, reducing the chance of errors.

Filed Under: aarch64assemblerstack pointeropcode flagcode simplification