mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-23 14:25:07 +00:00
Avoid unnecessary section switching. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237913 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -147,8 +147,8 @@ public:
|
|||||||
bool emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo,
|
bool emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo,
|
||||||
unsigned Size) override;
|
unsigned Size) override;
|
||||||
|
|
||||||
bool mayHaveInstructions() const override {
|
bool mayHaveInstructions(const MCSection &Sec) const override {
|
||||||
return getCurrentSectionData()->hasInstructions();
|
return Assembler->getOrCreateSectionData(Sec).hasInstructions();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -728,7 +728,7 @@ public:
|
|||||||
/// \brief Finish emission of machine code.
|
/// \brief Finish emission of machine code.
|
||||||
void Finish();
|
void Finish();
|
||||||
|
|
||||||
virtual bool mayHaveInstructions() const { return true; }
|
virtual bool mayHaveInstructions(const MCSection &Sec) const { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Create a dummy machine code streamer, which does nothing. This is useful for
|
/// Create a dummy machine code streamer, which does nothing. This is useful for
|
||||||
|
@@ -442,8 +442,7 @@ bool MCContext::isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID) {
|
|||||||
void MCContext::finalizeDwarfSections(MCStreamer &MCOS) {
|
void MCContext::finalizeDwarfSections(MCStreamer &MCOS) {
|
||||||
std::vector<const MCSection *> Keep;
|
std::vector<const MCSection *> Keep;
|
||||||
for (const MCSection *Sec : SectionsForRanges) {
|
for (const MCSection *Sec : SectionsForRanges) {
|
||||||
MCOS.SwitchSection(Sec); // FIXME: pass the section to mayHaveInstructions
|
if (MCOS.mayHaveInstructions(*Sec))
|
||||||
if (MCOS.mayHaveInstructions())
|
|
||||||
Keep.push_back(Sec);
|
Keep.push_back(Sec);
|
||||||
}
|
}
|
||||||
SectionsForRanges.clear();
|
SectionsForRanges.clear();
|
||||||
|
Reference in New Issue
Block a user