mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[JITLink] Use Blocks rather than Symbols for SectionRange.
This ensures that anonymous blocks are included in the section range.
This commit is contained in:
parent
6b150e9d3c
commit
1eaa1069e9
@ -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 @@ public:
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user