Skip to content

Commit 72db78e

Browse files
committed
[JITLink] Use Blocks rather than Symbols for SectionRange.
This ensures that anonymous blocks are included in the section range.
1 parent 8c4f048 commit 72db78e

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -615,21 +615,21 @@ class SectionRange {
615615
public:
616616
SectionRange() = default;
617617
SectionRange(const Section &Sec) {
618-
if (llvm::empty(Sec.symbols()))
618+
if (llvm::empty(Sec.blocks()))
619619
return;
620-
First = Last = *Sec.symbols().begin();
621-
for (auto *Sym : Sec.symbols()) {
622-
if (Sym->getAddress() < First->getAddress())
623-
First = Sym;
624-
if (Sym->getAddress() > Last->getAddress())
625-
Last = Sym;
620+
First = Last = *Sec.blocks().begin();
621+
for (auto *B : Sec.blocks()) {
622+
if (B->getAddress() < First->getAddress())
623+
First = B;
624+
if (B->getAddress() > Last->getAddress())
625+
Last = B;
626626
}
627627
}
628-
Symbol *getFirstSymbol() const {
628+
Block *getFirstBlock() const {
629629
assert((!Last || First) && "First can not be null if end is non-null");
630630
return First;
631631
}
632-
Symbol *getLastSymbol() const {
632+
Block *getLastBlock() const {
633633
assert((First || !Last) && "Last can not be null if start is non-null");
634634
return Last;
635635
}
@@ -638,17 +638,16 @@ class SectionRange {
638638
return !First;
639639
}
640640
JITTargetAddress getStart() const {
641-
return First ? First->getBlock().getAddress() : 0;
641+
return First ? First->getAddress() : 0;
642642
}
643643
JITTargetAddress getEnd() const {
644-
return Last ? Last->getBlock().getAddress() + Last->getBlock().getSize()
645-
: 0;
644+
return Last ? Last->getAddress() + Last->getSize() : 0;
646645
}
647646
uint64_t getSize() const { return getEnd() - getStart(); }
648647

649648
private:
650-
Symbol *First = nullptr;
651-
Symbol *Last = nullptr;
649+
Block *First = nullptr;
650+
Block *Last = nullptr;
652651
};
653652

654653
class LinkGraph {

0 commit comments

Comments
 (0)