diff options
author | Amir Ayupov <aaupov@fb.com> | 2023-02-21 22:09:17 -0800 |
---|---|---|
committer | Amir Ayupov <aaupov@fb.com> | 2023-02-27 15:22:35 -0800 |
commit | 08ab4faf1aa338802ce7f482622dc020a2a26e08 (patch) | |
tree | 809f599117f3e0820f3cb56b788f580fdb48d8ae /bolt/include | |
parent | 03e94f66087ea48a6321738130bdf85e714ad281 (diff) | |
download | llvm-08ab4faf1aa338802ce7f482622dc020a2a26e08.tar.gz |
[BOLT][NFC] Const-ify analyzeJumpTable
Avoid modifying `BF`, instead set extra output parameter and modify BF in caller
scope.
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D144598
Diffstat (limited to 'bolt/include')
-rw-r--r-- | bolt/include/bolt/Core/BinaryContext.h | 15 | ||||
-rw-r--r-- | bolt/include/bolt/Core/JumpTable.h | 3 |
2 files changed, 15 insertions, 3 deletions
diff --git a/bolt/include/bolt/Core/BinaryContext.h b/bolt/include/bolt/Core/BinaryContext.h index 77d64147cbce..26b8a64af3dc 100644 --- a/bolt/include/bolt/Core/BinaryContext.h +++ b/bolt/include/bolt/Core/BinaryContext.h @@ -366,6 +366,13 @@ public: BinaryFunction *getBinaryFunctionContainingAddress(uint64_t Address, bool CheckPastEnd = false, bool UseMaxSize = false); + const BinaryFunction * + getBinaryFunctionContainingAddress(uint64_t Address, + bool CheckPastEnd = false, + bool UseMaxSize = false) const { + return const_cast<BinaryContext *>(this) + ->getBinaryFunctionContainingAddress(Address, CheckPastEnd, UseMaxSize); + } /// Return a BinaryFunction that starts at a given \p Address. BinaryFunction *getBinaryFunctionAtAddress(uint64_t Address); @@ -504,9 +511,11 @@ public: /// Optionally, populate \p Address from jump table entries. The entries /// could be partially populated if the jump table detection fails. bool analyzeJumpTable(const uint64_t Address, - const JumpTable::JumpTableType Type, BinaryFunction &BF, + const JumpTable::JumpTableType Type, + const BinaryFunction &BF, const uint64_t NextJTAddress = 0, - JumpTable::AddressesType *EntriesAsAddress = nullptr); + JumpTable::AddressesType *EntriesAsAddress = nullptr, + bool *HasEntryInFragment = nullptr) const; /// After jump table locations are established, this function will populate /// their EntriesAsAddress based on memory contents. @@ -1143,7 +1152,7 @@ public: /// Return a relocation registered at a given \p Address, or nullptr if there /// is no relocation at such address. - const Relocation *getRelocationAt(uint64_t Address); + const Relocation *getRelocationAt(uint64_t Address) const; /// Register a presence of PC-relative relocation at the given \p Address. void addPCRelativeDataRelocation(uint64_t Address) { diff --git a/bolt/include/bolt/Core/JumpTable.h b/bolt/include/bolt/Core/JumpTable.h index 2f85232591d9..52b9ccee1f7e 100644 --- a/bolt/include/bolt/Core/JumpTable.h +++ b/bolt/include/bolt/Core/JumpTable.h @@ -66,6 +66,9 @@ public: /// The type of this jump table. JumpTableType Type; + /// Whether this jump table has entries pointing to multiple functions. + bool IsSplit{false}; + /// All the entries as labels. std::vector<MCSymbol *> Entries; |