[ELF] Add RelocationScanner. NFC
Currently the way some relocation-related static functions pass around states is clumsy. Add a Resolver class to store some states as member variables. Advantages: * Avoid the parameter `InputSectionBase &sec` (this offsets the cost passing around `this` paramemter) * Avoid the parameter `end` (Mips and PowerPC hacks) * `config` and `target` can be cached as member variables to reduce global state accesses. (potential speedup because the compiler didn't know `config`/`target` were not changed across function calls) * If we ever want to reduce if-else costs (e.g. `config->emachine==EM_MIPS` for non-Mips) or introduce parallel relocation scan not handling some tricky arches (PPC/Mips), we can templatize Resolver `target` isn't used as much as `config`, so I change it to a const reference during the migration. There is a minor performance inprovement for elf::scanRelocations. Reviewed By: ikudrin, peter.smith Differential Revision: https://reviews.llvm.org/D116881
parent
b22a93f4
Please register or sign in to comment