[lld] [llvm] [Hexagon] Add support for decoding PLT symbols (PR #123425)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 27 10:33:09 PST 2025
================
@@ -734,8 +734,44 @@ class HexagonMCInstrAnalysis : public MCInstrAnalysis {
Target = Value;
return true;
}
+
+ uint32_t getValueFromMask(uint32_t Instruction, uint32_t Mask) const {
+ uint32_t Result = 0;
+ size_t Off = 0;
+ for (uint32_t Bit = 0; Bit != sizeof(uint32_t) * CHAR_BIT; ++Bit) {
----------------
quic-areg wrote:
> Is the value `(1u << llvm::popcount(Instruction & Mask)) - 1` ?
It is not. The value will have `popcount(Instruction & Mask)` set bits but the number of significant bits is larger. This function tries to extract immediate value from an instruction encoding. It could be done by manually extracting and shifting the bits, but I thought this function was cleaner since the immediate bits are non-contiguous. The expression would look like this:
```
uint32_t Address =
(((ImmExt & 0x0fff) | (ImmExt & 0xfff3 >> 16) >> 2) << 6) +
((LoadGotPlt & 0x1f80) >> 7) + PltSectionVA + Byte;
```
https://github.com/llvm/llvm-project/pull/123425
More information about the llvm-commits
mailing list