[llvm] 72db78e - [JITLink] Use Blocks rather than Symbols for SectionRange.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 5 20:20:18 PST 2019
Author: Lang Hames
Date: 2019-12-05T20:19:17-08:00
New Revision: 72db78eba5966fae6bc5bb361ebee7b6d3e1be3a
URL: https://github.com/llvm/llvm-project/commit/72db78eba5966fae6bc5bb361ebee7b6d3e1be3a
DIFF: https://github.com/llvm/llvm-project/commit/72db78eba5966fae6bc5bb361ebee7b6d3e1be3a.diff
LOG: [JITLink] Use Blocks rather than Symbols for SectionRange.
This ensures that anonymous blocks are included in the section range.
Added:
Modified:
llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
index f70de776f065..a33eacc2f67d 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
@@ -615,21 +615,21 @@ class SectionRange {
public:
SectionRange() = default;
SectionRange(const Section &Sec) {
- if (llvm::empty(Sec.symbols()))
+ if (llvm::empty(Sec.blocks()))
return;
- First = Last = *Sec.symbols().begin();
- for (auto *Sym : Sec.symbols()) {
- if (Sym->getAddress() < First->getAddress())
- First = Sym;
- if (Sym->getAddress() > Last->getAddress())
- Last = Sym;
+ First = Last = *Sec.blocks().begin();
+ for (auto *B : Sec.blocks()) {
+ if (B->getAddress() < First->getAddress())
+ First = B;
+ if (B->getAddress() > Last->getAddress())
+ Last = B;
}
}
- Symbol *getFirstSymbol() const {
+ Block *getFirstBlock() const {
assert((!Last || First) && "First can not be null if end is non-null");
return First;
}
- Symbol *getLastSymbol() const {
+ Block *getLastBlock() const {
assert((First || !Last) && "Last can not be null if start is non-null");
return Last;
}
@@ -638,17 +638,16 @@ class SectionRange {
return !First;
}
JITTargetAddress getStart() const {
- return First ? First->getBlock().getAddress() : 0;
+ return First ? First->getAddress() : 0;
}
JITTargetAddress getEnd() const {
- return Last ? Last->getBlock().getAddress() + Last->getBlock().getSize()
- : 0;
+ return Last ? Last->getAddress() + Last->getSize() : 0;
}
uint64_t getSize() const { return getEnd() - getStart(); }
private:
- Symbol *First = nullptr;
- Symbol *Last = nullptr;
+ Block *First = nullptr;
+ Block *Last = nullptr;
};
class LinkGraph {
More information about the llvm-commits
mailing list