diff options
author | Fangrui Song <i@maskray.me> | 2025-01-27 18:24:59 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-27 18:24:59 -0800 |
commit | e0c7f081f1582d49f81ec4c6cdbf5d6ef13c58ba (patch) | |
tree | 4d4da42cde3e9b274a5f4fd875b3b3dbb93bd5cc /llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp | |
parent | c4891089125d4ba312204cc9a666339abbfc4db2 (diff) | |
download | llvm-e0c7f081f1582d49f81ec4c6cdbf5d6ef13c58ba.zip llvm-e0c7f081f1582d49f81ec4c6cdbf5d6ef13c58ba.tar.gz llvm-e0c7f081f1582d49f81ec4c6cdbf5d6ef13c58ba.tar.bz2 |
[lld-macho] Refactor BPSectionOrderer with CRTP. NFC
PR #117514 refactored BPSectionOrderer to be used by the ELF port
but introduced some inefficiency:
* BPSectionBase/BPSymbol are wrappers around a single pointer.
The numbers of sections and symbols could be huge, and the extra
allocations are memory inefficient.
* Reconstructing the returned DenseMap (since BPSectionBase != InputSectin)
is wasteful.
This patch refactors BPSectionOrderer with Curiously Recurring Template
Pattern and eliminates the inefficiency. In addition,
`symbolToSectionIdxs` is removed and `rootSymbolToSectionIdxs` building
is moved to lld/MachO: while getting sections for symbols is cheap in
Mach-O, it is awkward and inefficient in the ELF port.
While here, add a file-level comment and replace some `StringMap<*>`
(which copies strings) with `DenseMap<CachedHashStringRef, *>`.
Pull Request: https://github.com/llvm/llvm-project/pull/124482
Diffstat (limited to 'llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp')
0 files changed, 0 insertions, 0 deletions