You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[AArch64] Add support for -mlong-calls code generation
This patch implements backend support for -mlong-calls on AArch64 targets.
When enabled, calls to external functions are lowered to an indirect call via
an address computed using `adrp` and `add` rather than a direct `bl` instruction,
which is limited to a ±128MB PC-relative offset.
This is particularly useful when code and/or data exceeds the 26-bit immediate
range of `bl`, such as in large binaries or link-time-optimized builds.
Key changes:
- In SelectionDAG lowering (`LowerCall`), detect `-mlong-calls` and emit:
- `adrp + add` address calculation
- `blr` indirect call instruction
This patch ensures that long-calls are emitted correctly for both GlobalAddress
and ExternalSymbol call targets.
Tested:
- New codegen tests under `llvm/test/CodeGen/AArch64/aarch64-long-calls.ll`
- Verified `adrp + add + blr` output in `.s` for global and external functions
0 commit comments