[all-commits] [llvm/llvm-project] 59721f: [MIPS] Optimize sortRelocs for o32
Fangrui Song via All-commits
all-commits at lists.llvm.org
Fri Aug 23 00:05:41 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 59721f2326988ece58fab183971f79b71f751b83
https://github.com/llvm/llvm-project/commit/59721f2326988ece58fab183971f79b71f751b83
Author: Fangrui Song <i at maskray.me>
Date: 2024-08-23 (Fri, 23 Aug 2024)
Changed paths:
M llvm/include/llvm/MC/MCELFObjectWriter.h
M llvm/lib/MC/ELFObjectWriter.cpp
M llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
M llvm/test/MC/Mips/sort-relocation-table.s
Log Message:
-----------
[MIPS] Optimize sortRelocs for o32
The o32 ABI specifies:
> Each relocation type of R_MIPS_HI16 must have an associated R_MIPS_LO16 entry immediately following it in the list of relocations. [...] the addend AHL is computed as (AHI << 16) + (short)ALO
In practice, the high-part and low-part relocations may not be adjacent
in assembly files, requiring the assembler to reorder relocations.
http://reviews.llvm.org/D19718 performed the reordering, but did not
optimize for the common case where a %lo immediately follows its
matching %hi. The quadratic time complexity could make sections with
many relocations very slow to process.
This patch implements the fast path, simplifies the code, and makes the
behavior more similar to GNU assembler (for the .rel.mips_hilo_8b test).
We also remove `OriginalSymbol`, removing overhead for other targets.
Fix #104562
Pull Request: https://github.com/llvm/llvm-project/pull/104723
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list